本文整理汇总了C++中MeshRenderer::RenderMesh2D方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshRenderer::RenderMesh2D方法的具体用法?C++ MeshRenderer::RenderMesh2D怎么用?C++ MeshRenderer::RenderMesh2D使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshRenderer
的用法示例。
在下文中一共展示了MeshRenderer::RenderMesh2D方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderDebugPathMeshOnMap2D
//.........这里部分代码省略.........
Vertex3Ds inPathVerts;
inPathVerts.clear();
Tile* pathingTile = NULL;
//render start/goal/open tiles
if (map && !pathToRender.IsOpenListEmpty()){
//render start tile
pathingTile = map->GetTileAtMapPosition(pathToRender.m_startPosition);
GenerateVertexArrayTextureQuad(inPathVerts, pathingTile->m_renderBounds, AABB2::ZERO_TO_ONE, Rgba::SILVER, false);
//render goal tile
pathingTile = map->GetTileAtMapPosition(pathToRender.m_goalPosition);
GenerateVertexArrayTextureQuad(inPathVerts, pathingTile->m_renderBounds, AABB2::ZERO_TO_ONE, Rgba::GOLD, false);
if (pathToRender.m_activeNode){
pathingTile = map->GetTileAtMapPosition(pathToRender.m_activeNode->m_position);
GenerateVertexArrayTextureQuad(inPathVerts, pathingTile->m_renderBounds, AABB2::ZERO_TO_ONE, Rgba::MAGENTA, false);
//OUTPUT_COLOR_STRING_TO_SCREEN(IntToString(pathToRender.m_activeNode->m_nodeCost.f), pathingTile->m_renderBounds.mins.x, pathingTile->m_renderBounds.maxs.y, Rgba::GOLD);
}
static Rgba openListColor = Rgba::BLUE;
openListColor.a = 127;
for (OpenListPathMapIterator it = pathToRender.m_openList.begin(); it != pathToRender.m_openList.end(); ++it){
PathNode& pathnode = *(it->second);
pathingTile = map->GetTileAtMapPosition(pathnode.m_position);
GenerateVertexArrayTextureQuad(inPathVerts, pathingTile->m_renderBounds, AABB2::ZERO_TO_ONE, openListColor , false);
//OUTPUT_COLOR_STRING_TO_SCREEN(IntToString(pathnode.m_nodeCost.f), pathingTile->m_renderBounds.mins.x, pathingTile->m_renderBounds.maxs.y, Rgba::GOLD);
}
}
//create path mesh for all of closed list
if (map && pathToRender.m_closedList.size() > 1 ){
static Rgba closedListColor = Rgba::RED;
closedListColor.a = 127;
for (ClosedListIterator it = pathToRender.m_closedList.begin() + 1; it != pathToRender.m_closedList.end() - 1; ++it){
PathNode& pathnode = (*it);
pathingTile = map->GetTileAtMapPosition(pathnode.m_position);
GenerateVertexArrayTextureQuad(inPathVerts, pathingTile->m_renderBounds, AABB2::ZERO_TO_ONE, closedListColor, false);
//OUTPUT_COLOR_STRING_TO_SCREEN(IntToString(pathnode.m_nodeCost.f), pathingTile->m_renderBounds.mins.x, pathingTile->m_renderBounds.maxs.y, Rgba::GOLD);
}//end of for
if (pathToRender.m_isImpossible){
return;
}
static Rgba pathColor = Rgba::GREEN;
pathColor.a = 210;
//Create path mesh for only path
ClosedListIterator mypathIterator = pathToRender.m_closedList.end() - 1;
PathNode& myPathGoalNode = (*mypathIterator);
//start traversing from goal back to start
PathNode* traversalPathNode = &myPathGoalNode;
//traversalPathNode = traversalPathNode->m_parent;
//create last closed node added
pathingTile = map->GetTileAtMapPosition(traversalPathNode->m_position);
GenerateVertexArrayTextureQuad(inPathVerts, pathingTile->m_renderBounds, AABB2::ZERO_TO_ONE, pathColor, false);
if (traversalPathNode->m_parent != NULL)
traversalPathNode = traversalPathNode->m_parent;
//create path
while (traversalPathNode->m_parent != NULL){
pathingTile = map->GetTileAtMapPosition(traversalPathNode->m_position); //has an infinite loop in certain cases
GenerateVertexArrayTextureQuad(inPathVerts, pathingTile->m_renderBounds, AABB2::ZERO_TO_ONE, pathColor, false);
//OUTPUT_COLOR_STRING_TO_SCREEN(IntToString(traversalPathNode->m_nodeCost.f), pathingTile->m_renderBounds.mins.x, pathingTile->m_renderBounds.maxs.y, Rgba::WHITE);
traversalPathNode = traversalPathNode->m_parent;
}//end of while
}//end of outer if
//copy all verts to mesh
pathMeshRenderer.m_mesh->CopyMeshVertexData(inPathVerts);
pathMeshRenderer.RenderMesh2D(&mapToWorldTransform);
inPathVerts.clear();
}