WIP Saving all nodes and structures

This commit is contained in:
Xiao Qi 2023-03-15 19:26:39 +08:00
parent c4cea569e1
commit 1ce0155a4c
5 changed files with 3369 additions and 11 deletions

3343
MD_HomeownerV2.gltf Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,12 +1,12 @@
-- outputdir = "%{wks.location}/bin/%{cfg.buildcfg}" outputdir = "%{wks.location}/bin/%{cfg.buildcfg}"
-- interdir = "%{wks.location}/bin_int" interdir = "%{wks.location}/bin_int"
-- workspace "ModelCompile" workspace "ModelCompile"
-- architecture "x64" architecture "x64"
-- configurations configurations
-- { {
-- "Release", "Release",
-- "Debug" "Debug"
-- } }
project "ModelCompiler" project "ModelCompiler"
kind "ConsoleApp" kind "ConsoleApp"

View File

@ -216,6 +216,9 @@ namespace SH_COMP
) )
); );
int nodeCounter{ 0 };
IndexType latest{ rig.header.startNode };
while (!nodeQueue.empty()) while (!nodeQueue.empty())
{ {
auto const currentPair = nodeQueue.front(); auto const currentPair = nodeQueue.front();
@ -232,6 +235,17 @@ namespace SH_COMP
reinterpret_cast<char const*>(&childCount), reinterpret_cast<char const*>(&childCount),
sizeof(uint32_t) sizeof(uint32_t)
); );
nodeCounter++;
if (node.children.empty() && nodeCounter < rig.nodes.size())
{
nodeQueue.push(
std::make_pair(
++latest,
rig.nodes.data() + latest
)
);
}
for (auto const& child : node.children) for (auto const& child : node.children)
{ {
@ -239,6 +253,8 @@ namespace SH_COMP
child, child,
rig.nodes.data() + child rig.nodes.data() + child
)); ));
latest = latest < child ? child : latest;
} }
} }
} }

View File

@ -39,7 +39,6 @@ namespace SH_COMP
std::vector<AnimData> anims; std::vector<AnimData> anims;
RigData rig; RigData rig;
std::unordered_map<uint32_t, uint32_t> nodeIndexMap; std::unordered_map<uint32_t, uint32_t> nodeIndexMap;
; }; ; };
} }

View File

@ -18,7 +18,7 @@ int main(int argc, char* argv[])
{ {
std::vector<std::string> paths; std::vector<std::string> paths;
#if 1 #if 0
if (argc == 1) if (argc == 1)
{ {