// external #include // buz #include #include using namespace std; extern "C" { // 定义给Rust调用的接口函数 void fbx_parse(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( FttContext* ctx) { // get mutable data auto temp = ctx_from_const(ctx); FttContext* mut_ctx = &temp; // 按fbx名称生成 ${ctx.out_dir}/sqlite3.db // 初始化db赋值到ctx.db sqlite3* db = create_db((std::string(ctx->out_dir) + "/db.sqlite3").c_str(), true); if (db == NULL) { return; } mut_ctx->db = db; // init db tables create_tables(mut_ctx->db); FbxNode* root = get_fbx_root_node(ctx->fbx_file); each_node(mut_ctx, root, 0); } }