From f673036e4ea2962fddf1ef64a7707df7e06c4e8a Mon Sep 17 00:00:00 2001 From: Xiao Qi Date: Fri, 11 Nov 2022 17:54:50 +0800 Subject: [PATCH] recursion WIP --- src/Libraries/MeshCompiler.cpp | 14 +++++--------- src/Libraries/MeshCompiler.h | 3 ++- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Libraries/MeshCompiler.cpp b/src/Libraries/MeshCompiler.cpp index 935d5e0..d61c434 100644 --- a/src/Libraries/MeshCompiler.cpp +++ b/src/Libraries/MeshCompiler.cpp @@ -241,20 +241,16 @@ namespace SH_COMP file.close(); } - void MeshCompiler::BuildArmature(aiNode const* node, RigNode*& root) noexcept + void MeshCompiler::BuildArmature(aiNode const& baseNode, RigNode*& root) noexcept { std::queue nodes; - nodes.push(node); + nodes.push(&baseNode); + root = new RigNode(); + RigNode* parent = nullptr; auto current = root; - while(!nodes.empty()) - { - auto node = nodes.front(); - nodes.pop(); - - current->name = node->mName.C_Str(); - } + //TODO Use CopyNode de recursive copy } void MeshCompiler::LoadAndCompile(AssetPath path) noexcept diff --git a/src/Libraries/MeshCompiler.h b/src/Libraries/MeshCompiler.h index 28eac51..cf72b5f 100644 --- a/src/Libraries/MeshCompiler.h +++ b/src/Libraries/MeshCompiler.h @@ -41,7 +41,8 @@ namespace SH_COMP static void LoadFromFile(AssetPath path, MeshAsset& asset) noexcept; static void CompileMeshBinary(AssetPath path, MeshAsset const& asset) noexcept; - static void BuildArmature(aiNode const* node, RigNode*& root) noexcept; + static void BuildArmature(aiNode const& node, RigNode*& root) noexcept; + static void CopyNode(aiNode const& source, RigNode*& parent) noexcept; public: static void LoadAndCompile(AssetPath path) noexcept; };