mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-25 22:35:37 +00:00
update recast
This commit is contained in:
parent
e079536122
commit
8aa48ff21b
34 changed files with 1138 additions and 407 deletions
|
|
@ -35,13 +35,47 @@ enum ObstacleState
|
|||
DT_OBSTACLE_REMOVING,
|
||||
};
|
||||
|
||||
enum ObstacleType
|
||||
{
|
||||
DT_OBSTACLE_CYLINDER,
|
||||
DT_OBSTACLE_BOX, // AABB
|
||||
DT_OBSTACLE_ORIENTED_BOX, // OBB
|
||||
};
|
||||
|
||||
struct dtObstacleCylinder
|
||||
{
|
||||
float pos[ 3 ];
|
||||
float radius;
|
||||
float height;
|
||||
};
|
||||
|
||||
struct dtObstacleBox
|
||||
{
|
||||
float bmin[ 3 ];
|
||||
float bmax[ 3 ];
|
||||
};
|
||||
|
||||
struct dtObstacleOrientedBox
|
||||
{
|
||||
float center[ 3 ];
|
||||
float halfExtents[ 3 ];
|
||||
float rotAux[ 2 ]; //{ cos(0.5f*angle)*sin(-0.5f*angle); cos(0.5f*angle)*cos(0.5f*angle) - 0.5 }
|
||||
};
|
||||
|
||||
static const int DT_MAX_TOUCHED_TILES = 8;
|
||||
struct dtTileCacheObstacle
|
||||
{
|
||||
float pos[3], radius, height;
|
||||
union
|
||||
{
|
||||
dtObstacleCylinder cylinder;
|
||||
dtObstacleBox box;
|
||||
dtObstacleOrientedBox orientedBox;
|
||||
};
|
||||
|
||||
dtCompressedTileRef touched[DT_MAX_TOUCHED_TILES];
|
||||
dtCompressedTileRef pending[DT_MAX_TOUCHED_TILES];
|
||||
unsigned short salt;
|
||||
unsigned char type;
|
||||
unsigned char state;
|
||||
unsigned char ntouched;
|
||||
unsigned char npending;
|
||||
|
|
@ -105,13 +139,27 @@ public:
|
|||
|
||||
dtStatus removeTile(dtCompressedTileRef ref, unsigned char** data, int* dataSize);
|
||||
|
||||
// Cylinder obstacle.
|
||||
dtStatus addObstacle(const float* pos, const float radius, const float height, dtObstacleRef* result);
|
||||
|
||||
// Aabb obstacle.
|
||||
dtStatus addBoxObstacle(const float* bmin, const float* bmax, dtObstacleRef* result);
|
||||
|
||||
// Box obstacle: can be rotated in Y.
|
||||
dtStatus addBoxObstacle(const float* center, const float* halfExtents, const float yRadians, dtObstacleRef* result);
|
||||
|
||||
dtStatus removeObstacle(const dtObstacleRef ref);
|
||||
|
||||
dtStatus queryTiles(const float* bmin, const float* bmax,
|
||||
dtCompressedTileRef* results, int* resultCount, const int maxResults) const;
|
||||
|
||||
dtStatus update(const float /*dt*/, class dtNavMesh* navmesh);
|
||||
/// Updates the tile cache by rebuilding tiles touched by unfinished obstacle requests.
|
||||
/// @param[in] dt The time step size. Currently not used.
|
||||
/// @param[in] navmesh The mesh to affect when rebuilding tiles.
|
||||
/// @param[out] upToDate Whether the tile cache is fully up to date with obstacle requests and tile rebuilds.
|
||||
/// If the tile cache is up to date another (immediate) call to update will have no effect;
|
||||
/// otherwise another call will continue processing obstacle requests and tile rebuilds.
|
||||
dtStatus update(const float dt, class dtNavMesh* navmesh, bool* upToDate = 0);
|
||||
|
||||
dtStatus buildNavMeshTilesAt(const int tx, const int ty, class dtNavMesh* navmesh);
|
||||
|
||||
|
|
|
|||
|
|
@ -127,6 +127,12 @@ void dtFreeTileCachePolyMesh(dtTileCacheAlloc* alloc, dtTileCachePolyMesh* lmesh
|
|||
dtStatus dtMarkCylinderArea(dtTileCacheLayer& layer, const float* orig, const float cs, const float ch,
|
||||
const float* pos, const float radius, const float height, const unsigned char areaId);
|
||||
|
||||
dtStatus dtMarkBoxArea(dtTileCacheLayer& layer, const float* orig, const float cs, const float ch,
|
||||
const float* bmin, const float* bmax, const unsigned char areaId);
|
||||
|
||||
dtStatus dtMarkBoxArea(dtTileCacheLayer& layer, const float* orig, const float cs, const float ch,
|
||||
const float* center, const float* halfExtents, const float* rotAux, const unsigned char areaId);
|
||||
|
||||
dtStatus dtBuildTileCacheRegions(dtTileCacheAlloc* alloc,
|
||||
dtTileCacheLayer& layer,
|
||||
const int walkableClimb);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue