public void ApplyInverseTransformations() { // DEBUG ONLY //foreach (BoneDef bone in m_BoneTree) // Console.WriteLine(bone.m_ID + ".m_GlobalInverseTransformation: " + bone.m_GlobalInverseTransformation.ToString()); // Now apply the vertex's bone's reverse transformation to each vertex foreach (BoneDef bone in m_BoneTree) { foreach (GeometryDef geometry in bone.m_Geometries.Values) { foreach (ModelBase.PolyListDef polyList in geometry.m_PolyLists.Values) { foreach (FaceListDef faceList in polyList.m_FaceLists) { foreach (FaceDef face in faceList.m_Faces) { for (int vert = 0; vert < face.m_Vertices.Length; vert++) { BoneDef currentVertexBone = m_BoneTree.GetAsList()[face.m_Vertices[vert].m_VertexBoneID]; Vector3 vertex = face.m_Vertices[vert].m_Position; Vector3.Transform(ref vertex, ref currentVertexBone.m_GlobalInverseTransformation, out vertex); face.m_Vertices[vert].m_Position = vertex; } } } } } } }
public void AddChild(BoneDef item) { item.m_Parent = this; this.m_Children.Add(item.m_ID, item); item.CalculateBranchTransformations(); }
public void ApplyTransformations() { // Now apply the vertex's bone's transformation to each vertex foreach (BoneDef bone in m_BoneTree) { foreach (GeometryDef geometry in bone.m_Geometries.Values) { foreach (PolyListDef polyList in geometry.m_PolyLists.Values) { foreach (FaceListDef faceList in polyList.m_FaceLists) { foreach (FaceDef face in faceList.m_Faces) { for (int vert = 0; vert < face.m_Vertices.Length; vert++) { BoneDef currentVertexBone = m_BoneTree.GetAsList()[face.m_Vertices[vert].m_VertexBoneID]; Vector3 vertex = face.m_Vertices[vert].m_Position; Vector3.Transform(ref vertex, ref currentVertexBone.m_GlobalTransformation, out vertex); face.m_Vertices[vert].m_Position = vertex; } } } } } } }