fbx_to_3dtiles/cpp_src/fbx_parse.cpp

50 lines
1.3 KiB
C++

// external
#include <stdio.h>
// buz
#include <fbx_wrap.h>
using namespace std;
extern "C" {
// 定义给Rust调用的接口函数
void fbx_parse(const char* fbx_path)
{
printf("%s\n", fbx_path);
FbxManager* lSdkManager = FbxManager::Create();
if (lSdkManager){
printf("FbxManager created\n");
} else{
printf("FbxManager creation failed.\n");
}
FbxScene* lScene = FbxScene::Create(lSdkManager, "myScene");
if (lScene){
printf("FbxScene created\n");
} else{
printf("FbxScene creation failed.\n");
}
FbxImporter* lImporter = FbxImporter::Create(lSdkManager, "");
bool s = lImporter->Initialize(fbx_path, -1, lSdkManager->GetIOSettings());
if (s){
printf("FbxImporter initialized\n");
} else{
printf("FbxImporter initialization failed.\n");
}
lImporter->Import(lScene);
lImporter->Destroy();
FbxNode* lRootNode = lScene->GetRootNode();
if (lRootNode) {
each_node(lRootNode, 0);
} else {
printf("No root node found in the scene.\n");
}
}
void load_fbx_mesh_to_db(const char* fbx_path)
{
FbxNode* root = get_fbx_root_node(fbx_path);
each_node(root, 0);
}
}