Paris demo build (does not compile from SVN).

Removed portal test from demo.cpp
Added new debug draw mode (regions connections).
Tweaked several debug draw modes to be more illustrative.
Added checks in the Detour code to allow to call the API even if the initialization failed.
This commit is contained in:
Mikko Mononen 2009-06-04 13:03:48 +00:00
parent ab372964ad
commit b1114cb5cd
8 changed files with 1866 additions and 313 deletions

View File

@ -572,19 +572,16 @@ dtStatNavMesh::~dtStatNavMesh()
bool dtStatNavMesh::init(unsigned char* data, int dataSize, bool ownsData)
{
m_header = (dtStatNavMeshHeader*)data;
if (m_header->magic != DT_NAVMESH_MAGIC)
{
dtStatNavMeshHeader* header = (dtStatNavMeshHeader*)data;
if (header->magic != DT_NAVMESH_MAGIC)
return false;
}
if (m_header->version != DT_NAVMESH_VERSION)
{
if (header->version != DT_NAVMESH_VERSION)
return false;
}
const int headerSize = sizeof(dtStatNavMeshHeader);
const int vertsSize = sizeof(float)*3*m_header->nverts;
const int polysSize = sizeof(dtPoly)*m_header->npolys;
const int vertsSize = sizeof(float)*3*header->nverts;
const int polysSize = sizeof(dtPoly)*header->npolys;
m_verts = (float*)(data + headerSize);
m_polys = (dtPoly*)(data + headerSize + vertsSize);
@ -604,6 +601,8 @@ bool dtStatNavMesh::init(unsigned char* data, int dataSize, bool ownsData)
m_dataSize = dataSize;
}
m_header = header;
return true;
}
@ -629,6 +628,8 @@ const dtPoly* dtStatNavMesh::getPolyByRef(dtPolyRef ref) const
int dtStatNavMesh::findPath(dtPolyRef startRef, dtPolyRef endRef,
dtPolyRef* path, const int maxPathSize)
{
if (!m_header) return 0;
if (!startRef || !endRef)
return 0;
@ -769,6 +770,8 @@ int dtStatNavMesh::findStraightPath(const float* startPos, const float* endPos,
const dtPolyRef* path, const int pathSize,
float* straightPath, const int maxStraightPathSize)
{
if (!m_header) return 0;
if (!maxStraightPathSize)
return 0;
@ -910,9 +913,9 @@ int dtStatNavMesh::findStraightPath(const float* startPos, const float* endPos,
int dtStatNavMesh::getPolyVerts(dtPolyRef ref, float* verts)
{
if (!m_header) return 0;
const dtPoly* poly = getPolyByRef(ref);
if (!poly)
return 0;
if (!poly) return 0;
float* v = verts;
for (int i = 0; i < (int)poly->nv; ++i)
{
@ -927,10 +930,10 @@ int dtStatNavMesh::getPolyVerts(dtPolyRef ref, float* verts)
bool dtStatNavMesh::raycast(dtPolyRef centerRef, const float* startPos, const float* endPos,
float& t, dtPolyRef& endRef)
{
endRef = centerRef;
if (!m_header) return 0;
if (!centerRef) return 0;
if (!centerRef)
return 0;
endRef = centerRef;
dtPolyRef prevRef = centerRef;
dtPolyRef curRef = centerRef;
@ -982,8 +985,8 @@ bool dtStatNavMesh::raycast(dtPolyRef centerRef, const float* startPos, const fl
float dtStatNavMesh::findDistanceToWall(dtPolyRef centerRef, const float* centerPos, float maxRadius,
float* hitPos, float* hitNormal)
{
if (!centerRef)
return 0;
if (!m_header) return 0;
if (!centerRef) return 0;
m_nodePool->clear();
m_openList->clear();
@ -1097,8 +1100,8 @@ int dtStatNavMesh::findPolysAround(dtPolyRef centerRef, const float* centerPos,
unsigned short* resultCost, unsigned short* resultDepth,
const int maxResult)
{
if (!centerRef)
return 0;
if (!m_header) return 0;
if (!centerRef) return 0;
m_nodePool->clear();
m_openList->clear();
@ -1202,6 +1205,8 @@ int dtStatNavMesh::findPolysAround(dtPolyRef centerRef, const float* centerPos,
int dtStatNavMesh::queryPolygons(const float* center, const float* extents,
unsigned short* ids, const int maxIds)
{
if (!m_header) return 0;
const dtBVNode* node = &m_bvtree[0];
const dtBVNode* end = &m_bvtree[m_header->nnodes];
@ -1253,6 +1258,8 @@ int dtStatNavMesh::queryPolygons(const float* center, const float* extents,
dtPolyRef dtStatNavMesh::findNearestPoly(const float* center, const float* extents)
{
if (!m_header) return 0;
// Get nearby polygons from proximity grid.
unsigned short polys[128];
int npolys = queryPolygons(center, extents, polys, 128);

View File

@ -40,13 +40,14 @@ void rcDebugDrawHeightfieldSolid(const struct rcHeightfield& hf,
void rcDebugDrawHeightfieldWalkable(const struct rcHeightfield& hf,
const float* orig, float cs, float ch);
void rcDebugDrawMesh(const class rcMeshLoaderObj& mesh, const unsigned char* flags);
void rcDebugDrawMeshSlope(const class rcMeshLoaderObj& mesh, const float walkableSlopeAngle);
void rcDebugDrawMesh(const class rcMeshLoaderObj& mesh, const unsigned char* flags, const float miny, const float maxy);
void rcDebugDrawMeshSlope(const class rcMeshLoaderObj& mesh, const float walkableSlopeAngle, const float miny, const float maxy);
void rcDebugDrawCompactHeightfieldSolid(const struct rcCompactHeightfield& chf);
void rcDebugDrawCompactHeightfieldRegions(const struct rcCompactHeightfield& chf);
void rcDebugDrawCompactHeightfieldDistance(const struct rcCompactHeightfield& chf);
void rcDebugDrawRegionConnections(const struct rcContourSet& cset, const float* orig, float cs, float ch, const float alpha = 1.0f);
void rcDebugDrawRawContours(const struct rcContourSet& cset, const float* orig, float cs, float ch, const float alpha = 1.0f);
void rcDebugDrawContours(const struct rcContourSet& cset, const float* orig, float cs, float ch);
void rcDebugDrawPolyMesh(const struct rcPolyMesh& mesh);

View File

@ -719,32 +719,6 @@ static bool insertPoint(rcContour* c, int idx, const int* v)
return true;
}
static void calcBox(const int* v0, const int* v1, int* bounds)
{
bounds[0] = rcMin(v0[0], v1[0]);
bounds[1] = rcMin(v0[1], v1[1]);
bounds[2] = rcMin(v0[2], v1[2]);
bounds[3] = rcMax(v0[0], v1[0]);
bounds[4] = rcMax(v0[1], v1[1]);
bounds[5] = rcMax(v0[2], v1[2]);
}
/*inline bool checkOverlapBoxY(const int* a, const int* b)
{
bool overlap = true;
overlap = (a[0] >= b[3+0] || a[3+0] <= b[0]) ? false : overlap;
overlap = (a[1] >= b[3+1] || a[3+1] <= b[1]) ? false : overlap;
overlap = (a[2] >= b[3+2] || a[3+2] <= b[2]) ? false : overlap;
return overlap;
}*/
inline bool checkOverlapBoxY(const int* a, const int* b)
{
bool overlap = true;
overlap = (a[1] > b[3+1] || a[3+1] < b[1]) ? false : overlap;
return overlap;
}
static bool conformVertex(rcContourSet* cset, const int* v,
const int pminy, const int pmaxy,
const int nminy, const int nmaxy,
@ -800,8 +774,6 @@ bool rcFixupAdjacentContours(rcContourSet* cseta, rcContourSet* csetb,
rcTimeVal startTime = rcGetPerformanceTimer();
// int nbox[6], pbox[6];
for (int i = 0; i < cseta->nconts; ++i)
{
const rcContour& c = cseta->conts[i];

View File

@ -24,16 +24,20 @@
#include "MeshLoaderObj.h"
#include "Recast.h"
void rcDebugDrawMesh(const rcMeshLoaderObj& mesh, const unsigned char* flags)
void rcDebugDrawMesh(const rcMeshLoaderObj& mesh, const unsigned char* flags, const float miny, const float maxy)
{
int nt = mesh.getTriCount();
const float* verts = mesh.getVerts();
const float* normals = mesh.getNormals();
const int* tris = mesh.getTris();
const float s = 0.5f / (maxy - miny);
glBegin(GL_TRIANGLES);
for (int i = 0; i < nt*3; i += 3)
{
float a = (2+normals[i+0]+normals[i+1])/4;
a *= 0.5f + (verts[tris[i]*3+1]-miny)*s;
if (flags && !flags[i/3])
glColor3f(a,a*0.3f,a*0.1f);
else
@ -45,7 +49,7 @@ void rcDebugDrawMesh(const rcMeshLoaderObj& mesh, const unsigned char* flags)
glEnd();
}
void rcDebugDrawMeshSlope(const rcMeshLoaderObj& mesh, const float walkableSlopeAngle)
void rcDebugDrawMeshSlope(const rcMeshLoaderObj& mesh, const float walkableSlopeAngle, const float miny, const float maxy)
{
const float walkableThr = cosf(walkableSlopeAngle/180.0f*(float)M_PI);
@ -54,11 +58,14 @@ void rcDebugDrawMeshSlope(const rcMeshLoaderObj& mesh, const float walkableSlope
const float* normals = mesh.getNormals();
const int* tris = mesh.getTris();
const float s = 0.5f / (maxy - miny);
glBegin(GL_TRIANGLES);
for (int i = 0; i < nt*3; i += 3)
{
const float* norm = &normals[i];
float a = (2+norm[0]+norm[1])/4;
a *= 0.5f+(verts[tris[i]*3+1]-miny)*s;
if (norm[1] > walkableThr)
glColor3f(a,a,a);
else
@ -148,6 +155,41 @@ void drawBox(float minx, float miny, float minz, float maxx, float maxy, float m
}
}
void drawBox2(float minx, float miny, float minz, float maxx, float maxy, float maxz)
{
float verts[8*3] =
{
minx, miny, minz,
maxx, miny, minz,
maxx, miny, maxz,
minx, miny, maxz,
minx, maxy, minz,
maxx, maxy, minz,
maxx, maxy, maxz,
minx, maxy, maxz,
};
static const unsigned char inds[5*4] =
{
7, 6, 5, 4,
// 0, 1, 2, 3,
1, 5, 6, 2,
3, 7, 4, 0,
2, 6, 7, 3,
0, 4, 5, 1,
};
const unsigned char* in = inds;
for (int i = 0; i < 5; ++i)
{
glVertex3fv(&verts[*in*3]); in++;
glVertex3fv(&verts[*in*3]); in++;
glVertex3fv(&verts[*in*3]); in++;
glVertex3fv(&verts[*in*3]); in++;
}
}
void rcDebugDrawCylinderWire(float minx, float miny, float minz, float maxx, float maxy, float maxz, const float* col)
{
static const int NUM_SEG = 16;
@ -273,10 +315,11 @@ void rcDebugDrawCompactHeightfieldSolid(const rcCompactHeightfield& chf)
{
const rcCompactSpan& s = chf.spans[i];
const float fy = chf.bmin[1] + (s.y+1)*ch;
glVertex3f(fx, fy, fz);
drawBox2(fx, fy-ch*2, fz, fx+cs, fy, fz+cs);
/* glVertex3f(fx, fy, fz);
glVertex3f(fx, fy, fz+cs);
glVertex3f(fx+cs, fy, fz+cs);
glVertex3f(fx+cs, fy, fz);
glVertex3f(fx+cs, fy, fz);*/
}
}
}
@ -308,12 +351,16 @@ void rcDebugDrawCompactHeightfieldRegions(const rcCompactHeightfield& chf)
glColor4fv(col);
}
else
glColor4ub(0,0,0,128);
{
// glColor4ub(0,0,0,128);
glColor3ub(128,128,128);
}
const float fy = chf.bmin[1] + (s.y+1)*ch;
glVertex3f(fx, fy, fz);
drawBox2(fx, fy-ch*2, fz, fx+cs, fy, fz+cs);
/* glVertex3f(fx, fy, fz);
glVertex3f(fx, fy, fz+cs);
glVertex3f(fx+cs, fy, fz+cs);
glVertex3f(fx+cs, fy, fz);
glVertex3f(fx+cs, fy, fz);*/
}
}
}
@ -345,16 +392,123 @@ void rcDebugDrawCompactHeightfieldDistance(const rcCompactHeightfield& chf)
const float fy = chf.bmin[1] + (s.y+1)*ch;
float cd = (float)s.dist * dscale;
glColor3f(cd, cd, cd);
glVertex3f(fx, fy, fz);
drawBox2(fx, fy-ch*2, fz, fx+cs, fy, fz+cs);
/* glVertex3f(fx, fy, fz);
glVertex3f(fx, fy, fz+cs);
glVertex3f(fx+cs, fy, fz+cs);
glVertex3f(fx+cs, fy, fz);
glVertex3f(fx+cs, fy, fz);*/
}
}
}
glEnd();
}
static void getContourCenter(const rcContour* cont, const float* orig, float cs, float ch, float* center)
{
center[0] = 0;
center[1] = 0;
center[2] = 0;
if (!cont->nverts)
return;
for (int i = 0; i < cont->nverts; ++i)
{
const int* v = &cont->verts[i*4];
center[0] += (float)v[0];
center[1] += (float)v[1];
center[2] += (float)v[2];
}
const float s = 1.0f / cont->nverts;
center[0] *= s * cs;
center[1] *= s * ch;
center[2] *= s * cs;
center[0] += orig[0];
center[1] += orig[1] + 4*ch;
center[2] += orig[2];
}
static const rcContour* findContourFromSet(const rcContourSet& cset, unsigned short reg)
{
for (int i = 0; i < cset.nconts; ++i)
{
if (cset.conts[i].reg == reg)
return &cset.conts[i];
}
return 0;
}
static void drawArc(const float* p0, const float* p1)
{
static const int NPTS = 8;
float pts[NPTS*3];
float dir[3];
vsub(dir, p1, p0);
const float len = sqrtf(vdistSqr(p0, p1));
for (int i = 0; i < NPTS; ++i)
{
float u = (float)i / (float)(NPTS-1);
float* p = &pts[i*3];
p[0] = p0[0] + dir[0] * u;
p[1] = p0[1] + dir[1] * u + (len/4) * (1-rcSqr(u*2-1));
p[2] = p0[2] + dir[2] * u;
}
for (int i = 0; i < NPTS-1; ++i)
{
glVertex3fv(&pts[i*3]);
glVertex3fv(&pts[(i+1)*3]);
}
}
void rcDebugDrawRegionConnections(const rcContourSet& cset, const float* orig, float cs, float ch, const float alpha)
{
// Draw centers
float pos[3], pos2[3];
glColor4ub(0,0,0,196);
glLineWidth(2.0f);
glBegin(GL_LINES);
for (int i = 0; i < cset.nconts; ++i)
{
const rcContour* cont = &cset.conts[i];
getContourCenter(cont, orig, cs, ch, pos);
for (int j = 0; j < cont->nverts; ++j)
{
const int* v = &cont->verts[j*4];
if (v[3] == 0 || (unsigned short)v[3] < cont->reg) continue;
const rcContour* cont2 = findContourFromSet(cset, (unsigned short)v[3]);
if (cont2)
{
getContourCenter(cont2, orig, cs, ch, pos2);
drawArc(pos, pos2);
// glVertex3fv(pos);
// glVertex3fv(pos2);
}
}
}
glEnd();
float col[4] = { 1,1,1,alpha };
glPointSize(7.0f);
glBegin(GL_POINTS);
for (int i = 0; i < cset.nconts; ++i)
{
const rcContour* cont = &cset.conts[i];
intToCol(cont->reg, col);
col[0] *= 0.5f;
col[1] *= 0.5f;
col[2] *= 0.5f;
glColor4fv(col);
getContourCenter(cont, orig, cs, ch, pos);
glVertex3fv(pos);
}
glEnd();
glLineWidth(1.0f);
glPointSize(1.0f);
}
void rcDebugDrawRawContours(const rcContourSet& cset, const float* orig, float cs, float ch, const float alpha)
{
float col[4] = { 1,1,1,alpha };

File diff suppressed because it is too large Load Diff

View File

@ -278,13 +278,13 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
<integer>31</integer>
<integer>34</integer>
<integer>1</integer>
<integer>0</integer>
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
<string>{{0, 0}, {228, 660}}</string>
<string>{{0, 24}, {228, 660}}</string>
</dict>
<key>PBXTopSmartGroupGIDs</key>
<array/>
@ -331,7 +331,7 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>6B09CE770FD5BEC6005637D5</string>
<string>6B8FD1DD0FD7F69A0059D643</string>
<key>history</key>
<array>
<string>6B8633370F7813A600E2684A</string>
@ -340,29 +340,32 @@
<string>6B7707EF0FBD90F100D21BAE</string>
<string>6B7707F00FBD90F100D21BAE</string>
<string>6B7708F20FBDA96300D21BAE</string>
<string>6BB787680FC03EAD003C24DB</string>
<string>6BB7876A0FC03EAD003C24DB</string>
<string>6BB7876B0FC03EAD003C24DB</string>
<string>6BB7876D0FC03EAD003C24DB</string>
<string>6BB787710FC03EAD003C24DB</string>
<string>6BB7881E0FC0593E003C24DB</string>
<string>6BB7881F0FC0593E003C24DB</string>
<string>6BB788220FC0593E003C24DB</string>
<string>6BB788230FC0593E003C24DB</string>
<string>6B8171D70FC327630022159F</string>
<string>6B8AD2EA0FCDE25800016452</string>
<string>6BB85D1A0FCEA5BD00758966</string>
<string>6BB85D2F0FCEA8BE00758966</string>
<string>6BB85D3A0FCEAA6300758966</string>
<string>6B09CDFF0FD5563E005637D5</string>
<string>6B09CE5A0FD5BDE6005637D5</string>
<string>6B09CE5B0FD5BDE6005637D5</string>
<string>6B09CE5C0FD5BDE6005637D5</string>
<string>6B09CE5D0FD5BDE6005637D5</string>
<string>6B09CE5E0FD5BDE6005637D5</string>
<string>6B09CE5F0FD5BDE6005637D5</string>
<string>6B09CE730FD5BEC3005637D5</string>
<string>6B09CE740FD5BEC3005637D5</string>
<string>6B164B210FD678A500D2F919</string>
<string>6B164B240FD678A500D2F919</string>
<string>6B164B250FD678A500D2F919</string>
<string>6B164B260FD678A500D2F919</string>
<string>6B8FD18D0FD7C4D10059D643</string>
<string>6B8FD19B0FD7ED310059D643</string>
<string>6B8FD19C0FD7ED310059D643</string>
<string>6B8FD19D0FD7ED310059D643</string>
<string>6B8FD19E0FD7ED310059D643</string>
<string>6B8FD1CF0FD7F56C0059D643</string>
<string>6B8FD1DA0FD7F69A0059D643</string>
<string>6B8FD1DB0FD7F69A0059D643</string>
</array>
<key>prevStack</key>
<array>
@ -371,11 +374,8 @@
<string>6B1E02750F924A8500CC0038</string>
<string>6B1E028F0F924D5A00CC0038</string>
<string>6B1E029B0F924D8B00CC0038</string>
<string>6B1E02AE0F92530C00CC0038</string>
<string>6B1E02BB0F92547D00CC0038</string>
<string>6B1E02FC0F92563500CC0038</string>
<string>6B1E032E0F925D9100CC0038</string>
<string>6B8DB2D70F93A7A5007FA9E1</string>
<string>6B8DB38F0F9798DE007FA9E1</string>
<string>6B8DB3900F9798DE007FA9E1</string>
<string>6BB87E0E0F9DE8A300E33F12</string>
@ -385,45 +385,34 @@
<string>6B7707F70FBD90F100D21BAE</string>
<string>6B7707F90FBD90F100D21BAE</string>
<string>6B7708F70FBDA96300D21BAE</string>
<string>6BB787BD0FC03EAD003C24DB</string>
<string>6BB787C30FC03EAD003C24DB</string>
<string>6BB787D40FC03EAD003C24DB</string>
<string>6BB788290FC0593E003C24DB</string>
<string>6BB7882A0FC0593E003C24DB</string>
<string>6BB7882B0FC0593E003C24DB</string>
<string>6BB85D3E0FCEAA6300758966</string>
<string>6B09CE050FD5563E005637D5</string>
<string>6B09CE060FD5563E005637D5</string>
<string>6B09CE070FD5563E005637D5</string>
<string>6B09CE080FD5563E005637D5</string>
<string>6B09CE090FD5563E005637D5</string>
<string>6B09CE0A0FD5563E005637D5</string>
<string>6B09CE0B0FD5563E005637D5</string>
<string>6B09CE0C0FD5563E005637D5</string>
<string>6B09CE0D0FD5563E005637D5</string>
<string>6B09CE100FD5563E005637D5</string>
<string>6B09CE130FD5563E005637D5</string>
<string>6B09CE1E0FD55805005637D5</string>
<string>6B09CE2D0FD55B4D005637D5</string>
<string>6B09CE360FD55B99005637D5</string>
<string>6B09CE470FD55FA2005637D5</string>
<string>6B09CE480FD55FA2005637D5</string>
<string>6B09CE490FD55FA2005637D5</string>
<string>6B09CE4A0FD55FA2005637D5</string>
<string>6B09CE620FD5BDE6005637D5</string>
<string>6B09CE630FD5BDE6005637D5</string>
<string>6B09CE640FD5BDE6005637D5</string>
<string>6B09CE650FD5BDE6005637D5</string>
<string>6B09CE660FD5BDE6005637D5</string>
<string>6B09CE670FD5BDE6005637D5</string>
<string>6B09CE680FD5BDE6005637D5</string>
<string>6B09CE690FD5BDE6005637D5</string>
<string>6B09CE6A0FD5BDE6005637D5</string>
<string>6B09CE6B0FD5BDE6005637D5</string>
<string>6B09CE6C0FD5BDE6005637D5</string>
<string>6B09CE6D0FD5BDE6005637D5</string>
<string>6B09CE6E0FD5BDE6005637D5</string>
<string>6B09CE750FD5BEC3005637D5</string>
<string>6B164B320FD678A500D2F919</string>
<string>6B164B330FD678A500D2F919</string>
<string>6B164B3C0FD678A500D2F919</string>
<string>6BC620900FD7C2380022CACF</string>
<string>6BC620920FD7C2380022CACF</string>
<string>6B8FD1830FD7C3F10059D643</string>
<string>6B8FD1900FD7C4D10059D643</string>
<string>6B8FD1A00FD7ED310059D643</string>
<string>6B8FD1A10FD7ED310059D643</string>
<string>6B8FD1A20FD7ED310059D643</string>
<string>6B8FD1A30FD7ED310059D643</string>
<string>6B8FD1A40FD7ED310059D643</string>
<string>6B8FD1A50FD7ED310059D643</string>
<string>6B8FD1A60FD7ED310059D643</string>
<string>6B8FD1B40FD7EFAB0059D643</string>
<string>6B8FD1BA0FD7F05F0059D643</string>
<string>6B8FD1C10FD7F15D0059D643</string>
<string>6B8FD1D10FD7F56C0059D643</string>
<string>6B8FD1D20FD7F56C0059D643</string>
<string>6B8FD1DC0FD7F69A0059D643</string>
</array>
</dict>
<key>SplitCount</key>
@ -463,6 +452,8 @@
<dict>
<key>Frame</key>
<string>{{10, 27}, {1030, 61}}</string>
<key>RubberWindowFrame</key>
<string>0 59 1280 719 0 0 1280 778 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@ -517,8 +508,6 @@
<dict>
<key>Frame</key>
<string>{{10, 27}, {1030, 61}}</string>
<key>RubberWindowFrame</key>
<string>0 59 1280 719 0 0 1280 778 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@ -546,11 +535,11 @@
</array>
<key>TableOfContents</key>
<array>
<string>6B09CDD80FD52128005637D5</string>
<string>6B8FD17C0FD7C3230059D643</string>
<string>1CA23ED40692098700951B8B</string>
<string>6B09CDD90FD52128005637D5</string>
<string>6B8FD17D0FD7C3230059D643</string>
<string>6B8632A30F78115100E2684A</string>
<string>6B09CDDA0FD52128005637D5</string>
<string>6B8FD17E0FD7C3230059D643</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@ -697,14 +686,14 @@
</array>
<key>TableOfContents</key>
<array>
<string>6B09CDDB0FD52128005637D5</string>
<string>6B8FD1850FD7C3F10059D643</string>
<string>1CCC7628064C1048000F2A68</string>
<string>1CCC7629064C1048000F2A68</string>
<string>6B09CDDC0FD52128005637D5</string>
<string>6B09CDDD0FD52128005637D5</string>
<string>6B09CDDE0FD52128005637D5</string>
<string>6B09CDDF0FD52128005637D5</string>
<string>6B09CDE00FD52128005637D5</string>
<string>6B8FD1860FD7C3F10059D643</string>
<string>6B8FD1870FD7C3F10059D643</string>
<string>6B8FD1880FD7C3F10059D643</string>
<string>6B8FD1890FD7C3F10059D643</string>
<string>6B8FD18A0FD7C3F10059D643</string>
</array>
<key>ToolbarConfiguration</key>
<string>xcode.toolbar.config.debugV3</string>
@ -734,8 +723,6 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
<string>6B09CE700FD5BDE6005637D5</string>
<string>6B09CE710FD5BDE6005637D5</string>
<string>/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/Recast.xcodeproj</string>
</array>
<key>WindowString</key>

View File

@ -22,6 +22,8 @@
6B137C910F7FCC1100459200 /* RecastRasterization.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C880F7FCC1100459200 /* RecastRasterization.cpp */; };
6B137C920F7FCC1100459200 /* RecastRegion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C890F7FCC1100459200 /* RecastRegion.cpp */; };
6B137C930F7FCC1100459200 /* RecastTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C8A0F7FCC1100459200 /* RecastTimer.cpp */; };
6B164AFE0FD6687600D2F919 /* glimage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B164AFD0FD6687600D2F919 /* glimage.cpp */; };
6B164B010FD668B700D2F919 /* stb_image.c in Sources */ = {isa = PBXBuildFile; fileRef = 6B164B000FD668B700D2F919 /* stb_image.c */; };
6B8632DA0F78122C00E2684A /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B8632D90F78122C00E2684A /* SDL.framework */; };
6B8632DC0F78123E00E2684A /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B8632DB0F78123E00E2684A /* OpenGL.framework */; };
6BB788170FC0472B003C24DB /* ChunkyTriMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BB788160FC0472B003C24DB /* ChunkyTriMesh.cpp */; };
@ -62,6 +64,9 @@
6B137C880F7FCC1100459200 /* RecastRasterization.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastRasterization.cpp; path = ../../../Recast/Source/RecastRasterization.cpp; sourceTree = SOURCE_ROOT; };
6B137C890F7FCC1100459200 /* RecastRegion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastRegion.cpp; path = ../../../Recast/Source/RecastRegion.cpp; sourceTree = SOURCE_ROOT; };
6B137C8A0F7FCC1100459200 /* RecastTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastTimer.cpp; path = ../../../Recast/Source/RecastTimer.cpp; sourceTree = SOURCE_ROOT; };
6B164AFD0FD6687600D2F919 /* glimage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = glimage.cpp; path = ../../Source/glimage.cpp; sourceTree = SOURCE_ROOT; };
6B164AFF0FD6688000D2F919 /* glimage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glimage.h; path = ../../Include/glimage.h; sourceTree = SOURCE_ROOT; };
6B164B000FD668B700D2F919 /* stb_image.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stb_image.c; path = ../../Source/stb_image.c; sourceTree = SOURCE_ROOT; };
6B8632D90F78122C00E2684A /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = Library/Frameworks/SDL.framework; sourceTree = SDKROOT; };
6B8632DB0F78123E00E2684A /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
6BB788160FC0472B003C24DB /* ChunkyTriMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChunkyTriMesh.cpp; path = ../../Source/ChunkyTriMesh.cpp; sourceTree = SOURCE_ROOT; };
@ -93,6 +98,9 @@
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
6B164B000FD668B700D2F919 /* stb_image.c */,
6B164AFF0FD6688000D2F919 /* glimage.h */,
6B164AFD0FD6687600D2F919 /* glimage.cpp */,
6BDD9E030F91110C00904EEF /* Detour */,
6B137C7D0F7FCBE800459200 /* Recast */,
6B137C790F7FCBE400459200 /* glfont.h */,
@ -283,6 +291,8 @@
6BDD9E0B0F91113800904EEF /* DetourStatNavMesh.cpp in Sources */,
6BDD9E0C0F91113800904EEF /* DetourStatNavMeshBuilder.cpp in Sources */,
6BB788170FC0472B003C24DB /* ChunkyTriMesh.cpp in Sources */,
6B164AFE0FD6687600D2F919 /* glimage.cpp in Sources */,
6B164B010FD668B700D2F919 /* stb_image.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -29,6 +29,7 @@
#include "SDL.h"
#include "SDL_Opengl.h"
#include "GLFont.h"
#include "GLImage.h"
#include "RecastTimer.h"
#include "MeshLoaderObj.h"
#include "ChunkyTriMesh.h"
@ -144,6 +145,17 @@ struct FileList
size++;
}
static int cmp(const void* a, const void* b)
{
return strcmp(*(const char**)a, *(const char**)b);
}
void sort()
{
if (size > 1)
qsort(files, size, sizeof(char*), cmp);
}
char* files[MAX_FILES];
int size;
};
@ -184,6 +196,7 @@ void scanDirectory(const char* path, const char* ext, FileList& list)
}
closedir(dp);
#endif
list.sort();
}
@ -199,6 +212,7 @@ enum DrawMode
DRAWMODE_COMPACT,
DRAWMODE_COMPACT_DISTANCE,
DRAWMODE_COMPACT_REGIONS,
DRAWMODE_REGION_CONNECTIONS,
DRAWMODE_RAW_CONTOURS,
DRAWMODE_BOTH_CONTOURS,
DRAWMODE_CONTOURS,
@ -257,123 +271,6 @@ rcLog g_log;
rcBuildTimes g_buildTimes;
struct Portal
{
float bmin[3], bmax[3];
};
static const int MAX_PORTALS = 2000;
Portal g_portals[MAX_PORTALS];
int g_portalCount = 0;
Portal g_cportals[MAX_PORTALS];
int g_cportalCount = 0;
void findContourPortals(const rcContour* cont, const int tx, const int tz, const int tileSize,
const int climb, const float* bmin, const float cs, const float ch)
{
if (!cont) return;
if (!cont->nverts) return;
for (int i = 0, j = cont->nverts-1; i < cont->nverts; j=i++)
{
const int* vj = &cont->verts[j*4];
const int* vi = &cont->verts[i*4];
int edge = 0;
if (vj[0] == tx && vi[0] == tx)
edge = 1;
else if (vj[0] == tx+tileSize && vi[0] == tx+tileSize)
edge = 2;
else if (vj[2] == tz && vi[2] == tz)
edge = 3;
else if (vj[2] == tz+tileSize && vi[2] == tz+tileSize)
edge = 4;
if (edge != 0)
{
if (g_portalCount >= MAX_PORTALS)
return;
Portal& p = g_portals[g_portalCount];
g_portalCount++;
float v0[3], v1[3];
v0[0] = bmin[0] + vj[0]*cs;
v0[1] = bmin[1] + vj[1]*ch;
v0[2] = bmin[2] + vj[2]*cs;
v1[0] = bmin[0] + vi[0]*cs;
v1[1] = bmin[1] + vi[1]*ch;
v1[2] = bmin[2] + vi[2]*cs;
vcopy(p.bmin, v0);
vcopy(p.bmax, v0);
vmin(p.bmin, v1);
vmax(p.bmax, v1);
if (edge == 1)
{
p.bmin[2] += cs/4;
p.bmax[2] -= cs/4;
p.bmax[1] += climb*ch;
p.bmin[0] -= cs/4;
p.bmax[0] += cs/4;
}
else if (edge == 2)
{
p.bmin[2] += cs/4;
p.bmax[2] -= cs/4;
p.bmax[1] += climb*ch;
p.bmin[0] -= cs/4;
p.bmax[0] += cs/4;
}
else if (edge == 3)
{
p.bmin[0] += cs/4;
p.bmax[0] -= cs/4;
p.bmax[1] += climb*ch;
p.bmin[2] -= cs/4;
p.bmax[2] += cs/4;
}
else if (edge == 4)
{
p.bmin[0] += cs/4;
p.bmax[0] -= cs/4;
p.bmax[1] += climb*ch;
p.bmin[2] -= cs/4;
p.bmax[2] += cs/4;
}
}
}
}
void findPortals(const rcContourSet* cset, const int tx, const int ty, const int tileSize,
const int climb, const float* bmin, const float cs, const float ch)
{
if (!cset) return;
if (!cset->nconts) return;
for (int i = 0; i < cset->nconts; ++i)
findContourPortals(&cset->conts[i], tx, ty, tileSize, climb, bmin, cs, ch);
}
void connectPortals()
{
for (int i = 0; i < g_portalCount-1; ++i)
{
for (int j = i+1; j < g_portalCount; ++j)
{
if (g_portalCount >= MAX_PORTALS)
return;
Portal& pi = g_portals[i];
Portal& pj = g_portals[j];
Portal& p = g_cportals[g_cportalCount];
vcopy(p.bmin, pi.bmin);
vcopy(p.bmax, pi.bmax);
vmax(p.bmin, pj.bmin);
vmin(p.bmax, pj.bmax);
if (p.bmin[0] >= p.bmax[0] || p.bmin[1] >= p.bmax[1] || p.bmin[2] >= p.bmax[2])
continue;
g_cportalCount++;
}
}
}
bool buildTiledNavigation(const rcConfig& cfg,
const rcMeshLoaderObj* mesh,
const rcChunkyTriMesh* chunkyMesh,
@ -601,18 +498,6 @@ bool buildTiledNavigation(const rcConfig& cfg,
delete solid;
delete chf;
g_portalCount = 0;
g_cportalCount = 0;
/* for (int y = 0; y < tileSet->height; ++y)
{
for (int x = 0; x < tileSet->width; ++x)
{
findPortals(tileSet->tiles[x + y*tileSet->width].cset,
x*tileCfg.tileSize, y*tileCfg.tileSize, tileCfg.tileSize,
cfg.walkableClimb, cfg.bmin, cfg.cs, cfg.ch);
}
}
connectPortals();*/
for (int y = 0; y < tileSet->height; ++y)
{
@ -1013,8 +898,8 @@ int main(int argc, char *argv[])
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
int width = 1024; //1200;
int height = 768; //700;
int width = 1280; //1024; //1200;
int height = 800; //768; //700;
SDL_Surface* screen = SDL_SetVideoMode(width, height, 0, SDL_OPENGL /*| SDL_FULLSCREEN*/);
if (!screen)
{
@ -1045,13 +930,29 @@ int main(int argc, char *argv[])
float tileSize = 0.0f;
int drawMode = DRAWMODE_NAVMESH;
int toolMode = TOOLMODE_PATHFIND;
bool showMenu = false;
bool showLevels = false;
bool showLog = false;
bool showTools = true;
bool showTools = false;
char curLevel[256] = "Choose Level...";
bool mouseOverMenu = false;
bool keepInterResults = false;
FileList fileList;
FileList slidesList;
bool showSlides = false;
bool showCurSlide = true;
float slideAlpha = 1.0f;
int curSlide = 0;
int nextSlide = 0;
scanDirectory("slides", ".png", slidesList);
GLImage slideTex;
char path[256];
strcpy(path, "slides/");
strcat(path, slidesList.files[curSlide]);
slideTex.create(path);
dtPolyRef startRef = 0, endRef = 0;
@ -1082,8 +983,8 @@ int main(int argc, char *argv[])
float distanceToWall = 0;
bool sposSet = false, eposSet = false;
bool mposSet = false;
static const float startCol[4] = { 0.6f, 0.1f, 0.1f, 0.75f };
static const float endCol[4] = { 0.1f, 0.6f, 0.1f, 0.75f };
static const float startCol[4] = { 0.5f, 0.1f, 0.0f, 0.75f };
static const float endCol[4] = { 0.2f, 0.4f, 0.0f, 0.75f };
bool recalcTool = false;
glEnable(GL_CULL_FACE);
@ -1110,10 +1011,34 @@ int main(int argc, char *argv[])
{
case SDL_KEYDOWN:
// Handle any key presses here.
if(event.key.keysym.sym == SDLK_ESCAPE)
if (event.key.keysym.sym == SDLK_ESCAPE)
{
done = true;
}
else if (event.key.keysym.sym == SDLK_TAB)
{
showCurSlide = !showCurSlide;
}
else if (event.key.keysym.sym == SDLK_2)
{
showSlides = !showSlides;
}
else if (event.key.keysym.sym == SDLK_1)
{
showMenu = !showMenu;
}
else if (event.key.keysym.sym == SDLK_LEFT)
{
nextSlide--;
if (nextSlide < 0)
nextSlide = 0;
}
else if (event.key.keysym.sym == SDLK_RIGHT)
{
nextSlide++;
if (nextSlide >= slidesList.size)
nextSlide = slidesList.size-1;
}
break;
case SDL_MOUSEBUTTONDOWN:
@ -1212,6 +1137,23 @@ int main(int argc, char *argv[])
t += dt;
float slideAlphaTarget = showCurSlide ? 1 : 0;
if (curSlide != nextSlide)
slideAlphaTarget = 0;
if (slideAlphaTarget > slideAlpha)
slideAlpha = rcMin(slideAlpha+dt*4,1.0f);
else if (slideAlphaTarget < slideAlpha)
slideAlpha = rcMax(slideAlpha-dt*4,0.0f);
if (curSlide != nextSlide && slideAlpha < 0.01f)
{
curSlide = nextSlide;
char path[256];
strcpy(path, "slides/");
strcat(path, slidesList.files[curSlide]);
slideTex.create(path);
}
// Update and render
glViewport(0, 0, width, height);
@ -1272,12 +1214,12 @@ int main(int argc, char *argv[])
if (drawMode == DRAWMODE_MESH)
{
if (g_mesh)
rcDebugDrawMeshSlope(*g_mesh, agentMaxSlope);
rcDebugDrawMeshSlope(*g_mesh, agentMaxSlope, g_meshBMin[1], g_meshBMax[1]);
}
else if (drawMode != DRAWMODE_NAVMESH_TRANS)
{
if (g_mesh)
rcDebugDrawMesh(*g_mesh, 0);
rcDebugDrawMesh(*g_mesh, 0, g_meshBMin[1], g_meshBMax[1]);
}
glDisable(GL_FOG);
@ -1301,13 +1243,13 @@ int main(int argc, char *argv[])
if (npolys)
{
const float pathCol[4] = {1,0.75f,0,0.25f};
const float pathCol[4] = {0,0,0,0.25f}; //{1,0.75f,0,0.25f};
for (int i = 1; i < npolys-1; ++i)
dtDebugDrawStatNavMeshPoly(g_navMesh, polys[i], pathCol);
}
if (nstraightPath)
{
glColor4ub(220,16,0,220);
glColor4ub(128,16,0,220);
glLineWidth(3.0f);
glBegin(GL_LINE_STRIP);
for (int i = 0; i < nstraightPath; ++i)
@ -1331,7 +1273,7 @@ int main(int argc, char *argv[])
const float pathCol[4] = {1,0.75f,0,0.25f};
dtDebugDrawStatNavMeshPoly(g_navMesh, polys[0], pathCol);
glColor4ub(220,16,0,220);
glColor4ub(128,16,0,220);
glLineWidth(3.0f);
glBegin(GL_LINE_STRIP);
for (int i = 0; i < nstraightPath; ++i)
@ -1362,7 +1304,7 @@ int main(int argc, char *argv[])
}
else if (toolMode == TOOLMODE_FIND_POLYS_AROUND)
{
const float pathCol[4] = {1,0.75f,0,0.25f};
const float pathCol[4] = {0,0,0,0.25f}; //{1,0.75f,0,0.25f};
for (int i = 0; i < npolys; ++i)
dtDebugDrawStatNavMeshPoly(g_navMesh, polys[i], pathCol);
@ -1484,6 +1426,29 @@ int main(int argc, char *argv[])
}
glDepthMask(GL_TRUE);
}
if (drawMode == DRAWMODE_REGION_CONNECTIONS)
{
if (g_tileSet)
{
for (int i = 0; i < g_tileSet->width*g_tileSet->height; ++i)
{
if (g_tileSet->tiles[i].chf)
rcDebugDrawCompactHeightfieldRegions(*(g_tileSet->tiles[i].chf));
}
glDepthMask(GL_TRUE);
glDepthMask(GL_FALSE);
for (int i = 0; i < g_tileSet->width*g_tileSet->height; ++i)
{
if (g_tileSet->tiles[i].cset)
{
// rcDebugDrawRawContours(*(g_tileSet->tiles[i].cset), g_tileSet->bmin, g_tileSet->cs, g_tileSet->ch);
rcDebugDrawRegionConnections(*(g_tileSet->tiles[i].cset), g_tileSet->bmin, g_tileSet->cs, g_tileSet->ch);
}
}
glDepthMask(GL_TRUE);
}
}
if (drawMode == DRAWMODE_POLYMESH)
{
glDepthMask(GL_FALSE);
@ -1581,19 +1546,7 @@ int main(int argc, char *argv[])
rcDebugDrawBoxWire(g_meshBMin[0], g_meshBMin[1], g_meshBMin[2],
g_meshBMax[0], g_meshBMax[1], g_meshBMax[2], col);
col[0] = 0.1f; col[1] = 0.5f; col[2] = 0.75f; col[3] = 0.5f;
/* for (int i = 0; i < g_portalCount; ++i)
{
rcDebugDrawBoxWire(g_portals[i].bmin[0], g_portals[i].bmin[1], g_portals[i].bmin[2],
g_portals[i].bmax[0], g_portals[i].bmax[1], g_portals[i].bmax[2], col);
}*/
for (int i = 0; i < g_cportalCount; ++i)
{
rcDebugDrawBoxWire(g_cportals[i].bmin[0], g_cportals[i].bmin[1], g_cportals[i].bmin[2],
g_cportals[i].bmax[0], g_cportals[i].bmax[1], g_cportals[i].bmax[2], col);
}
glDepthMask(GL_TRUE);
}
@ -1611,6 +1564,9 @@ int main(int argc, char *argv[])
mouseOverMenu = false;
if (showMenu)
{
static int propScroll = 0;
if (imguiBeginScrollArea(GENID, "Properties", width - 250 - 10, 10, 250, height-20, &propScroll))
mouseOverMenu = true;
@ -1628,6 +1584,7 @@ int main(int argc, char *argv[])
}
}
imguiSeparator();
if (g_mesh)
@ -1743,12 +1700,12 @@ int main(int argc, char *argv[])
drawMode = DRAWMODE_MESH;
if (imguiCheck(GENID, "Navmesh", drawMode == DRAWMODE_NAVMESH))
drawMode = DRAWMODE_NAVMESH;
if (imguiCheck(GENID, "Navmesh BVTree", drawMode == DRAWMODE_NAVMESH_BVTREE))
drawMode = DRAWMODE_NAVMESH_BVTREE;
if (imguiCheck(GENID, "Navmesh Invis", drawMode == DRAWMODE_NAVMESH_INVIS))
drawMode = DRAWMODE_NAVMESH_INVIS;
if (imguiCheck(GENID, "Navmesh Trans", drawMode == DRAWMODE_NAVMESH_TRANS))
drawMode = DRAWMODE_NAVMESH_TRANS;
if (imguiCheck(GENID, "Navmesh BVTree", drawMode == DRAWMODE_NAVMESH_BVTREE))
drawMode = DRAWMODE_NAVMESH_BVTREE;
if (imguiCheck(GENID, "Voxels", drawMode == DRAWMODE_VOXELS))
drawMode = DRAWMODE_VOXELS;
if (imguiCheck(GENID, "Walkable Voxels", drawMode == DRAWMODE_VOXELS_WALKABLE))
@ -1759,6 +1716,8 @@ int main(int argc, char *argv[])
drawMode = DRAWMODE_COMPACT_DISTANCE;
if (imguiCheck(GENID, "Compact Regions", drawMode == DRAWMODE_COMPACT_REGIONS))
drawMode = DRAWMODE_COMPACT_REGIONS;
if (imguiCheck(GENID, "Region Conections", drawMode == DRAWMODE_REGION_CONNECTIONS))
drawMode = DRAWMODE_REGION_CONNECTIONS;
if (imguiCheck(GENID, "Raw Contours", drawMode == DRAWMODE_RAW_CONTOURS))
drawMode = DRAWMODE_RAW_CONTOURS;
if (imguiCheck(GENID, "Both Contours", drawMode == DRAWMODE_BOTH_CONTOURS))
@ -1769,12 +1728,14 @@ int main(int argc, char *argv[])
drawMode = DRAWMODE_POLYMESH;
imguiEndScrollArea();
}
// Tools
if (showTools)
{
static int toolsScroll = 0;
if (imguiBeginScrollArea(GENID, "Tools", 10, 450, 150, 200, &toolsScroll))
if (imguiBeginScrollArea(GENID, "Tools", 10, height - 10 - 200, 150, 200, &toolsScroll))
mouseOverMenu = true;
if (imguiCheck(GENID, "Pathfind", toolMode == TOOLMODE_PATHFIND))
@ -1800,7 +1761,7 @@ int main(int argc, char *argv[])
imguiEndScrollArea();
}
if (g_navMesh && recalcTool)
{
recalcTool = false;
@ -1959,7 +1920,65 @@ int main(int argc, char *argv[])
}
g_font.drawText(10.0f, (float)height-20.0f, "W/S/A/D: Move RMB: Rotate LMB: Place Start LMB+SHIFT: Place End", GLFont::RGBA(255,255,255,128));
if (showSlides)
{
static int slidesScroll = 0;
if (imguiBeginScrollArea(GENID, "Slides", 10, height - 10 - 200 - 20 - 250, 150, 250, &slidesScroll))
mouseOverMenu = true;
int slideToLoad = -1;
for (int i = 0; i < slidesList.size; ++i)
{
char msg[256];
snprintf(msg,256,"%s%s", i == curSlide ? ">> " : (i == nextSlide ? ">" : ""), slidesList.files[i]);
if (imguiItem(GENID1(i), msg))
slideToLoad = i;
}
if (slideToLoad >= 0)
{
nextSlide = slideToLoad;
showSlides = false;
}
imguiEndScrollArea();
}
if (slideAlpha > 0.01f && curSlide >= 0 && curSlide < slidesList.size)
{
unsigned char alpha = (unsigned char)(slideAlpha*255.0f);
/* const char* file = slidesList.files[curSlide];
const float len = g_font.getTextLength(file);
g_font.drawText(width/2-len/2, (float)height/2, file, GLFont::RGBA(255,255,255,alpha));*/
glEnable(GL_TEXTURE_RECTANGLE_ARB);
slideTex.bind();
const float tw = slideTex.getWidth();
const float th = slideTex.getHeight();
const float hw = tw/2; //width*0.5f;
const float hh = th/2; //height*0.5f;
glColor4ub(255,255,255,alpha);
glBegin(GL_QUADS);
glTexCoord2f(0,th);
glVertex2f(hw-tw/2,hh-th/2);
glTexCoord2f(tw,th);
glVertex2f(hw+tw/2,hh-th/2);
glTexCoord2f(tw,0);
glVertex2f(hw+tw/2,hh+th/2);
glTexCoord2f(0,0);
glVertex2f(hw-tw/2,hh+th/2);
glEnd();
glDisable(GL_TEXTURE_RECTANGLE_ARB);
}
/* {
const char msg[] = "W/S/A/D: Move RMB: Rotate LMB: Place Start LMB+SHIFT: Place End";
const float len = g_font.getTextLength(msg);
g_font.drawText(width/2-len/2, (float)height-20.0f, msg, GLFont::RGBA(255,255,255,128));
}*/
// Draw start and end point labels
if (sposSet && gluProject((GLdouble)spos[0], (GLdouble)spos[1], (GLdouble)spos[2],