mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 19:53:48 +00:00
Updated recast to 1.5.1
This commit is contained in:
parent
630949514a
commit
c7e5b35744
55 changed files with 3277 additions and 1460 deletions
|
|
@ -3,9 +3,9 @@
|
|||
#include "DetourNavMeshBuilder.h"
|
||||
#include "DetourNavMesh.h"
|
||||
#include "DetourCommon.h"
|
||||
#include "DetourMath.h"
|
||||
#include "DetourAlloc.h"
|
||||
#include "DetourAssert.h"
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <new>
|
||||
|
||||
|
|
@ -40,10 +40,10 @@ inline int computeTileHash(int x, int y, const int mask)
|
|||
}
|
||||
|
||||
|
||||
struct BuildContext
|
||||
struct NavMeshTileBuildContext
|
||||
{
|
||||
inline BuildContext(struct dtTileCacheAlloc* a) : layer(0), lcset(0), lmesh(0), alloc(a) {}
|
||||
inline ~BuildContext() { purge(); }
|
||||
inline NavMeshTileBuildContext(struct dtTileCacheAlloc* a) : layer(0), lcset(0), lmesh(0), alloc(a) {}
|
||||
inline ~NavMeshTileBuildContext() { purge(); }
|
||||
void purge()
|
||||
{
|
||||
dtFreeTileCacheLayer(alloc, layer);
|
||||
|
|
@ -213,14 +213,14 @@ dtCompressedTile* dtTileCache::getTileAt(const int tx, const int ty, const int t
|
|||
dtCompressedTileRef dtTileCache::getTileRef(const dtCompressedTile* tile) const
|
||||
{
|
||||
if (!tile) return 0;
|
||||
const unsigned int it = tile - m_tiles;
|
||||
const unsigned int it = (unsigned int)(tile - m_tiles);
|
||||
return (dtCompressedTileRef)encodeTileId(tile->salt, it);
|
||||
}
|
||||
|
||||
dtObstacleRef dtTileCache::getObstacleRef(const dtTileCacheObstacle* ob) const
|
||||
{
|
||||
if (!ob) return 0;
|
||||
const unsigned int idx = ob - m_obstacles;
|
||||
const unsigned int idx = (unsigned int)(ob - m_obstacles);
|
||||
return encodeObstacleId(ob->salt, idx);
|
||||
}
|
||||
|
||||
|
|
@ -350,7 +350,7 @@ dtStatus dtTileCache::removeTile(dtCompressedTileRef ref, unsigned char** data,
|
|||
}
|
||||
|
||||
|
||||
dtObstacleRef dtTileCache::addObstacle(const float* pos, const float radius, const float height, dtObstacleRef* result)
|
||||
dtStatus dtTileCache::addObstacle(const float* pos, const float radius, const float height, dtObstacleRef* result)
|
||||
{
|
||||
if (m_nreqs >= MAX_REQUESTS)
|
||||
return DT_FAILURE | DT_BUFFER_TOO_SMALL;
|
||||
|
|
@ -384,7 +384,7 @@ dtObstacleRef dtTileCache::addObstacle(const float* pos, const float radius, con
|
|||
return DT_SUCCESS;
|
||||
}
|
||||
|
||||
dtObstacleRef dtTileCache::removeObstacle(const dtObstacleRef ref)
|
||||
dtStatus dtTileCache::removeObstacle(const dtObstacleRef ref)
|
||||
{
|
||||
if (!ref)
|
||||
return DT_SUCCESS;
|
||||
|
|
@ -409,10 +409,10 @@ dtStatus dtTileCache::queryTiles(const float* bmin, const float* bmax,
|
|||
|
||||
const float tw = m_params.width * m_params.cs;
|
||||
const float th = m_params.height * m_params.cs;
|
||||
const int tx0 = (int)floorf((bmin[0]-m_params.orig[0]) / tw);
|
||||
const int tx1 = (int)floorf((bmax[0]-m_params.orig[0]) / tw);
|
||||
const int ty0 = (int)floorf((bmin[2]-m_params.orig[2]) / th);
|
||||
const int ty1 = (int)floorf((bmax[2]-m_params.orig[2]) / th);
|
||||
const int tx0 = (int)dtMathFloorf((bmin[0]-m_params.orig[0]) / tw);
|
||||
const int tx1 = (int)dtMathFloorf((bmax[0]-m_params.orig[0]) / tw);
|
||||
const int ty0 = (int)dtMathFloorf((bmin[2]-m_params.orig[2]) / th);
|
||||
const int ty1 = (int)dtMathFloorf((bmax[2]-m_params.orig[2]) / th);
|
||||
|
||||
for (int ty = ty0; ty <= ty1; ++ty)
|
||||
{
|
||||
|
|
@ -587,7 +587,7 @@ dtStatus dtTileCache::buildNavMeshTile(const dtCompressedTileRef ref, dtNavMesh*
|
|||
|
||||
m_talloc->reset();
|
||||
|
||||
BuildContext bc(m_talloc);
|
||||
NavMeshTileBuildContext bc(m_talloc);
|
||||
const int walkableClimbVx = (int)(m_params.walkableClimb / m_params.ch);
|
||||
dtStatus status;
|
||||
|
||||
|
|
@ -631,7 +631,11 @@ dtStatus dtTileCache::buildNavMeshTile(const dtCompressedTileRef ref, dtNavMesh*
|
|||
|
||||
// Early out if the mesh tile is empty.
|
||||
if (!bc.lmesh->npolys)
|
||||
{
|
||||
// Remove existing tile.
|
||||
navmesh->removeTile(navmesh->getTileRefAt(tile->header->tx,tile->header->ty,tile->header->tlayer),0,0);
|
||||
return DT_SUCCESS;
|
||||
}
|
||||
|
||||
dtNavMeshCreateParams params;
|
||||
memset(¶ms, 0, sizeof(params));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue