[T3D 1.0] Accessing TSShape Mesh data
by Shawn Kennedy · in Torque 3D Professional · 03/02/2011 (9:26 am) · 0 replies
Hello,
I'm trying to sort triangles for an object (derived from TSShape) by doing the following:
However, mesh->verts, mesh->normals, etc all have 0 elements. Anyone know what I could be doing wrong here?
Thanks.
I'm trying to sort triangles for an object (derived from TSShape) by doing the following:
void MyShape::sortTriangles()
{
Con::printf( "Sorting Triangles For %s", this->getShapeFileName() );
Resource<TSShape> rShape = this->getShape();
for( int mm = 0; mm < rShape->meshes.size(); mm++ ) //Once Per Mesh
{
int meshSize = rShape->meshes[mm]->getNumPolys();
// For no overlaps
bool* alreadyCounted = new bool[meshSize];
for( int i =0; i < meshSize; alreadyCounted[i++]=false);
{
TSMesh * mesh = rShape->meshes[mm];
//do some checking here if it's a skinmesh, i.e.:
TSSkinMesh* sMesh = dynamic_cast<TSSkinMesh*>(mesh);
Vector<Point3F>* vertexList = &mesh->verts;
// do sorting here, etc, etc
}
}
}However, mesh->verts, mesh->normals, etc all have 0 elements. Anyone know what I could be doing wrong here?
Thanks.