Quote:Original post by alagtriste
I don't get the code posted. You are resizing a vector to accomodate point data and then you are growing it with that same data.
Why not just do something along those lines:
*** Source Snippet Removed ***
I see no where in your code that it compares the vertices so you are completely missing the point of the code and when I run that code it loads for 5 minutes, expands my application's memory by over 600MBs then crashes...
Here is my code now btw:
int ControlPointCount = FBXMesh->GetControlPointsCount(); KFbxVector4* ControlPoints = FBXMesh->GetControlPoints(); AxVertex ZeroVertex = {0}; std::vector<AxVertex> vertices(ControlPointCount); std::vector<AxFace> faces; std::vector<int> attributes; for( int p = 0; p < FBXMesh->GetPolygonCount(); p++ ) { DWORD indices[4]; for( int i = 0; i < FBXMesh->GetPolygonSize(p); i++ ) { int vi = FBXMesh->GetPolygonVertex( p, i ); AxVertex vertex = {0}; KFbxVector4 normal; FBXMesh->GetPolygonVertexNormal( p, i, normal ); vertex.x = (float)ControlPoints[vi][0]; vertex.y = (float)ControlPoints[vi][1]; vertex.z = (float)ControlPoints[vi][2]; vertex.nx = (float)normal[0]; vertex.ny = (float)normal[1]; vertex.nz = (float)normal[2]; if( vertices[vi] != vertex && vertices[vi] != ZeroVertex ) { indices = vertices.size(); vertices.push_back( vertex ); } else { indices = (DWORD)vi; vertices[vi] = vertex; } } if(FBXMesh->GetPolygonSize(p) == 4) { AxFace face; face.indices[0] = indices[0]; face.indices[1] = indices[2]; face.indices[2] = indices[3]; faces.push_back( face ); attributes.push_back(1); } AxFace face; face.indices[0] = indices[0]; face.indices[1] = indices[1]; face.indices[2] = indices[2]; faces.push_back( face ); attributes.push_back(1); }