Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® FBX® / FBX SDK / FBX SDK and DirectX
  RSS 2.0 ATOM  

FBX SDK and DirectX
Rate this thread
 
57752
 
Permlink of this thread  
avatar
  • Total Posts: 1
  • Joined: 07 July 2011 09:44 AM

I’m trying to import FBX models to my DirectX 10 project using the FBX SDK.
This is what I have so far…

Vertexvertices;
   
vertices = new Vertex[numVertices];
        
std::vector<intindices;

        
KFbxSdkManagerlSdkManager KFbxSdkManager::Create();
        
KFbxIOSettings *ios KFbxIOSettings::Create(lSdkManagerIOSROOT);
        
lSdkManager->SetIOSettings(ios);

        
KFbxGeometryConverter lGConverter(lSdkManager);

        
// Create an importer using our sdk manager.
        
KFbxImporterlImporter KFbxImporter::Create(lSdkManager,"");

        
lImporter->Initialize(lFilename, -1lSdkManager->GetIOSettings());

        
// Create a new scene so it can be populated by the imported file.
        
KFbxScenelScene KFbxScene::Create(lSdkManager,"myScene");

        
// Import the contents of the file into the scene.
        
lImporter->Import(lScene);

        
//Split meshes per material so each mesh only uses one texture
        
lGConverter.SplitMeshesPerMaterial(lScene);

        
KFbxNodelRootNode lScene->GetRootNode();
        
KFbxNodelNode NULL;
        
KFbxMeshlMesh NULL;
        if(
lRootNode)
        
{
                
if(lRootNode->GetNodeAttribute() != NULL)
                
{
                        
for(int k 0lRootNode->GetNodeAttributeCount(); k++)
                        
{
                                lMesh 
= (KFbxMesh*) lRootNode->GetNodeAttributeByIndex(k);
                
lMesh lGConverter.TriangulateMesh(lMesh);

                                for(
int i 0lMesh->GetControlPointsCount(); i++)
                                
{
                                        vertices
.pos lMesh->GetControlPointAt(i);
                        
vertices.normal //how to get normal???
                        
vertices.tangent //how to get tangent???
                        
vertices.texC //how to get texture coordinates???
                                
}

                
for(int i 0lMesh->GetPolygonVertexCount(); i++)
                                
{
                                indices
.push_back(lMesh->GetPolygonVertices()[i]);
                                
}
                        }
                }

                
for(int i 0lRootNode->GetChildCount(); i++)
                
{
                        lNode 
lRootNode->GetChild(i);

                        if(
lNode->GetNodeAttribute() != NULL)
                        
{
                                
for(int k 0lNode->GetNodeAttributeCount(); k++)
                                
{
                                        lMesh 
= (KFbxMesh*) lNode->GetNodeAttributeByIndex(k);
                        
lMesh lGConverter.TriangulateMesh(lMesh);
                        
vertices = new Vertex[lMesh->GetControlPointsCount()];

                        for(
int i 0lMesh->GetControlPointsCount(); i++)
                                
{
                                                vertices
.pos lMesh->GetControlPointAt(i);
                                
vertices.normal //how to get normal???
                             
vertices.tangent //how to get tangent???
                             
vertices.texC //how to get texture coordinates???
                                
}

                                        
for(int i 0lMesh->GetPolygonVertexCount(); i++)
                                        
{
                                                indices
.push_back(lMesh->GetPolygonVertices()[i]);
                                        
}
                                }
                        }
                }
        }

The problems I’m having is basically how to get the normals, tangents and texture coordinates of each vertex…



Replies: 1
/userdata/avatar/3yvwf23us_doug100x100.png

Those are in the layers.

Author: Doug Rogers

Replied: 11 July 2011 04:37 AM