I am working with FBX SDK 2013.3 and project on DirectX .
I need some basic knowledge,
Think that i have a cube, exported from Maya with .fbx extension, it has animation but problem isn't that now.
Now i need Load this .fbx file to DirectX, so indices,vertex positions must be handle.
I looked FBX SDK Documentations, Samples ( mostly ViewScene sample ) and i obtain some information.
const char* lFilename = ".\..\..\..\DuzZemin.fbx";
/* Memory Management */
FbxManager* myManager = FbxManager::Create();
FbxIOSettings* ioSettings = FbxIOSettings::Create(myManager,IOSROOT);
myManager->SetIOSettings(ioSettings);
// Importer
FbxImporter* myImporter = FbxImporter::Create(myManager,"");
if( !myImporter->Initialize(lFilename,-1,ioSettings))
{
/* Error Handling */
}
/* Scene for Imported File */
FbxScene* myScene = FbxScene::Create(myManager,"My Scene");
myImporter->Import(myScene);
// Memory DeAllocation
myImporter->Destroy();
FbxNode* rootNode = myScene->GetRootNode();
FbxMesh* myMesh = FbxMesh::Create(myScene,"");
int indexCount = myMesh->GetControlPointsCount();
and when build this code snippet, i am not getting any error. But in runtime ,
indexCount return with 0 value.
Do you see any wrong or missed requirement ?
Thanks for interest.
Well you create a mesh, but you don't point it to a mesh in your scene. When i have loaded an .fbx file i create a mesh pointer and then go into my scene and grab the mesh. Consider this code.
FbxMesh* mesh;
FbxNode* node = myScene->GetRootNode()->GetChild(0);
//I want my mesh to be formed by triangles so i convert the mesh into triangles
FbxGeometryConverter lConverter(node->GetFbxManager());
lConverter.TriangulateInPlace(node);
mesh = node->GetMesh();
now you should be able to get a correct vertex count from your mesh, and be able to extract the vertices. NOTE: If your .fbx file consist of more than one mesh then you would need to iterate thru the scene untill you find the desired mesh.
Hope this helps