本文整理汇总了C++中OffMeshConnection::DrawDebugGeometry方法的典型用法代码示例。如果您正苦于以下问题:C++ OffMeshConnection::DrawDebugGeometry方法的具体用法?C++ OffMeshConnection::DrawDebugGeometry怎么用?C++ OffMeshConnection::DrawDebugGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OffMeshConnection
的用法示例。
在下文中一共展示了OffMeshConnection::DrawDebugGeometry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawDebugGeometry
void DynamicNavigationMesh::DrawDebugGeometry(DebugRenderer* debug, bool depthTest)
{
if (!debug || !navMesh_ || !node_)
return;
const Matrix3x4& worldTransform = node_->GetWorldTransform();
const dtNavMesh* navMesh = navMesh_;
for (int z = 0; z < numTilesZ_; ++z)
{
for (int x = 0; x < numTilesX_; ++x)
{
// Get the layers from the tile-cache
const dtMeshTile* tiles[TILECACHE_MAXLAYERS];
int tileCount = navMesh->getTilesAt(x, z, tiles, TILECACHE_MAXLAYERS);
for (int i = 0; i < tileCount; ++i)
{
const dtMeshTile* tile = tiles[i];
if (!tile)
continue;
for (int i = 0; i < tile->header->polyCount; ++i)
{
dtPoly* poly = tile->polys + i;
for (unsigned j = 0; j < poly->vertCount; ++j)
{
debug->AddLine(
worldTransform * *reinterpret_cast<const Vector3*>(&tile->verts[poly->verts[j] * 3]),
worldTransform * *reinterpret_cast<const Vector3*>(&tile->verts[poly->verts[(j + 1) % poly->vertCount] * 3]),
Color::YELLOW,
depthTest
);
}
}
}
}
}
Scene* scene = GetScene();
if (scene)
{
// Draw Obstacle components
if (drawObstacles_)
{
PODVector<Node*> obstacles;
scene->GetChildrenWithComponent<Obstacle>(obstacles, true);
for (unsigned i = 0; i < obstacles.Size(); ++i)
{
Obstacle* obstacle = obstacles[i]->GetComponent<Obstacle>();
if (obstacle && obstacle->IsEnabledEffective())
obstacle->DrawDebugGeometry(debug, depthTest);
}
}
// Draw OffMeshConnection components
if (drawOffMeshConnections_)
{
PODVector<Node*> connections;
scene->GetChildrenWithComponent<OffMeshConnection>(connections, true);
for (unsigned i = 0; i < connections.Size(); ++i)
{
OffMeshConnection* connection = connections[i]->GetComponent<OffMeshConnection>();
if (connection && connection->IsEnabledEffective())
connection->DrawDebugGeometry(debug, depthTest);
}
}
// Draw NavArea components
if (drawNavAreas_)
{
PODVector<Node*> areas;
scene->GetChildrenWithComponent<NavArea>(areas, true);
for (unsigned i = 0; i < areas.Size(); ++i)
{
NavArea* area = areas[i]->GetComponent<NavArea>();
if (area && area->IsEnabledEffective())
area->DrawDebugGeometry(debug, depthTest);
}
}
}
}