49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
// external
|
|
#include <stdio.h>
|
|
// buz
|
|
#include <fbx_wrap.h>
|
|
|
|
using namespace std;
|
|
|
|
extern "C" {
|
|
// 定义给Rust调用的接口函数
|
|
void fbx_parse(const FttContext* ctx)
|
|
{
|
|
printf("%s\n", ctx->fbx_file);
|
|
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(ctx->fbx_file, -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(ctx, lRootNode, 0);
|
|
} else {
|
|
printf("No root node found in the scene.\n");
|
|
}
|
|
}
|
|
|
|
void load_fbx_mesh_to_db(const FttContext* ctx)
|
|
{
|
|
FbxNode* root = get_fbx_root_node(ctx->fbx_file);
|
|
each_node(ctx, root, 0);
|
|
}
|
|
}
|