Exemple #1
0
        public Anim(Stream Data)
        {
            m_Reader = new FileReader(Data, true);

            m_Reader.ReadUInt32(); //Version

            ASCIIEncoding Enc = new ASCIIEncoding();
            Name = Enc.GetString(m_Reader.ReadBytes(m_Reader.ReadUShort()));
            Duration = m_Reader.ReadFloat();
            Distance = m_Reader.ReadFloat();
            IsMoving = (m_Reader.ReadByte() != 0) ? true : false;
            TranslationsCount = m_Reader.ReadUInt32();

            Translations = new float[TranslationsCount, 3];

            for(int i = 0; i < TranslationsCount; i++)
            {
                Translations[i, 0] = m_Reader.ReadFloat();
                Translations[i, 1] = m_Reader.ReadFloat();
                Translations[i, 2] = m_Reader.ReadFloat();
            }

            RotationsCount = m_Reader.ReadUInt32();

            Rotations = new float[RotationsCount, 4];

            for (int i = 0; i < RotationsCount; i++)
            {
                Rotations[i, 0] = m_Reader.ReadFloat();
                Rotations[i, 1] = m_Reader.ReadFloat();
                Rotations[i, 2] = m_Reader.ReadFloat();
                Rotations[i, 3] = m_Reader.ReadFloat();
            }

            MotionCount = m_Reader.ReadUInt32();

            for(int i = 0; i < MotionCount; i++)
                Motions.Add(new Motion(m_Reader));

            m_Reader.Close();
        }
Exemple #2
0
        public SpriteInfo(FileReader Reader, uint Version)
        {
            if(Version == 20000 || Version == 20001)
            {
                Type = Reader.ReadInt16();
                SPRChunkID = Reader.ReadInt16();
                SPRFrameNum = Reader.ReadInt16();
                Flags = Reader.ReadInt16();
                SpriteXOffset = Reader.ReadInt16();
                SpriteYOffset = Reader.ReadInt16();
                ObjectZOffset = Reader.ReadFloat();
            }
            else
            {
                SPRChunkID = Reader.ReadInt32();
                SPRFrameNum = Reader.ReadInt32();
                SpriteXOffset = Reader.ReadInt32();
                SpriteYOffset = Reader.ReadInt32();
                ObjectZOffset = Reader.ReadFloat();
                Flags = Reader.ReadInt32();

                if (Version == 20004)
                {
                    ObjectXOffset = Reader.ReadFloat();
                    ObjectYOffset = Reader.ReadFloat();
                }
            }
        }
Exemple #3
0
        public Mesh(Stream Data)
        {
            m_Reader = new FileReader(Data, true);

            m_Reader.ReadUInt32(); //Version
            BoneCount = m_Reader.ReadUInt32();

            for (int i = 0; i < BoneCount; i++)
                Bones.Add(m_Reader.ReadPascalString());

            FaceCount = m_Reader.ReadUInt32();

            for (int i = 0; i < FaceCount; i++)
                Faces.Add(new Vector3(m_Reader.ReadUInt32(), m_Reader.ReadUInt32(), m_Reader.ReadUInt32()));

            BindingCount = m_Reader.ReadUInt32();

            for (int i = 0; i < BindingCount; i++)
                BoneBindings.Add(new BoneBinding(m_Reader));

            RealVertexCount = m_Reader.ReadUInt32();
            List<Vector2> TexVertices = new List<Vector2>();

            for (int i = 0; i < RealVertexCount; i++)
                TexVertices.Add(new Vector2(m_Reader.ReadFloat(), m_Reader.ReadFloat()));

            BlendVertexCount = m_Reader.ReadUInt32();

            for (int i = 0; i < BlendVertexCount; i++)
                BlendVertexProps.Add(new BlendVertexProperty(m_Reader));

            TotalVertexCount = m_Reader.ReadUInt32();
            TransformedVertices = new VertexPositionNormalTexture[TotalVertexCount];

            for (int i = 0; i < RealVertexCount; i++)
            {
                RealVertices.Add(new VertexPositionNormalTexture(new Vector3(m_Reader.ReadFloat(), m_Reader.ReadFloat(), m_Reader.ReadFloat()),
                    new Vector3(m_Reader.ReadFloat(), m_Reader.ReadFloat(), m_Reader.ReadFloat()), TexVertices[i]));
            }

            for(int i = 0; i < BlendVertexCount; i++)
            {
                BlendedVertices.Add(new VertexPositionNormalTexture(new Vector3(m_Reader.ReadFloat(), m_Reader.ReadFloat(), m_Reader.ReadFloat()),
                    new Vector3(m_Reader.ReadFloat(), m_Reader.ReadFloat(), m_Reader.ReadFloat()), TexVertices[i]));
            }

            m_Reader.Close();
        }