コード例 #1
0
        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);
        }
コード例 #2
0
        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;
        }
コード例 #3
0
ファイル: MyModel.cs プロジェクト: Stevolk/SEToolbox
        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;
        }
コード例 #4
0
ファイル: MyModel.cs プロジェクト: Stevolk/SEToolbox
 private static void WriteBone(this BinaryWriter writer, ref MyModelBone bone)
 {
     writer.Write(bone.Name);
     writer.Write(bone.Parent);
     WriteMatrix(writer, ref bone.Transform);
 }
コード例 #5
0
ファイル: MyModel.cs プロジェクト: Stevolk/SEToolbox
        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;
        }