From 054dacd0687cb2c2bca6fe14b61b8063ec7ba6ac Mon Sep 17 00:00:00 2001 From: Marc-Antoine Lortie Date: Sat, 11 Mar 2023 22:32:48 -0500 Subject: [PATCH] Improved comments. --- code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp | 5 +++-- test/unit/ImportExport/MDL/utMDLImporter_HL1_Nodes.cpp | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp b/code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp index 237ccf3d8..f3a383e8e 100644 --- a/code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp +++ b/code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp @@ -470,6 +470,7 @@ void HL1MDLLoader::read_bones() { temp_bones_.resize(header_->numbones); + // Create the main 'bones' node that will contain all MDL root bones. aiNode *bones_node = new aiNode(AI_MDL_HL1_NODE_BONES); rootnode_children_.push_back(bones_node); @@ -500,11 +501,11 @@ void HL1MDLLoader::read_bones() { temp_bones_[i].offset_matrix.Inverse(); } - // Create the 'bones' root node that will contain all bone nodes. + // Allocate memory for each MDL root bone. bones_node->mNumChildren = static_cast(roots.size()); bones_node->mChildren = new aiNode *[bones_node->mNumChildren]; - // Build all bones children hierarchy starting from each root bone. + // Build all bones children hierarchy starting from each MDL root bone. for (size_t i = 0; i < roots.size(); ++i) { const TempBone &root_bone = temp_bones_[roots[i]]; diff --git a/test/unit/ImportExport/MDL/utMDLImporter_HL1_Nodes.cpp b/test/unit/ImportExport/MDL/utMDLImporter_HL1_Nodes.cpp index af6512c87..5a258d0a4 100644 --- a/test/unit/ImportExport/MDL/utMDLImporter_HL1_Nodes.cpp +++ b/test/unit/ImportExport/MDL/utMDLImporter_HL1_Nodes.cpp @@ -81,6 +81,7 @@ public: ASSERT_NE(nullptr, scene); ASSERT_NE(nullptr, scene->mRootNode); + // First, check that "" and "" are linked. const aiNode* node_MDL_root = scene->mRootNode->FindNode(AI_MDL_HL1_NODE_ROOT); ASSERT_NE(nullptr, node_MDL_root); @@ -89,6 +90,7 @@ public: ASSERT_NE(nullptr, node_MDL_bones->mParent); ASSERT_EQ(node_MDL_root, node_MDL_bones->mParent); + // Second, verify "" hierarchy. const Hierarchy expected_hierarchy = { { 0, AI_MDL_HL1_NODE_BONES }, { 1, "root1_bone1" },