int main(int argc, char* argv[]) { #ifdef VTKOSGCONVERTER_FOUND OSG::osgInit(argc, argv); #endif #ifdef VTKFBXCONVERTER_FOUND InitializeSdkObjects(lSdkManager, lScene); #endif LOGOG_INITIALIZE(); logog::Cout* logogCout = new logog::Cout; BaseLib::LogogSimpleFormatter* formatter = new BaseLib::LogogSimpleFormatter; logogCout->SetFormatter(*formatter); QApplication a(argc, argv); QApplication::setApplicationName("OpenGeoSys - Data Explorer"); QApplication::setApplicationVersion(QString(OGS_VERSION)); QApplication::setOrganizationName("OpenGeoSys Community"); QApplication::setOrganizationDomain("opengeosys.org"); setlocale(LC_NUMERIC,"C"); MainWindow* w = new MainWindow(); w->setWindowTitle( w->windowTitle() + " - " + QString(OGS_VERSION_AND_PERSONS) + " - FirstFloor"); w->show(); int returncode = a.exec(); delete w; delete formatter; delete logogCout; LOGOG_SHUTDOWN(); #ifdef VTKFBXCONVERTER_FOUND DestroySdkObjects(lSdkManager); #endif #ifdef VTKOSGCONVERTER_FOUND OSG::osgExit(); #endif return returncode; }
bool Build_FBX_Model( const double* geo_transform, const std::string& output_pathname ) { // Create the model FbxManager* sdk_manager = NULL; FbxScene* scene = NULL; InitializeSdkObjects( sdk_manager, scene ); // Register our new mesh // Save the scene const char* opath = output_pathname.c_str(); bool result = SaveScene( sdk_manager, scene, opath ); // Clean up DestroySdkObjects( sdk_manager, result ); }
void BImporter::initImporter() { lSdkManager = NULL; lScene = NULL; // Prepare the FBX SDK. InitializeSdkObjects(lSdkManager, lScene); }
HRESULT CFBXLoader::LoadFBX(const char* filename, const eAXIS_SYSTEM axis) { if(!filename) return E_FAIL; HRESULT hr = S_OK; InitializeSdkObjects( mSdkManager, mScene ); if(!mSdkManager) return E_FAIL; // インポータ作成 int lFileFormat = -1; mImporter = FbxImporter::Create(mSdkManager,""); if (!mSdkManager->GetIOPluginRegistry()->DetectReaderFileFormat(filename, lFileFormat) ) { // Unrecognizable file format. Try to fall back to FbxImporter::eFBX_BINARY lFileFormat = mSdkManager->GetIOPluginRegistry()->FindReaderIDByDescription( "FBX binary (*.fbx)" );; } // Initialize the importer by providing a filename. if(!mImporter || mImporter->Initialize(filename, lFileFormat) == false) return E_FAIL; // if( !mImporter || mImporter->Import(mScene) == false ) return E_FAIL; FbxAxisSystem OurAxisSystem = FbxAxisSystem::DirectX; if(axis==eAXIS_OPENGL) OurAxisSystem = FbxAxisSystem::OpenGL; // DirectX系 FbxAxisSystem SceneAxisSystem = mScene->GetGlobalSettings().GetAxisSystem(); if(SceneAxisSystem != OurAxisSystem) { FbxAxisSystem::DirectX.ConvertScene(mScene); } // 単位系の統一 // 不要でもいいかも FbxSystemUnit SceneSystemUnit = mScene->GetGlobalSettings().GetSystemUnit(); if( SceneSystemUnit.GetScaleFactor() != 1.0 ) { // センチメーター単位にコンバートする FbxSystemUnit::cm.ConvertScene( mScene ); } // 三角形化(三角形以外のデータでもコレで安心) TriangulateRecursive(mScene->GetRootNode()); Setup(); return hr; }
void SceneContext::Init( GVScene* pMOScene, GXLPCWSTR pFileName) { m_matGlobal.identity(); if (m_FileName == NULL) { return; } char szFilenameUtf8[MAX_PATH / 2 * 3]; // Utf8 对于 Unicode16 转换的结果可能在 1~3 字节之间 memset(szFilenameUtf8, 0, MAX_PATH / 2 * 3); WideCharToMultiByte(CP_UTF8, 0, pFileName, GXSTRLEN(pFileName), szFilenameUtf8, MAX_PATH / 2 * 3, NULL, NULL); // initialize cache start and stop time mCache_Start = FBXSDK_TIME_INFINITE; mCache_Stop = FBXSDK_TIME_MINUS_INFINITE; // Create the FBX SDK manager which is the object allocator for almost // all the classes in the SDK and create the scene. InitializeSdkObjects(mSdkManager, mScene); if (mSdkManager) { // Create the importer. int lFileFormat = -1; mImporter = FbxImporter::Create(mSdkManager,""); if (!mSdkManager->GetIOPluginRegistry()->DetectReaderFileFormat(WS2AS(m_FileName), lFileFormat) ) { // Unrecognizable file format. Try to fall back to FbxImporter::eFBX_BINARY lFileFormat = mSdkManager->GetIOPluginRegistry()->FindReaderIDByDescription( "FBX binary (*.fbx)" );; } // Initialize the importer by providing a filename. if(mImporter->Initialize(szFilenameUtf8, lFileFormat) == true) { // The file is going to be imported at // the end of the first display callback. mWindowMessage = "Importing file "; mWindowMessage += WS2AS(m_FileName); mWindowMessage += "\nPlease wait!"; // Set scene status flag to ready to load. mStatus = MUST_BE_LOADED; } else { mWindowMessage = "Unable to open file "; mWindowMessage += WS2AS(m_FileName); mWindowMessage += "\nError reported: "; mWindowMessage += mImporter->GetLastErrorString(); mWindowMessage += "\nEsc to exit"; } } else { mWindowMessage = "Unable to create the FBX SDK manager"; mWindowMessage += "\nEsc to exit"; } TRACE("%s\n", (const char*)mWindowMessage); }
bool ofxFBXScene::load(string path){ bool lResult; // Prepare the FBX SDK. InitializeSdkObjects(lSdkManager, lScene); lResult = LoadScene(lSdkManager, lScene, ofToDataPath(path).c_str()); if(!lResult){ ofLogError("ofxFBXScene") << "An error occurred while loading the scene..."; }else if(lScene){ for (int i = 0; i < lScene->GetSrcObjectCount<FbxAnimStack>(); i++) { FbxAnimStack* lAnimStack = FbxCast<FbxAnimStack>(lScene->GetSrcObject<FbxAnimStack>(i)); int l; int nbAnimLayers = lAnimStack->GetMemberCount<FbxAnimLayer>(); /*for (l = 0; l < nbAnimLayers; l++) {*/ if(nbAnimLayers){ FbxAnimLayer* lAnimLayer = lAnimStack->GetMember<FbxAnimLayer>(0); //get root node of the fbx scene FbxNode* lRootNode = lScene->GetRootNode(); parseScene(lRootNode, lAnimLayer,NULL); } } list<ofxFBXCamera>::iterator itCameras; for(itCameras=camerasList.begin();itCameras!=camerasList.end();itCameras++){ cameras.push_back(&(*itCameras)); } list<ofxFBXMesh>::iterator itMeshes; for(itMeshes=meshesList.begin();itMeshes!=meshesList.end();itMeshes++){ meshes.push_back(&(*itMeshes)); } list<ofxFBXNode>::iterator itNulls; for(itNulls=nullsList.begin();itNulls!=nullsList.end();itNulls++){ nulls.push_back(&(*itNulls)); } list<ofxFBXLight>::iterator itLights; for(itLights=lightsList.begin();itLights!=lightsList.end();itLights++){ lights.push_back(&(*itLights)); } }else{ ofLogError("ofxFBXScene") << "Null scene..."; lResult = false; } //Destroy all objects created by the FBX SDK. //DestroySdkObjects(lSdkManager,false); return lResult; }
int main(int argc, char* argv[]) { #ifdef VTKOSGCONVERTER_FOUND OSG::osgInit(argc, argv); #endif #ifdef VTKFBXCONVERTER_FOUND InitializeSdkObjects(lSdkManager, lScene); #endif auto myOutputWindow = vtkSmartPointer<VtkConsoleOutputWindow>::New(); vtkOutputWindow::SetInstance(myOutputWindow); LOGOG_INITIALIZE(); logog::Cout* logogCout = new logog::Cout; BaseLib::LogogSimpleFormatter* formatter = new BaseLib::LogogSimpleFormatter; logogCout->SetFormatter(*formatter); QApplication a(argc, argv); QApplication::setApplicationName("OpenGeoSys - Data Explorer"); QApplication::setApplicationVersion(QString::fromStdString( BaseLib::BuildInfo::ogs_version)); QApplication::setOrganizationName("OpenGeoSys Community"); QApplication::setOrganizationDomain("opengeosys.org"); setlocale(LC_NUMERIC,"C"); QLocale::setDefault(QLocale::German); std::unique_ptr<MainWindow> w (new MainWindow()); w->setWindowTitle( w->windowTitle() + " - " + QString::fromStdString(BaseLib::BuildInfo::git_describe)); if (QCoreApplication::arguments().size()>1) { w->loadFileOnStartUp(QCoreApplication::arguments().at(1)); } w->show(); int returncode = a.exec(); delete formatter; delete logogCout; LOGOG_SHUTDOWN(); #ifdef VTKFBXCONVERTER_FOUND DestroySdkObjects(lSdkManager, true); #endif #ifdef VTKOSGCONVERTER_FOUND OSG::osgExit(); #endif return returncode; }
int main(int argc, char** argv) { KFbxSdkManager* lSdkManager = NULL; KFbxScene* lScene = NULL; bool lResult; // Prepare the FBX SDK. InitializeSdkObjects(lSdkManager, lScene); // Create the scene. lResult = CreateScene(lSdkManager, lScene); if(lResult == false) { printf("\n\nAn error occurred while creating the scene...\n"); DestroySdkObjects(lSdkManager); return 0; } // Save the scene. // The example can take an output file name as an argument. if(argc > 1) { lResult = SaveScene(lSdkManager, lScene, argv[1]); } // A default output file name is given otherwise. else { lResult = SaveScene(lSdkManager, lScene, SAMPLE_FILENAME); } if(lResult == false) { printf("\n\nAn error occurred while saving the scene...\n"); DestroySdkObjects(lSdkManager); return 0; } // Destroy all objects created by the FBX SDK. DestroySdkObjects(lSdkManager); return 0; }
int main (int argc, char** argv) { FbxManager* fbxManager = NULL; FbxScene* lScene = NULL; // Prepare the FBX SDK. InitializeSdkObjects(fbxManager); std::vector<std::string> fileNamesForImport = GetFbxFileNamesForImport(); bool EXPORT_ALL_TO_ONE_FOLDER = true; for (unsigned int i = 0; i < fileNamesForImport.size(); ++i) { std::string fbxFileName = fileNamesForImport[i]; Scene* scene = ParseScene(fbxManager, IMPORT_PATH + fbxFileName); scene->DEBUG_ExportNamesOfAllObjectsInScene(); if (!EXPORT_ALL_TO_ONE_FOLDER) { std::string exportFolderName = fbxFileName.substr(0, fbxFileName.find(".")); FileUtilities::CreateFolder(EXPORT_PATH_BASE + exportFolderName); FileUtilities::CreateFolder(EXPORT_PATH_BASE + exportFolderName + "/" EXPORT_FOLDER_MODELS); FileUtilities::CreateFolder(EXPORT_PATH_BASE + exportFolderName + "/" EXPORT_FOLDER_ANIMCLIPS); ExportSceneToModelFiles(scene, EXPORT_PATH_BASE + exportFolderName + "/"); } else { FileUtilities::CreateFolder(EXPORT_PATH_BASE); FileUtilities::CreateFolder(EXPORT_PATH_BASE EXPORT_FOLDER_MODELS); FileUtilities::CreateFolder(EXPORT_PATH_BASE EXPORT_FOLDER_ANIMCLIPS); ExportSceneToModelFiles(scene, EXPORT_PATH_BASE); } } //Destroy all objects created by the FBX SDK. DestroySdkObjects(fbxManager, true); std::cin.get(); return 0; }