Access Poly/Vert Count of Mesh

Software: Away3D 4.x

jrg716, Newbie
Posted: 17 March 2012 02:31 AM   Total Posts: 2

Is it possible to get the poly and vertex cout for a Mesh or ObjectContainer3D?  I didn’t see it in the documentation, but figured I must just be missing something.

Thanks!

   

Avatar
kurono, Sr. Member
Posted: 17 March 2012 02:36 AM   Total Posts: 103   [ # 1 ]
var mesh:Mes// your mesh!
// extract vertices data
var rawVerts:Vector.<Number> = mesh.geometry.subGeometries[0].vertexData;
   var 
verts:Vector.<Vector3D> = new Vector.<Vector3D>();
   var 
v:Vector3D;
   for (var 
i:int 0rawVerts.lengthi+=3{
    v 
= new Vector3D(rawVerts[i]rawVerts[i 1]rawVerts[i 2]);
    
verts.push(v);
   
}
   
// extract faces data
   
var rawFaces:Vector.<uint> = mesh.geometry.subGeometries[0].indexData;
   var 
faces:Vector.<Vector3D> = new Vector.<Vector3D>(); // x, y, z are vertices: 1, 2, 3
   
for (0rawFaces.lengthi+=3{
    v 
= new Vector3D(rawFaces[i]rawFaces[i 1]rawFaces[i 2]);
    
faces.push(v);
   

Lengths of “verts” and “faces” are total number of vertices and faces respectively.

   

jrg716, Newbie
Posted: 17 March 2012 02:37 AM   Total Posts: 2   [ # 2 ]

Cool!  Thanks for the quick response!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X