Added overlay rendering support for builders + return of start/end labels.

This commit is contained in:
Mikko Mononen 2009-07-01 07:22:18 +00:00
parent 22865e60af
commit b0cc29570e
12 changed files with 120 additions and 5552 deletions

File diff suppressed because it is too large Load Diff

View File

@ -310,8 +310,6 @@
<key>Dock</key>
<array>
<dict>
<key>BecomeActive</key>
<true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXProjectModuleGUID</key>
@ -329,7 +327,7 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>6B25B6260FFA63C8004F1BC4</string>
<string>6B25B62F0FFAAAF4004F1BC4</string>
<key>history</key>
<array>
<string>6BB87E0B0F9DE8A300E33F12</string>
@ -513,6 +511,8 @@
<string>PBXCVSModule</string>
</dict>
<dict>
<key>BecomeActive</key>
<true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXProjectModuleGUID</key>

View File

@ -36,6 +36,7 @@ public:
virtual void setToolEndPos(const float* p);
virtual void handleRender();
virtual void handleRenderOverlay(class GLFont* font, double* proj, double* model, int* view);
virtual void handleMeshChanged(const float* verts, int nverts,
const int* tris, const float* trinorms, int ntris,
const float* bmin, const float* bmax);

View File

@ -51,9 +51,11 @@ protected:
void toolReset();
void toolRecalc();
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);
public:
BuilderStatMesh();
virtual ~BuilderStatMesh();

View File

@ -52,6 +52,7 @@ public:
virtual void handleDebugMode();
virtual void handleRender();
virtual void handleRenderOverlay(class GLFont* font, double* proj, double* model, int* view);
virtual void handleMeshChanged(const float* verts, int nverts,
const int* tris, const float* trinorms, int ntris,
const float* bmin, const float* bmax);

View File

@ -73,6 +73,7 @@ public:
virtual void handleDebugMode();
virtual void handleRender();
virtual void handleRenderOverlay(class GLFont* font, double* proj, double* model, int* view);
virtual void handleMeshChanged(const float* verts, int nverts,
const int* tris, const float* trinorms, int ntris,
const float* bmin, const float* bmax);

View File

@ -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);
}
void Builder::handleRenderOverlay(class GLFont* font, double* proj, double* model, int* view)
{
}
void Builder::handleMeshChanged(const float* verts, int nverts,
const int* tris, const float* trinorms, int ntris,
const float* bmin, const float* bmax)

View File

@ -4,6 +4,7 @@
#include <string.h>
#include "SDL.h"
#include "SDL_Opengl.h"
#include "glfont.h"
#include "imgui.h"
#include "Builder.h"
#include "BuilderStatMesh.h"
@ -263,6 +264,25 @@ void BuilderStatMesh::toolRender(int flags)
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)
{
glDepthMask(GL_FALSE);

View File

@ -5,6 +5,7 @@
#include "SDL.h"
#include "SDL_Opengl.h"
#include "imgui.h"
#include "glfont.h"
#include "Builder.h"
#include "BuilderStatMeshSimple.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,
const int* tris, const float* trinorms, int ntris,
const float* bmin, const float* bmax)

View File

@ -5,6 +5,7 @@
#include "SDL.h"
#include "SDL_Opengl.h"
#include "imgui.h"
#include "glfont.h"
#include "Builder.h"
#include "BuilderStatMeshTiling.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,
const int* tris, const float* trinorms, int ntris,
const float* bmin, const float* bmax)

View File

@ -437,6 +437,12 @@ int main(int argc, char *argv[])
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
if (builder)
{
builder->handleRenderOverlay(&g_font, (double*)proj, (double*)model, (int*)view);
glDisable(GL_TEXTURE_2D);
}
imguiBeginFrame(mx,my,mbut);
mouseOverMenu = false;