Debian Codegraph @

RecastDemo/Include/Sample_TempObstacles.h

raw symbols SCIP
1 //
2 // Copyright (c) 2009-2010 Mikko Mononen [email protected]
3 //
4 // This software is provided 'as-is', without any express or implied
5 // warranty. In no event will the authors be held liable for any damages
6 // arising from the use of this software.
7 // Permission is granted to anyone to use this software for any purpose,
8 // including commercial applications, and to alter it and redistribute it
9 // freely, subject to the following restrictions:
10 // 1. The origin of this software must not be misrepresented; you must not
11 // claim that you wrote the original software. If you use this software
12 // in a product, an acknowledgment in the product documentation would be
13 // appreciated but is not required.
14 // 2. Altered source versions must be plainly marked as such, and must not be
15 // misrepresented as being the original software.
16 // 3. This notice may not be removed or altered from any source distribution.
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 // Explicitly disabled copy constructor and copy assignment operator.
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 // RECASTSAMPLETEMPOBSTACLE_H