| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#ifndef RECASTSAMPLETEMPOBSTACLE_H |
| 20 |
#define RECASTSAMPLETEMPOBSTACLE_H |
| 21 |
|
| 22 |
#include "Sample.h" |
| 23 |
#include "DetourNavMesh.h" |
| 24 |
#include "Recast.h" |
| 25 |
#include "ChunkyTriMesh.h" |
| 26 |
|
| 27 |
|
| 28 |
class Sample_TempObstacles : public Sample |
| 29 |
{ |
| 30 |
protected: |
| 31 |
bool m_keepInterResults; |
| 32 |
|
| 33 |
struct LinearAllocator* m_talloc; |
| 34 |
struct FastLZCompressor* m_tcomp; |
| 35 |
struct MeshProcess* m_tmproc; |
| 36 |
|
| 37 |
class dtTileCache* m_tileCache; |
| 38 |
|
| 39 |
float m_cacheBuildTimeMs; |
| 40 |
int m_cacheCompressedSize; |
| 41 |
int m_cacheRawSize; |
| 42 |
int m_cacheLayerCount; |
| 43 |
unsigned int m_cacheBuildMemUsage; |
| 44 |
|
| 45 |
enum DrawMode |
| 46 |
{ |
| 47 |
DRAWMODE_NAVMESH, |
| 48 |
DRAWMODE_NAVMESH_TRANS, |
| 49 |
DRAWMODE_NAVMESH_BVTREE, |
| 50 |
DRAWMODE_NAVMESH_NODES, |
| 51 |
DRAWMODE_NAVMESH_PORTALS, |
| 52 |
DRAWMODE_NAVMESH_INVIS, |
| 53 |
DRAWMODE_MESH, |
| 54 |
DRAWMODE_CACHE_BOUNDS, |
| 55 |
MAX_DRAWMODE |
| 56 |
}; |
| 57 |
|
| 58 |
DrawMode m_drawMode; |
| 59 |
|
| 60 |
int m_maxTiles; |
| 61 |
int m_maxPolysPerTile; |
| 62 |
float m_tileSize; |
| 63 |
|
| 64 |
public: |
| 65 |
Sample_TempObstacles(); |
| 66 |
virtual ~Sample_TempObstacles(); |
| 67 |
|
| 68 |
virtual void handleSettings(); |
| 69 |
virtual void handleTools(); |
| 70 |
virtual void handleDebugMode(); |
| 71 |
virtual void handleRender(); |
| 72 |
virtual void handleRenderOverlay(double* proj, double* model, int* view); |
| 73 |
virtual void handleMeshChanged(class InputGeom* geom); |
| 74 |
virtual bool handleBuild(); |
| 75 |
virtual void handleUpdate(const float dt); |
| 76 |
|
| 77 |
void getTilePos(const float* pos, int& tx, int& ty); |
| 78 |
|
| 79 |
void renderCachedTile(const int tx, const int ty, const int type); |
| 80 |
void renderCachedTileOverlay(const int tx, const int ty, double* proj, double* model, int* view); |
| 81 |
|
| 82 |
void addTempObstacle(const float* pos); |
| 83 |
void removeTempObstacle(const float* sp, const float* sq); |
| 84 |
void clearAllTempObstacles(); |
| 85 |
|
| 86 |
void saveAll(const char* path); |
| 87 |
void loadAll(const char* path); |
| 88 |
|
| 89 |
private: |
| 90 |
|
| 91 |
Sample_TempObstacles(const Sample_TempObstacles&); |
| 92 |
Sample_TempObstacles& operator=(const Sample_TempObstacles&); |
| 93 |
|
| 94 |
int rasterizeTileLayers(const int tx, const int ty, const rcConfig& cfg, struct TileCacheData* tiles, const int maxTiles); |
| 95 |
}; |
| 96 |
|
| 97 |
|
| 98 |
#endif |