示例#1
0
void Polygroup::addPoly(const Poly& poly)
{
	bool add(true);
	int polyX(poly.getPoint(0).x), polyZ(poly.getPoint(0).z);
	for(std::vector<Poly>::iterator gridIt(grid[polyX][polyZ].begin());gridIt!=grid[polyX][polyZ].end();++gridIt)
	{
		if((*gridIt)==poly)
		{
			add=false;
		}
	}

	if(add){
		grid[polyX][polyZ].push_back(poly);
		lowEfficientPolys.push_back(poly);
		if(!initialSetup)
		{
			//create a new thread and run the polygon reduction again

		}
		else
		{
			highEfficientPolys.push_back(poly);
		}
	}
}
示例#2
0
void Polygroup::removePoly(const Poly& poly)
{
	int polyX(poly.getPoint(0).x), polyZ(poly.getPoint(0).z);

	//Remove poly from the grid
	for(std::vector<Poly>::iterator gridIt(grid[polyX][polyZ].begin());gridIt!=grid[polyX][polyZ].end();++gridIt)
	{
		if((*gridIt)==poly)
		{
			grid[polyX][polyZ].erase(gridIt);
		}
	}
	
	//Remove poly from the low efficiency poly list
	for(std::vector<Poly>::iterator lowIt(lowEfficientPolys.begin());lowIt!=lowEfficientPolys.end();++lowIt)
	{
		if((*lowIt)==poly)
		{
			lowEfficientPolys.erase(lowIt);
		}
	}

	if(!initialSetup)
	{
		//create a new thread and run the polygon reduction again
	}
}