Counting Polygons
Blitz3D Forums/Blitz3D Programming/Counting Polygons
| ||
| Is there anyway in blitz to count the number of polygons in a loaded 3ds file? |
| ||
| Just iterate through all the surfaces in the mesh and use CountTriangles() on them. |
| ||
| you could hide all other meshes, do a renderworld and then check TrisRendered() ALternatively you could also use a second camera that is way off the scene, clone the mesh, position it in front of that far-away camera and do the same as I said before. The most complicaed method may be to parse all surfaces and count the triangles. Well, maybe it even isn't that complicated. |
| ||
Pretty simple.
Function CountMeshTriangles(Mesh)
Local Tris = 0
For i = 1 To CountSurfaces(Mesh)
Tris = Tris + CountTriangles(GetSurface(Mesh, i))
Next
Return Tris
End Function
(Untested) |
| ||
| If it's loaded with LoadMesh then ok. But if it's loaded with LoadAnimMesh then you need to parse the children recursively. |
| ||
| Example 3 does it here: http://www.blitzbasic.com/codearcs/codearcs.php?code=796 |