当前位置: 首页>>代码示例>>C++>>正文


C++ Path::IsOpenListEmpty方法代码示例

本文整理汇总了C++中Path::IsOpenListEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::IsOpenListEmpty方法的具体用法?C++ Path::IsOpenListEmpty怎么用?C++ Path::IsOpenListEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Path的用法示例。


在下文中一共展示了Path::IsOpenListEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RecursiveCalcPath

//much slower than the regular one
void RecursiveCalcPath(Path& thePath, Map* map, const IntVec2& start, const IntVec2& goal, bool ignoreEntities){
	PROFILE_SECTION();
	if (!thePath.m_initialized && map){
		thePath = Path(map, start, goal); //this adds a start node to open list
	}
	
	if (!thePath.IsOpenListEmpty() && !thePath.m_isComplete){
		thePath = ProcessOneStepOfPath(thePath, map, start, goal, ignoreEntities);

		RecursiveCalcPath(thePath, map, start, goal, ignoreEntities);

	}
	else{

		return;

	}


}
开发者ID:achen889,项目名称:Warlockery_Engine,代码行数:21,代码来源:Pathfinder.cpp

示例2: RenderDebugPathMeshOnMap2D

void RenderDebugPathMeshOnMap2D(OpenGLRenderer* renderer, MeshRenderer& pathMeshRenderer, Path& pathToRender, Map* map){
	UNUSED(renderer);
	//renderer->SetTextureViewTransparent();

	ModelViewMatrix& mapToWorldTransform = map->m_mapToWorldTransformMatrix;

	//set mesh renderer
	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
//.........这里部分代码省略.........
开发者ID:achen889,项目名称:Warlockery_Engine,代码行数:101,代码来源:Pathfinder.cpp


注:本文中的Path::IsOpenListEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。