Added overlay rendering support for builders + return of start/end labels.
This commit is contained in:
parent
22865e60af
commit
b0cc29570e
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -310,8 +310,6 @@
|
|||||||
<key>Dock</key>
|
<key>Dock</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
<key>BecomeActive</key>
|
|
||||||
<true/>
|
|
||||||
<key>ContentConfiguration</key>
|
<key>ContentConfiguration</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>PBXProjectModuleGUID</key>
|
<key>PBXProjectModuleGUID</key>
|
||||||
@ -329,7 +327,7 @@
|
|||||||
<key>_historyCapacity</key>
|
<key>_historyCapacity</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
<key>bookmark</key>
|
<key>bookmark</key>
|
||||||
<string>6B25B6260FFA63C8004F1BC4</string>
|
<string>6B25B62F0FFAAAF4004F1BC4</string>
|
||||||
<key>history</key>
|
<key>history</key>
|
||||||
<array>
|
<array>
|
||||||
<string>6BB87E0B0F9DE8A300E33F12</string>
|
<string>6BB87E0B0F9DE8A300E33F12</string>
|
||||||
@ -513,6 +511,8 @@
|
|||||||
<string>PBXCVSModule</string>
|
<string>PBXCVSModule</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>BecomeActive</key>
|
||||||
|
<true/>
|
||||||
<key>ContentConfiguration</key>
|
<key>ContentConfiguration</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>PBXProjectModuleGUID</key>
|
<key>PBXProjectModuleGUID</key>
|
||||||
|
@ -36,6 +36,7 @@ public:
|
|||||||
virtual void setToolEndPos(const float* p);
|
virtual void setToolEndPos(const float* p);
|
||||||
|
|
||||||
virtual void handleRender();
|
virtual void handleRender();
|
||||||
|
virtual void handleRenderOverlay(class GLFont* font, double* proj, double* model, int* view);
|
||||||
virtual void handleMeshChanged(const float* verts, int nverts,
|
virtual void handleMeshChanged(const float* verts, int nverts,
|
||||||
const int* tris, const float* trinorms, int ntris,
|
const int* tris, const float* trinorms, int ntris,
|
||||||
const float* bmin, const float* bmax);
|
const float* bmin, const float* bmax);
|
||||||
|
@ -51,9 +51,11 @@ protected:
|
|||||||
void toolReset();
|
void toolReset();
|
||||||
void toolRecalc();
|
void toolRecalc();
|
||||||
void toolRender(int flags);
|
void toolRender(int flags);
|
||||||
|
void toolRenderOverlay(class GLFont* font, double* proj, double* model, int* view);
|
||||||
|
|
||||||
void drawAgent(const float* pos, float r, float h, float c, const float* col);
|
void drawAgent(const float* pos, float r, float h, float c, const float* col);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BuilderStatMesh();
|
BuilderStatMesh();
|
||||||
virtual ~BuilderStatMesh();
|
virtual ~BuilderStatMesh();
|
||||||
|
@ -52,6 +52,7 @@ public:
|
|||||||
virtual void handleDebugMode();
|
virtual void handleDebugMode();
|
||||||
|
|
||||||
virtual void handleRender();
|
virtual void handleRender();
|
||||||
|
virtual void handleRenderOverlay(class GLFont* font, double* proj, double* model, int* view);
|
||||||
virtual void handleMeshChanged(const float* verts, int nverts,
|
virtual void handleMeshChanged(const float* verts, int nverts,
|
||||||
const int* tris, const float* trinorms, int ntris,
|
const int* tris, const float* trinorms, int ntris,
|
||||||
const float* bmin, const float* bmax);
|
const float* bmin, const float* bmax);
|
||||||
|
@ -73,6 +73,7 @@ public:
|
|||||||
virtual void handleDebugMode();
|
virtual void handleDebugMode();
|
||||||
|
|
||||||
virtual void handleRender();
|
virtual void handleRender();
|
||||||
|
virtual void handleRenderOverlay(class GLFont* font, double* proj, double* model, int* view);
|
||||||
virtual void handleMeshChanged(const float* verts, int nverts,
|
virtual void handleMeshChanged(const float* verts, int nverts,
|
||||||
const int* tris, const float* trinorms, int ntris,
|
const int* tris, const float* trinorms, int ntris,
|
||||||
const float* bmin, const float* bmax);
|
const float* bmin, const float* bmax);
|
||||||
|
@ -44,6 +44,10 @@ void Builder::handleRender()
|
|||||||
rcDebugDrawBoxWire(m_bmin[0],m_bmin[1],m_bmin[2], m_bmax[0],m_bmax[1],m_bmax[2], col);
|
rcDebugDrawBoxWire(m_bmin[0],m_bmin[1],m_bmin[2], m_bmax[0],m_bmax[1],m_bmax[2], col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Builder::handleRenderOverlay(class GLFont* font, double* proj, double* model, int* view)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void Builder::handleMeshChanged(const float* verts, int nverts,
|
void Builder::handleMeshChanged(const float* verts, int nverts,
|
||||||
const int* tris, const float* trinorms, int ntris,
|
const int* tris, const float* trinorms, int ntris,
|
||||||
const float* bmin, const float* bmax)
|
const float* bmin, const float* bmax)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
#include "SDL_Opengl.h"
|
#include "SDL_Opengl.h"
|
||||||
|
#include "glfont.h"
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "Builder.h"
|
#include "Builder.h"
|
||||||
#include "BuilderStatMesh.h"
|
#include "BuilderStatMesh.h"
|
||||||
@ -263,6 +264,25 @@ void BuilderStatMesh::toolRender(int flags)
|
|||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BuilderStatMesh::toolRenderOverlay(class GLFont* font, double* proj, double* model, int* view)
|
||||||
|
{
|
||||||
|
GLdouble x, y, z;
|
||||||
|
|
||||||
|
// Draw start and end point labels
|
||||||
|
if (m_sposSet && gluProject((GLdouble)m_spos[0], (GLdouble)m_spos[1], (GLdouble)m_spos[2],
|
||||||
|
model, proj, view, &x, &y, &z))
|
||||||
|
{
|
||||||
|
const float len = font->getTextLength("Start");
|
||||||
|
font->drawText((float)x - len/2, (float)y-font->getLineHeight(), "Start", GLFont::RGBA(0,0,0,220));
|
||||||
|
}
|
||||||
|
if (m_eposSet && gluProject((GLdouble)m_epos[0], (GLdouble)m_epos[1], (GLdouble)m_epos[2],
|
||||||
|
model, proj, view, &x, &y, &z))
|
||||||
|
{
|
||||||
|
const float len = font->getTextLength("End");
|
||||||
|
font->drawText((float)x-len/2, (float)y-font->getLineHeight(), "End", GLFont::RGBA(0,0,0,220));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BuilderStatMesh::drawAgent(const float* pos, float r, float h, float c, const float* col)
|
void BuilderStatMesh::drawAgent(const float* pos, float r, float h, float c, const float* col)
|
||||||
{
|
{
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
#include "SDL_Opengl.h"
|
#include "SDL_Opengl.h"
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
|
#include "glfont.h"
|
||||||
#include "Builder.h"
|
#include "Builder.h"
|
||||||
#include "BuilderStatMeshSimple.h"
|
#include "BuilderStatMeshSimple.h"
|
||||||
#include "Recast.h"
|
#include "Recast.h"
|
||||||
@ -240,6 +241,11 @@ void BuilderStatMeshSimple::handleRender()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BuilderStatMeshSimple::handleRenderOverlay(class GLFont* font, double* proj, double* model, int* view)
|
||||||
|
{
|
||||||
|
toolRenderOverlay(font, proj, model, view);
|
||||||
|
}
|
||||||
|
|
||||||
void BuilderStatMeshSimple::handleMeshChanged(const float* verts, int nverts,
|
void BuilderStatMeshSimple::handleMeshChanged(const float* verts, int nverts,
|
||||||
const int* tris, const float* trinorms, int ntris,
|
const int* tris, const float* trinorms, int ntris,
|
||||||
const float* bmin, const float* bmax)
|
const float* bmin, const float* bmax)
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
#include "SDL_Opengl.h"
|
#include "SDL_Opengl.h"
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
|
#include "glfont.h"
|
||||||
#include "Builder.h"
|
#include "Builder.h"
|
||||||
#include "BuilderStatMeshTiling.h"
|
#include "BuilderStatMeshTiling.h"
|
||||||
#include "Recast.h"
|
#include "Recast.h"
|
||||||
@ -351,6 +352,11 @@ void BuilderStatMeshTiling::handleRender()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BuilderStatMeshTiling::handleRenderOverlay(class GLFont* font, double* proj, double* model, int* view)
|
||||||
|
{
|
||||||
|
toolRenderOverlay(font, proj, model, view);
|
||||||
|
}
|
||||||
|
|
||||||
void BuilderStatMeshTiling::handleMeshChanged(const float* verts, int nverts,
|
void BuilderStatMeshTiling::handleMeshChanged(const float* verts, int nverts,
|
||||||
const int* tris, const float* trinorms, int ntris,
|
const int* tris, const float* trinorms, int ntris,
|
||||||
const float* bmin, const float* bmax)
|
const float* bmin, const float* bmax)
|
||||||
|
@ -437,6 +437,12 @@ int main(int argc, char *argv[])
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
|
if (builder)
|
||||||
|
{
|
||||||
|
builder->handleRenderOverlay(&g_font, (double*)proj, (double*)model, (int*)view);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
|
||||||
imguiBeginFrame(mx,my,mbut);
|
imguiBeginFrame(mx,my,mbut);
|
||||||
|
|
||||||
mouseOverMenu = false;
|
mouseOverMenu = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user