/// <summary> /// Replace the geometries in the scene with the ones contained in the given Assimp scene. /// </summary> /// <param name="scene"></param> public void ReplaceGeometries(Assimp.Scene scene) { var skinToBoneMatrices = ComputeSkinToBoneMatrices(scene); GeometryList.Clear(); Atomics.Clear(); for (var i = 0; i < scene.Meshes.Count; i++) { var assimpMesh = scene.Meshes[i]; var rootNode = FindMeshRootNode(scene.RootNode, i) ?? scene.RootNode; TransformMeshVertices(assimpMesh, rootNode); var geometryNode = new RwGeometryNode(this, assimpMesh, scene.Materials[assimpMesh.MaterialIndex], FrameList, skinToBoneMatrices, out bool singleWeight); GeometryList.Add(geometryNode); var atomicNode = new RwAtomicNode(this, 0, i, 5); if (singleWeight) { if (assimpMesh.Bones.Count != 0) { atomicNode.FrameIndex = FrameList.GetFrameIndexByName(assimpMesh.Bones[0].Name); } else if (rootNode != null) { atomicNode.FrameIndex = FrameList.GetFrameIndexByName(rootNode.Name); } } Atomics.Add(atomicNode); } mStructNode = new RwClumpStructNode(this); }