diff --git a/src/Libraries/MeshCompiler.cpp b/src/Libraries/MeshCompiler.cpp index e617bde..7de2cb2 100644 --- a/src/Libraries/MeshCompiler.cpp +++ b/src/Libraries/MeshCompiler.cpp @@ -40,21 +40,21 @@ namespace SH_COMP void MeshCompiler::ProcessNode(AiNodeConstPtr node, aiScene const& scene, MeshVectorRef meshes, RigData& rig) noexcept { - for (auto i{ 0 }; i < node->mNumChildren; ++i) + if (node->mNumMeshes > 0) { - auto child{ node->mChildren[i] }; - - if (child->mNumMeshes > 0) - { - aiMesh* mesh = scene.mMeshes[child->mMeshes[0]]; + aiMesh* mesh = scene.mMeshes[node->mMeshes[0]]; meshes.emplace_back(); GetMesh(*mesh, meshes.back()); - meshes.back().name = child->mName.C_Str(); - } - else - { - BuildArmature(child, rig); - } + meshes.back().name = node->mName.C_Str(); + } + else + { + BuildArmature(node, rig); + } + + for (auto i{ 0 }; i < node->mNumChildren; ++i) + { + ProcessNode(node->mChildren[i], scene, meshes, rig); } } diff --git a/src/main.cpp b/src/main.cpp index 85c43c3..bee8ff3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,6 +18,8 @@ int main(int argc, char* argv[]) { std::vector paths; + #if 0 + if (argc == 1) { if (std::filesystem::is_directory(ASSET_ROOT)) @@ -47,13 +49,17 @@ int main(int argc, char* argv[]) paths.emplace_back(argv[i]); } } + #else + for (auto const& path : paths) { SH_COMP::MeshCompiler::LoadAndCompile(path); } + #endif - //SH_COMP::MeshCompiler::LoadAndCompile("Raccoon.gltf"); + + SH_COMP::MeshCompiler::LoadAndCompile("MD_Homeowner-NoRig.gltf"); return 0; }