//ロードしていろいろ初期化 HRESULT FBX::Load(std::string fileName) { //マネージャを生成 FbxManager* pFbxManager = FbxManager::Create(); //インポーターを生成 FbxImporter* fbxImporter = FbxImporter::Create(pFbxManager, "imp"); fbxImporter->Initialize(fileName.c_str(), -1, pFbxManager->GetIOSettings()); //シーンオブジェクトにFBXファイルの情報を流し込む FbxScene* pFbxScene = FbxScene::Create(pFbxManager, "fbxscene"); fbxImporter->Import(pFbxScene); fbxImporter->Destroy(); //メッシュ情報を取得 FbxNode* rootNode = pFbxScene->GetRootNode(); FbxNode* pNode = rootNode->GetChild(0); FbxMesh* mesh = pNode->GetMesh(); //各情報の個数を取得 vertexCount_ = mesh->GetControlPointsCount(); //頂点の数 polygonCount_ = mesh->GetPolygonCount(); //ポリゴンの数 materialCount_ = pNode->GetMaterialCount(); fs::path cPath, basePath; cPath = fs::current_path(); basePath = cPath; string subDir("Assets"); //Assetsフォルダまでのフルパスを生成する fs::path subPath(cPath.string() + "\\" + subDir); assert(fs::exists(subPath)); //カレントディレクトリを移動 fs::current_path(subPath); InitVertex(mesh); InitIndex(mesh); InitConstantBuffer(); InitMaterial(pNode); //カレントパスをもとどおりにもどす fs::current_path(basePath); //マネージャ解放 pFbxManager->Destroy(); return S_OK; }