コード例 #1
0
bool TSShapeImport::import(TSShape* shape,ITRGeometry* geometry)
{
	//
	printf("TSShape Import\n");

	//
	VectorPtr<TSPartList*> partStack;
	partStack.push_back(dynamic_cast<TSPartList*>(shape));
	while (!partStack.empty()) {
		TSPartList& partList = *partStack.last();
		partStack.decrement();
		for (int i = 0; i < partList.getPartCount(); i++)
			if (TSPartList *pl = dynamic_cast<TSPartList*>(partList[i]))
				partStack.push_back(pl);
			else
				if (TSMesh* pm = dynamic_cast<TSMesh*>(partList[i])) {
					if (!import(pm,shape->getMaterialList(),geometry))
						return false;
				}
	}

	printf("   Vertices: %d\n",geometry->point3List.size());
	printf("   Surfaces: %d\n",geometry->surfaceList.size());
	printf("   Polygons: %d\n",geometry->polyList.size());
	printf("   Planes: %d\n",geometry->planeList.size());
	return true;
}