recastnavigation_v1.6.0/RecastDemo/Include/Sample_SoloMeshTiled.h
2009-12-04 07:27:53 +00:00

96 lines
2.1 KiB
C++

#ifndef RECASTSAMPLESOLOMESHTILED_H
#define RECASTSAMPLESOLOMESHTILED_H
#include "Sample_SoloMesh.h"
#include "DetourNavMesh.h"
#include "Recast.h"
#include "RecastLog.h"
#include "ChunkyTriMesh.h"
class Sample_SoloMeshTiled : public Sample_SoloMesh
{
protected:
struct Tile
{
inline Tile() : chf(0), solid(0), cset(0), pmesh(0), dmesh(0), buildTime(0) {}
inline ~Tile() { delete chf; delete cset; delete solid; delete pmesh; delete dmesh; }
rcCompactHeightfield* chf;
rcHeightfield* solid;
rcContourSet* cset;
rcPolyMesh* pmesh;
rcPolyMeshDetail* dmesh;
int buildTime;
};
struct TileSet
{
inline TileSet() : width(0), height(0), tiles(0) {}
inline ~TileSet() { delete [] tiles; }
int width, height;
float bmin[3], bmax[3];
float cs, ch;
Tile* tiles;
};
bool m_measurePerTileTimings;
bool m_keepInterResults;
float m_tileSize;
rcBuildTimes m_buildTimes;
rcChunkyTriMesh* m_chunkyMesh;
rcPolyMesh* m_pmesh;
rcPolyMeshDetail* m_dmesh;
rcConfig m_cfg;
TileSet* m_tileSet;
static const int MAX_STAT_BUCKETS = 1000;
int m_statPolysPerTile[MAX_STAT_BUCKETS];
int m_statPolysPerTileSamples;
int m_statTimePerTile[MAX_STAT_BUCKETS];
int m_statTimePerTileSamples;
enum DrawMode
{
DRAWMODE_NAVMESH,
DRAWMODE_NAVMESH_TRANS,
DRAWMODE_NAVMESH_BVTREE,
DRAWMODE_NAVMESH_INVIS,
DRAWMODE_MESH,
DRAWMODE_VOXELS,
DRAWMODE_VOXELS_WALKABLE,
DRAWMODE_COMPACT,
DRAWMODE_COMPACT_DISTANCE,
DRAWMODE_COMPACT_REGIONS,
DRAWMODE_REGION_CONNECTIONS,
DRAWMODE_RAW_CONTOURS,
DRAWMODE_BOTH_CONTOURS,
DRAWMODE_CONTOURS,
DRAWMODE_POLYMESH,
DRAWMODE_POLYMESH_DETAIL,
MAX_DRAWMODE
};
DrawMode m_drawMode;
void cleanup();
public:
Sample_SoloMeshTiled();
virtual ~Sample_SoloMeshTiled();
virtual void handleSettings();
virtual void handleDebugMode();
virtual void handleRender();
virtual void handleRenderOverlay(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);
virtual bool handleBuild();
};
#endif // RECASTSAMPLESOLOMESHTILED_H