static MyModelBone[] ReadBones(BinaryReader reader) { int boneCount = reader.ReadInt32(); MyModelBone[] bones = new MyModelBone[boneCount]; int i = 0; while (boneCount-- > 0) { MyModelBone bone = new MyModelBone(); bones[i] = bone; bone.Name = reader.ReadString(); bone.Index = i++; bone.Parent = reader.ReadInt32(); bone.Transform = ReadMatrix(reader); } return(bones); }
public bool ExportData(string tagName, MyModelBone[] bones) { WriteTag(tagName); m_writer.Write(bones.Length); foreach (var node in bones) { m_writer.Write(node.Name); m_writer.Write(node.Parent); WriteMatrix(node.Transform); } return true; }
private static bool ExportData(this BinaryWriter writer, string tagName, MyModelBone[] boneArray) { WriteTag(writer, tagName); writer.Write(boneArray.Length); foreach (var boneVal in boneArray) { var bone = boneVal; WriteBone(writer, ref bone); } return true; }
private static void WriteBone(this BinaryWriter writer, ref MyModelBone bone) { writer.Write(bone.Name); writer.Write(bone.Parent); WriteMatrix(writer, ref bone.Transform); }
private static MyModelBone[] ReadMyModelBoneArray(BinaryReader reader) { var nCount = reader.ReadInt32(); var myModelBoneArray = new MyModelBone[nCount]; for (var i = 0; i < nCount; i++) { var name = reader.ReadString(); var parent = reader.ReadInt32(); var matrix = ReadMatrix(reader); myModelBoneArray[i] = new MyModelBone { Name = name, Parent = parent, Transform = matrix }; } return myModelBoneArray; }