How to build and export an FBX model from scratch ?I tried to draw a plane, but the exported model is empty! How to build a scene from scratch and export it ?
// Create an SDK manager.
FbxManager* lSdkManager = FbxManager::Create();
std::string newfile = R"(F:/fbxdata/test.fbx)";
// Create a new scene so it can be populated by the imported file.
FbxScene* newScene = FbxScene::Create(lSdkManager, "New Scene");
FbxNode* root = newScene->GetRootNode();
FbxNode* child = FbxNode::Create(newScene, "child");
{
FbxMesh* pMesh =FbxMesh::Create(newScene,"mesh") ;
pMesh->InitControlPoints(4);
FbxVector4* pCtrlPoint = pMesh->GetControlPoints();
FbxVector4 vertex0(-1, -1, 0);
FbxVector4 vertex1(-1, 1, 0);
FbxVector4 vertex2(1, 1, 0);
FbxVector4 vertex3(1, -1, 0);
pCtrlPoint[0] = vertex0;
pCtrlPoint[1] = vertex1;
pCtrlPoint[2] = vertex2;
pCtrlPoint[3] = vertex3;
pMesh->BeginPolygon();
pMesh->AddPolygon(0);
pMesh->AddPolygon(1);
pMesh->AddPolygon(2);
pMesh->EndPolygon();
pMesh->BeginPolygon();
pMesh->AddPolygon(2);
pMesh->AddPolygon(3);
pMesh->AddPolygon(0);
pMesh->EndPolygon();
child->AddNodeAttribute(pMesh);
}
root->AddChild(child);
ExportScene(lSdkManager, newScene, newfile.c_str());