Fixed recursive process node function to process root node and not ignore
This commit is contained in:
parent
6eca9b021f
commit
e0392bd601
|
@ -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();
|
||||
meshes.back().name = node->mName.C_Str();
|
||||
}
|
||||
else
|
||||
{
|
||||
BuildArmature(child, rig);
|
||||
BuildArmature(node, rig);
|
||||
}
|
||||
|
||||
for (auto i{ 0 }; i < node->mNumChildren; ++i)
|
||||
{
|
||||
ProcessNode(node->mChildren[i], scene, meshes, rig);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
std::vector<std::string> 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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue