本文整理汇总了C++中PortalLayout::getPath方法的典型用法代码示例。如果您正苦于以下问题:C++ PortalLayout::getPath方法的具体用法?C++ PortalLayout::getPath怎么用?C++ PortalLayout::getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PortalLayout
的用法示例。
在下文中一共展示了PortalLayout::getPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: coord
Vector<WorldCoordinates>* PathFinderManager::findPathFromCellToWorld(const WorldCoordinates& pointA, const WorldCoordinates& pointB, Zone *zone) {
Vector<WorldCoordinates>* path = new Vector<WorldCoordinates>(5, 1);
if (path == NULL)
return NULL;
path->add(pointA);
CellObject* ourCell = pointA.getCell();
ManagedReference<BuildingObject*> building = cast<BuildingObject*>( ourCell->getParent().get().get());
int ourCellID = ourCell->getCellNumber();
SharedObjectTemplate* templateObject = ourCell->getParent().get()->getObjectTemplate();
if (templateObject == NULL) {
delete path;
return NULL;
}
PortalLayout* portalLayout = templateObject->getPortalLayout();
if (portalLayout == NULL) {
delete path;
return NULL;
}
FloorMesh* sourceFloorMesh = portalLayout->getFloorMesh(ourCellID);
if (sourceFloorMesh == NULL) {
delete path;
return NULL;
}
PathGraph* sourcePathGraph = sourceFloorMesh->getPathGraph();
if (sourcePathGraph == NULL) {
delete path;
return NULL;
}
FloorMesh* exteriorFloorMesh = portalLayout->getFloorMesh(0);
if (exteriorFloorMesh == NULL) {
delete path;
return NULL;
}
PathGraph* exteriorPathGraph = exteriorFloorMesh->getPathGraph();
if (exteriorPathGraph == NULL) {
delete path;
return NULL;
}
// we need to move world position into model space
Vector3 transformedPosition = transformToModelSpace(pointB.getPoint(), building);
//find exit node in our cell
//PathNode* exitNode = sourcePathGraph->findNearestNode(pointA.getPoint());
TriangleNode* nearestTargetNodeTriangle = CollisionManager::getTriangle(pointA.getPoint(), sourceFloorMesh);
if (nearestTargetNodeTriangle == NULL) {
delete path;
return NULL;
}
PathNode* exitNode = CollisionManager::findNearestPathNode(nearestTargetNodeTriangle, sourceFloorMesh, transformedPosition);//targetPathGraph->findNearestNode(pointB.getPoint());
if (exitNode == NULL) {
delete path;
return NULL;
}
//find exterior node
PathNode* exteriorNode = exteriorPathGraph->findNearestGlobalNode(transformedPosition);
if (exteriorNode == NULL) {
delete path;
return NULL;
}
//find path to the exit
Vector<PathNode*>* exitPath = portalLayout->getPath(exitNode, exteriorNode);
if (exitPath == NULL) {
error("exitPath == NULL");
delete path;
return NULL;
}
//find triangle path to exitNode
Vector<Triangle*>* trianglePath = NULL;
int res = getFloorPath(pointA.getPoint(), exitNode->getPosition(), sourceFloorMesh, trianglePath);
if (res != -1 && trianglePath != NULL)
addTriangleNodeEdges(pointA.getPoint(), exitNode->getPosition(), trianglePath, path, ourCell);
if (trianglePath != NULL)
delete trianglePath;
//.........这里部分代码省略.........