Exemplo n.º 1
0
        /// <summary>
        /// Deserializes an <see cref="MDXSkinSection"/> from a given block of binary data. The data is expected to be
        /// 32 or 48 bytes long, depending on the version of the originating file.
        /// </summary>
        /// <param name="data">The data containing the skin section.</param>
        public MDXSkinSection(byte[] data)
        {
            using (MemoryStream ms = new MemoryStream(data))
            {
                using (BinaryReader br = new BinaryReader(ms))
                {
                    SkinSectionID         = new BaseSkinSectionIdentifier(br.ReadUInt16());
                    Level                 = br.ReadUInt16();
                    StartVertexIndex      = br.ReadUInt16();
                    VertexCount           = br.ReadUInt16();
                    StartTriangleIndex    = br.ReadUInt16();
                    TriangleCount         = br.ReadUInt16();
                    BoneCount             = br.ReadUInt16();
                    StartBoneIndex        = br.ReadUInt16();
                    InfluencingBonesCount = br.ReadUInt16();
                    CenterBoneIndex       = br.ReadUInt16();
                    CenterPosition        = br.ReadVector3();

                    if (br.BaseStream.Length > 32)
                    {
                        SortCenterPosition = br.ReadVector3();
                        SortRadius         = br.ReadSingle();
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MDXSkinSection"/> class. The data is expected to be
        /// 32 or 48 bytes long, depending on the version of the originating file.
        /// </summary>
        /// <param name="br">A binary reader pointing at a valid starting point for the data.</param>
        /// <param name="version">The version to deserialize.</param>
        public MDXSkinSection(BinaryReader br, WarcraftVersion version)
        {
            SkinSectionID         = new BaseSkinSectionIdentifier(br.ReadUInt16());
            Level                 = br.ReadUInt16();
            StartVertexIndex      = br.ReadUInt16();
            VertexCount           = br.ReadUInt16();
            StartTriangleIndex    = br.ReadUInt16();
            TriangleCount         = br.ReadUInt16();
            BoneCount             = br.ReadUInt16();
            StartBoneIndex        = br.ReadUInt16();
            InfluencingBonesCount = br.ReadUInt16();
            CenterBoneIndex       = br.ReadUInt16();
            CenterPosition        = br.ReadVector3();

            if (version < WarcraftVersion.BurningCrusade)
            {
                return;
            }

            SortCenterPosition = br.ReadVector3();
            SortRadius         = br.ReadSingle();
        }