MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ProcessNodes

Function ProcessNodes

Source/Engine/Tools/ModelTool/ModelTool.Assimp.cpp:197–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195};
196
197void ProcessNodes(AssimpImporterData& data, aiNode* aNode, int32 parentIndex)
198{
199 const int32 nodeIndex = data.Nodes.Count();
200
201 // Assign the index of the node to the index of the mesh
202 for (unsigned i = 0; i < aNode->mNumMeshes; i++)
203 {
204 int meshIndex = aNode->mMeshes[i];
205 data.MeshIndexToNodeIndex[meshIndex].Add(nodeIndex);
206 }
207
208 // Create node
209 AssimpNode node;
210 node.ParentIndex = parentIndex;
211 node.Name = aNode->mName.C_Str();
212
213 // Pick node LOD index
214 if (parentIndex == -1 || !data.Options.ImportLODs)
215 {
216 node.LodIndex = 0;
217 }
218 else
219 {
220 node.LodIndex = data.Nodes[parentIndex].LodIndex;
221 if (node.LodIndex == 0)
222 {
223 node.LodIndex = ModelTool::DetectLodIndex(node.Name);
224 }
225 ASSERT(Math::IsInRange(node.LodIndex, 0, MODEL_MAX_LODS - 1));
226 }
227
228 Matrix transform = ToMatrix(aNode->mTransformation);
229 transform.Decompose(node.LocalTransform);
230 if (data.Options.IgnoreNodesScale)
231 node.LocalTransform.Scale = Float3::One;
232 data.Nodes.Add(node);
233
234 // Process the children
235 for (unsigned i = 0; i < aNode->mNumChildren; i++)
236 {
237 ProcessNodes(data, aNode->mChildren[i], nodeIndex);
238 }
239}
240
241bool ProcessMesh(ModelData& result, AssimpImporterData& data, const aiMesh* aMesh, MeshData& mesh, String& errorMsg)
242{

Callers 1

ImportDataAssimpMethod · 0.70

Calls 6

IsInRangeFunction · 0.85
C_StrMethod · 0.80
ToMatrixFunction · 0.70
CountMethod · 0.45
AddMethod · 0.45
DecomposeMethod · 0.45

Tested by

no test coverage detected