recursion WIP

This commit is contained in:
Xiao Qi 2022-11-11 17:54:50 +08:00
parent 7777e5642b
commit f673036e4e
2 changed files with 7 additions and 10 deletions

View File

@ -241,20 +241,16 @@ namespace SH_COMP
file.close(); file.close();
} }
void MeshCompiler::BuildArmature(aiNode const* node, RigNode*& root) noexcept void MeshCompiler::BuildArmature(aiNode const& baseNode, RigNode*& root) noexcept
{ {
std::queue<aiNode const*> nodes; std::queue<aiNode const*> nodes;
nodes.push(node); nodes.push(&baseNode);
root = new RigNode(); root = new RigNode();
RigNode* parent = nullptr;
auto current = root; auto current = root;
while(!nodes.empty()) //TODO Use CopyNode de recursive copy
{
auto node = nodes.front();
nodes.pop();
current->name = node->mName.C_Str();
}
} }
void MeshCompiler::LoadAndCompile(AssetPath path) noexcept void MeshCompiler::LoadAndCompile(AssetPath path) noexcept

View File

@ -41,7 +41,8 @@ namespace SH_COMP
static void LoadFromFile(AssetPath path, MeshAsset& asset) noexcept; static void LoadFromFile(AssetPath path, MeshAsset& asset) noexcept;
static void CompileMeshBinary(AssetPath path, MeshAsset const& 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: public:
static void LoadAndCompile(AssetPath path) noexcept; static void LoadAndCompile(AssetPath path) noexcept;
}; };