// read from binary reader internal RWSceneNode(BinaryReader reader, List<RWSceneNode> frameList) { _transform = reader.ReadMatrix4x3(); int parentIndex = reader.ReadInt32(); _userFlags = reader.ReadInt32(); _children = new List<RWSceneNode>(); if (parentIndex != -1) _parent = frameList[parentIndex]; else _parent = null; }
// Private methods private static void DepthFirstTraversal(RWSceneNode frame, ref List<RWSceneNode> list, ref int nIndex) { list.Add(frame); nIndex++; if (frame.Children == null) return; for (int i = 0; i < frame.Children.Count; i++) { DepthFirstTraversal(frame.Children[i], ref list, ref nIndex); } }
/// <summary> /// Construct a new scene node with a given local transform, node parent and user flag. /// </summary> /// <param name="transform">The local transformation matrix of the node.</param> /// <param name="parent">The parent node of the scene node.</param> /// <param name="userFlag">The user flag to set.</param> public RWSceneNode(Matrix4x4 transform, RWSceneNode parent, int userFlag) { _transform = transform; _userFlags = userFlag; Parent = parent; }
private static void WalkChildren(RWSceneNode rwNode, Assimp.Node parent) { foreach (RWSceneNode child in rwNode.Children) { string name = child.BoneMetadata.BoneNameID.ToString(); Assimp.Node aiNode = new Assimp.Node(name, parent); } }