예제 #1
0
TextureData::TextureData(void)
{
	//Textures = ListContainer();
	textureId = -1;

	// Add to texture list
	Textures.Add(this);
}
예제 #2
0
파일: Brush.cpp 프로젝트: ultradr3mer/Flow
// Generate Subtriangles for each Face
void Brush::PerformIntersections(ListContainer<SimpleTriangle>* resultingTriangles)
{
	ListContainer<SimpleTriangle>* subTriangles;

	if(!PerformedIntersections)
	{
		ListContainer<MapTriangle> IntersectionTriangles;
		IntersectionTriangles.PerformCleanup = false;
		ListContainer<MapTriangle>* curTriangles;
		bool isHidden;
		vec3 curCenter;
		float threshold = 0.01f;

		// Make a Local list with possible intersections
		IntersectingBrushes.InitReader();
		while(IntersectingBrushes.Read())
		{
			curTriangles = &IntersectingBrushes.Cur->Triangles;
			curTriangles->InitReader();
			while(curTriangles->Read())
			{
				IntersectionTriangles.Add(curTriangles->Cur);
			}
		}

		// Perform Operations Per Triangle
		Triangles.GetIndex();
		for (int i = 0; i < Triangles.Length; i++)
		{
			Triangles.Index[i]->GenerateSubTriangles(&IntersectionTriangles);

			// Perform Operations Per Sub Triangle
			subTriangles = &Triangles.Index[i]->SubTriangles;
			subTriangles->GetIndex();
			int currentLength = subTriangles->Length;
			for (int j = 0; j < currentLength; j++)
			{
				//Visibility Testing
				isHidden = false;
				curCenter = subTriangles->Index[j]->Center();
				curCenter += subTriangles->Index[j]->Normal()*threshold;
				IntersectingBrushes.InitReader();
				while (IntersectingBrushes.Read())
				{
					if(IntersectingBrushes.Cur->PointTest(curCenter))
					{
						subTriangles->RemoveDelete(subTriangles->Index[j]);
						break;
					}
				}
			}
		}
		PerformedIntersections = true;
	}

	// Return Subtriangles
	Triangles.InitReader();
	while(Triangles.Read())
	{
		subTriangles = &Triangles.Cur->SubTriangles;
		subTriangles->InitReader();
		while(subTriangles->Read())
		{
			resultingTriangles->Add(subTriangles->Cur->Copy());
		}
	}
}