Recast Navigation
Navigation-mesh Toolset for Games
Sample_TempObstacles.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
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 
29 {
30 protected:
32 
36 
38 
43  unsigned int m_cacheBuildMemUsage;
44 
45  enum DrawMode
46  {
56  };
57 
59 
62  float m_tileSize;
63 
64 public:
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.
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
Definition: InputGeom.h:73
Definition: Sample_TempObstacles.h:29
void getTilePos(const float *pos, int &tx, int &ty)
Definition: Sample_TempObstacles.cpp:1386
virtual void handleTools()
Definition: Sample_TempObstacles.cpp:952
int m_maxPolysPerTile
Definition: Sample_TempObstacles.h:61
virtual ~Sample_TempObstacles()
Definition: Sample_TempObstacles.cpp:859
float m_tileSize
Definition: Sample_TempObstacles.h:62
virtual void handleRender()
Definition: Sample_TempObstacles.cpp:1043
DrawMode m_drawMode
Definition: Sample_TempObstacles.h:58
struct MeshProcess * m_tmproc
Definition: Sample_TempObstacles.h:35
virtual void handleRenderOverlay(double *proj, double *model, int *view)
Definition: Sample_TempObstacles.cpp:1125
float m_cacheBuildTimeMs
Definition: Sample_TempObstacles.h:39
virtual void handleUpdate(const float dt)
Definition: Sample_TempObstacles.cpp:1374
void loadAll(const char *path)
Definition: Sample_TempObstacles.cpp:1455
DrawMode
Definition: Sample_TempObstacles.h:46
@ DRAWMODE_MESH
Definition: Sample_TempObstacles.h:53
@ DRAWMODE_NAVMESH_PORTALS
Definition: Sample_TempObstacles.h:51
@ DRAWMODE_NAVMESH_NODES
Definition: Sample_TempObstacles.h:50
@ DRAWMODE_NAVMESH_BVTREE
Definition: Sample_TempObstacles.h:49
@ DRAWMODE_NAVMESH_TRANS
Definition: Sample_TempObstacles.h:48
@ MAX_DRAWMODE
Definition: Sample_TempObstacles.h:55
@ DRAWMODE_CACHE_BOUNDS
Definition: Sample_TempObstacles.h:54
@ DRAWMODE_NAVMESH_INVIS
Definition: Sample_TempObstacles.h:52
@ DRAWMODE_NAVMESH
Definition: Sample_TempObstacles.h:47
void renderCachedTile(const int tx, const int ty, const int type)
Definition: Sample_TempObstacles.cpp:1113
struct FastLZCompressor * m_tcomp
Definition: Sample_TempObstacles.h:34
Sample_TempObstacles()
Definition: Sample_TempObstacles.cpp:837
bool m_keepInterResults
Definition: Sample_TempObstacles.h:31
void clearAllTempObstacles()
Definition: Sample_TempObstacles.cpp:1193
int m_cacheRawSize
Definition: Sample_TempObstacles.h:41
void removeTempObstacle(const float *sp, const float *sq)
Definition: Sample_TempObstacles.cpp:1185
void addTempObstacle(const float *pos)
Definition: Sample_TempObstacles.cpp:1175
virtual void handleSettings()
Definition: Sample_TempObstacles.cpp:866
virtual bool handleBuild()
Definition: Sample_TempObstacles.cpp:1205
unsigned int m_cacheBuildMemUsage
Definition: Sample_TempObstacles.h:43
struct LinearAllocator * m_talloc
Definition: Sample_TempObstacles.h:33
void saveAll(const char *path)
Definition: Sample_TempObstacles.cpp:1415
void renderCachedTileOverlay(const int tx, const int ty, double *proj, double *model, int *view)
Definition: Sample_TempObstacles.cpp:1119
int m_cacheCompressedSize
Definition: Sample_TempObstacles.h:40
virtual void handleDebugMode()
Definition: Sample_TempObstacles.cpp:991
class dtTileCache * m_tileCache
Definition: Sample_TempObstacles.h:37
int m_maxTiles
Definition: Sample_TempObstacles.h:60
int m_cacheLayerCount
Definition: Sample_TempObstacles.h:42
virtual void handleMeshChanged(class InputGeom *geom)
Definition: Sample_TempObstacles.cpp:1155
Definition: Sample.h:100
Definition: DetourTileCache.h:102
Definition: Sample_TempObstacles.cpp:110
Definition: Sample_TempObstacles.cpp:139
Definition: Sample_TempObstacles.cpp:189
Definition: Sample_TempObstacles.cpp:250
Specifies a configuration to use when performing Recast builds.
Definition: Recast.h:217