diff --git a/code/AssetLib/USD/USDLoaderImplTinyusdz.cpp b/code/AssetLib/USD/USDLoaderImplTinyusdz.cpp index 9416e5c1c..379499134 100644 --- a/code/AssetLib/USD/USDLoaderImplTinyusdz.cpp +++ b/code/AssetLib/USD/USDLoaderImplTinyusdz.cpp @@ -60,7 +60,6 @@ Copyright (c) 2006-2024, assimp team #include #include -#include "tydra/render-data.hh" #include "tydra/scene-access.hh" #include "tydra/shader-network.hh" #include "USDLoaderImplTinyusdz.h" @@ -105,17 +104,24 @@ void USDImporterImplTinyusdz::InternReadFile( // Export meshes for (size_t i = 0; i < pScene->mNumMeshes; i++) { pScene->mMeshes[i] = new aiMesh(); - pScene->mMeshes[i]->mNumVertices = render_scene.meshes[i].points.size(); - pScene->mMeshes[i]->mVertices = new aiVector3D[pScene->mMeshes[i]->mNumVertices]; - for (size_t j = 0; j < pScene->mMeshes[i]->mNumVertices; ++j) { - pScene->mMeshes[i]->mVertices[j].x = render_scene.meshes[i].points[j][0]; - pScene->mMeshes[i]->mVertices[j].y = render_scene.meshes[i].points[j][1]; - pScene->mMeshes[i]->mVertices[j].z = render_scene.meshes[i].points[j][2]; - } + verticesForMesh(render_scene, pScene, i); pScene->mRootNode->mMeshes[i] = static_cast(i); } } +void USDImporterImplTinyusdz::verticesForMesh( + const tinyusdz::tydra::RenderScene &render_scene, + aiScene *pScene, + size_t meshIdx) { + pScene->mMeshes[meshIdx]->mNumVertices = render_scene.meshes[meshIdx].points.size(); + pScene->mMeshes[meshIdx]->mVertices = new aiVector3D[pScene->mMeshes[meshIdx]->mNumVertices]; + for (size_t j = 0; j < pScene->mMeshes[meshIdx]->mNumVertices; ++j) { + pScene->mMeshes[meshIdx]->mVertices[j].x = render_scene.meshes[meshIdx].points[j][0]; + pScene->mMeshes[meshIdx]->mVertices[j].y = render_scene.meshes[meshIdx].points[j][1]; + pScene->mMeshes[meshIdx]->mVertices[j].z = render_scene.meshes[meshIdx].points[j][2]; + } +} + } // namespace Assimp #endif // !! ASSIMP_BUILD_NO_USD_IMPORTER diff --git a/code/AssetLib/USD/USDLoaderImplTinyusdz.h b/code/AssetLib/USD/USDLoaderImplTinyusdz.h index 5ac99f241..b48acdb68 100644 --- a/code/AssetLib/USD/USDLoaderImplTinyusdz.h +++ b/code/AssetLib/USD/USDLoaderImplTinyusdz.h @@ -50,6 +50,7 @@ Copyright (c) 2006-2024, assimp team #include #include #include "tinyusdz.hh" +#include "tydra/render-data.hh" namespace Assimp { class USDImporterImplTinyusdz { @@ -61,6 +62,11 @@ public: const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler); + + void verticesForMesh( + const tinyusdz::tydra::RenderScene &render_scene, + aiScene *pScene, + size_t meshIdx); }; } // namespace Assimp #endif // AI_USDLOADER_IMPL_TINYUSDZ_H_INCLUDED