Mikko Mononen ab372964ad Tweaked debug draw to better fit the Paris conferene setup.
Rewrote fixup contours, now should handle all cases.
Added few more debug draw modes for the demo.
Changed the vertex welding to cope with slight imprecision in y-direction.
2009-06-03 07:35:25 +00:00

60 lines
2.6 KiB
C

//
// Copyright (c) 2009 Mikko Mononen memon@inside.org
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
#ifndef RECAST_DEBUGDRAW_H
#define RECAST_DEBUGDRAW_H
inline int bit(int a, int b)
{
return (a & (1 << b)) >> b;
}
inline void intToCol(int i, float* col)
{
int r = bit(i, 0) + bit(i, 3) * 2 + 1;
int g = bit(i, 1) + bit(i, 4) * 2 + 1;
int b = bit(i, 2) + bit(i, 5) * 2 + 1;
col[0] = 1 - r*63.0f/255.0f;
col[1] = 1 - g*63.0f/255.0f;
col[2] = 1 - b*63.0f/255.0f;
}
void rcDebugDrawHeightfieldSolid(const struct rcHeightfield& hf,
const float* orig, float cs, float ch);
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 rcDebugDrawCompactHeightfieldSolid(const struct rcCompactHeightfield& chf);
void rcDebugDrawCompactHeightfieldRegions(const struct rcCompactHeightfield& chf);
void rcDebugDrawCompactHeightfieldDistance(const struct rcCompactHeightfield& chf);
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);
void rcDebugDrawCylinderWire(float minx, float miny, float minz, float maxx, float maxy, float maxz, const float* col);
void rcDebugDrawBoxWire(float minx, float miny, float minz, float maxx, float maxy, float maxz, const float* col);
void rcDebugDrawBox(float minx, float miny, float minz, float maxx, float maxy, float maxz,
const float* col1, const float* col2);
#endif // RECAST_DEBUGDRAW_H