本文整理汇总了C++中dtFreeNavMesh函数的典型用法代码示例。如果您正苦于以下问题:C++ dtFreeNavMesh函数的具体用法?C++ dtFreeNavMesh怎么用?C++ dtFreeNavMesh使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dtFreeNavMesh函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BotShutdownNav
void BotShutdownNav( void )
{
for ( int i = 0; i < numNavData; i++ )
{
NavData_t *nav = &BotNavData[ i ];
if ( nav->cache )
{
dtFreeTileCache( nav->cache );
nav->cache = 0;
}
if ( nav->mesh )
{
dtFreeNavMesh( nav->mesh );
nav->mesh = 0;
}
if ( nav->query )
{
dtFreeNavMeshQuery( nav->query );
nav->query = 0;
}
nav->process.con.reset();
memset( nav->name, 0, sizeof( nav->name ) );
}
#ifndef DEDICATED
NavEditShutdown();
#endif
numNavData = 0;
}
示例2: rcFreeHeightField
/**
* Cleanup recast stuff, not debug manualobjects.
**/
void OgreRecast::RecastCleanup()
{
if(m_triareas) delete [] m_triareas;
m_triareas = 0;
rcFreeHeightField(m_solid);
m_solid = 0;
rcFreeCompactHeightfield(m_chf);
m_chf = 0;
rcFreeContourSet(m_cset);
m_cset = 0;
rcFreePolyMesh(m_pmesh);
m_pmesh = 0;
rcFreePolyMeshDetail(m_dmesh);
m_dmesh = 0;
dtFreeNavMesh(m_navMesh);
m_navMesh = 0;
dtFreeNavMeshQuery(m_navQuery);
m_navQuery = 0 ;
if(m_ctx){
delete m_ctx;
m_ctx = 0;
}
}
示例3: imguiSeparator
void Sample_SoloMesh::handleSettings()
{
Sample::handleCommonSettings();
if (imguiCheck("Keep Itermediate Results", m_keepInterResults))
m_keepInterResults = !m_keepInterResults;
imguiSeparator();
imguiIndent();
imguiIndent();
if (imguiButton("Save"))
{
Sample::saveAll("solo_navmesh.bin", m_navMesh);
}
if (imguiButton("Load"))
{
dtFreeNavMesh(m_navMesh);
m_navMesh = Sample::loadAll("solo_navmesh.bin");
m_navQuery->init(m_navMesh, 2048);
}
imguiUnindent();
imguiUnindent();
char msg[64];
snprintf(msg, 64, "Build Time: %.1fms", m_totalBuildTimeMs);
imguiLabel(msg);
imguiSeparator();
}
示例4: dtnmFreeNavMesh
EXPORT_API void dtnmFreeNavMesh(dtNavMesh** pNavMesh, bool freeTiles)
{
if (!pNavMesh && !(*pNavMesh))
return;
dtNavMesh* mesh = *pNavMesh;
const dtNavMesh* cmesh = *pNavMesh; // Cleaner code when calling getTile().
if (freeTiles)
{
unsigned char* tData = 0;
for (int i = 0; i < mesh->getMaxTiles(); ++i)
{
const dtMeshTile* tile = cmesh->getTile(i);
if (!tile || !tile->header || !tile->dataSize)
continue;
dtTileRef tref = mesh->getTileRef(tile);
dtStatus status = mesh->removeTile(tref, &tData, 0);
if (dtStatusSucceed(status) && tData)
{
dtFree(tData);
tData = 0;
}
}
}
dtFreeNavMesh(mesh);
}
示例5: dtnmBuildSingleTileMesh
EXPORT_API dtStatus dtnmBuildSingleTileMesh(dtNavMeshCreateParams* params
, dtNavMesh** ppNavMesh)
{
if (!params)
return DT_FAILURE + DT_INVALID_PARAM;
unsigned char* navData = 0;
int navDataSize = 0;
if (!dtCreateNavMeshData(params, &navData, &navDataSize))
return DT_FAILURE + DT_INVALID_PARAM;
dtNavMesh* pNavMesh = dtAllocNavMesh();
if (!pNavMesh)
{
dtFree(navData);
return DT_FAILURE + DT_OUT_OF_MEMORY;
}
dtStatus status =
pNavMesh->init(navData, navDataSize, DT_TILE_FREE_DATA);
if (dtStatusFailed(status))
{
dtFreeNavMesh(pNavMesh);
dtFree(navData);
return status;
}
*ppNavMesh = pNavMesh;
return DT_SUCCESS;
}
示例6: generateMesh
bool NavMesh::buildProcess()
{
mBuilding = true;
// Create mesh
bool success = generateMesh();
mNavMeshLock.lock();
// Copy new navmesh into old.
dtNavMesh *old = nm;
nm = tnm; // I am trusting that this is atomic.
dtFreeNavMesh(old);
tnm = NULL;
mNavMeshLock.unlock();
// Free structs used during build
freeIntermediates(false);
// Alert event manager that we have been built.
if(mEventManager)
mEventManager->postEvent("NavMeshBuild", "");
mBuilding = false;
return success;
}
示例7: dtFreeNavMeshQuery
Sample::~Sample()
{
dtFreeNavMeshQuery(m_navQuery);
dtFreeNavMesh(m_navMesh);
dtFreeCrowd(m_crowd);
delete m_tool;
}
示例8: dtFreeNavMesh
void DetourInterface::detourCleanup()
{
dtFreeNavMesh(_navMesh);
_navMesh = 0;
dtFreeNavMeshQuery(_navQuery);
_navQuery = 0;
}
示例9: cleanup
NavMeshGenerator::~NavMeshGenerator()
{
cleanup();
dtFreeNavMeshQuery(m_navQuery);
dtFreeNavMesh(m_navMesh);
dtFreeCrowd(m_crowd);
}
示例10: dtFreeNavMesh
void SoloMesh::handleMeshChanged(InputGeom* geom)
{
// m_geom = geom;
Sample::handleMeshChanged(geom);
dtFreeNavMesh(m_navMesh);
m_navMesh = 0;
}
示例11: dtFreeNavMeshQuery
Sample::~Sample()
{
dtFreeNavMeshQuery(m_navQuery);
dtFreeNavMesh(m_navMesh);
dtFreeCrowd(m_crowd);
delete m_tool;
for (int i = 0; i < MAX_TOOLS; i++)
delete m_toolStates[i];
}
示例12: dtFreeTileCache
void NavMesh::SetMesh(InputGeom* geom)
{
m_geom = geom;
dtFreeTileCache(m_tileCache);
m_tileCache = 0;
dtFreeNavMesh(m_navMesh);
m_navMesh = 0;
}
示例13: dtFreeTileCache
bool OgreDetourTileCache::initTileCache()
{
// BUILD TileCache
dtFreeTileCache(m_tileCache);
dtStatus status;
m_tileCache = dtAllocTileCache();
if (!m_tileCache)
{
m_recast->m_pLog->logMessage("ERROR: buildTiledNavigation: Could not allocate tile cache.");
return false;
}
status = m_tileCache->init(&m_tcparams, m_talloc, m_tcomp, m_tmproc);
if (dtStatusFailed(status))
{
m_recast->m_pLog->logMessage("ERROR: buildTiledNavigation: Could not init tile cache.");
return false;
}
dtFreeNavMesh(m_recast->m_navMesh);
m_recast->m_navMesh = dtAllocNavMesh();
if (!m_recast->m_navMesh)
{
m_recast->m_pLog->logMessage("ERROR: buildTiledNavigation: Could not allocate navmesh.");
return false;
}
// Init multi-tile navmesh parameters
dtNavMeshParams params;
memset(¶ms, 0, sizeof(params));
rcVcopy(params.orig, m_tcparams.orig); // Set world-space origin of tile grid
params.tileWidth = m_tileSize*m_tcparams.cs;
params.tileHeight = m_tileSize*m_tcparams.cs;
params.maxTiles = m_maxTiles;
params.maxPolys = m_maxPolysPerTile;
status = m_recast->m_navMesh->init(¶ms);
if (dtStatusFailed(status))
{
m_recast->m_pLog->logMessage("ERROR: buildTiledNavigation: Could not init navmesh.");
return false;
}
// Init recast navmeshquery with created navmesh (in OgreRecast component)
m_recast->m_navQuery = dtAllocNavMeshQuery();
status = m_recast->m_navQuery->init(m_recast->m_navMesh, 2048);
if (dtStatusFailed(status))
{
m_recast->m_pLog->logMessage("ERROR: buildTiledNavigation: Could not init Detour navmesh query");
return false;
}
return true;
}
示例14: dtFreeNavMesh
NavMeshLoader::~NavMeshLoader() {
if (m_navMesh)
{
dtFreeNavMesh(m_navMesh);
}
if (m_navQuery)
{
dtFreeNavMeshQuery(m_navQuery);
}
}
示例15: dtFreeNavMesh
//-------------------------------------------------------------------------------------
NavMeshHandle::~NavMeshHandle()
{
std::map<int, NavmeshLayer>::iterator iter = navmeshLayer.begin();
for(; iter != navmeshLayer.end(); ++iter)
{
dtFreeNavMesh(iter->second.pNavmesh);
dtFreeNavMeshQuery(iter->second.pNavmeshQuery);
}
DEBUG_MSG(fmt::format("NavMeshHandle::~NavMeshHandle(): ({}) is destroyed!\n", resPath));
}