예제 #1
0
        /// <summary>
        /// The serialise.
        /// </summary>
        /// <param name="serialise">
        /// The serialise.
        /// </param>
        public override void Serialise(IwSerialise serialise)
        {
            base.Serialise(serialise);
            short mediane = 0;
            serialise.Int16(ref mediane);

            this.Resize(this.numItems);

            for (int i = 0; i < this.numItems; ++i)
            {
                short x = (short)(this.tangents[i].X - mediane);
                serialise.Int16(ref x);
                this.tangents[i].X = x + mediane;
            }

            for (int i = 0; i < this.numItems; ++i)
            {
                short y = (short)(this.tangents[i].Y - mediane);
                serialise.Int16(ref y);
                this.tangents[i].Y = y + mediane;
            }

            for (int i = 0; i < this.numItems; ++i)
            {
                short z = (short)(this.tangents[i].Z - mediane);
                serialise.Int16(ref z);
                this.tangents[i].Z = z + mediane;
            }
        }
예제 #2
0
        /// <summary>
        /// The serialise.
        /// </summary>
        /// <param name="serialise">
        /// The serialise.
        /// </param>
        public override void Serialise(IwSerialise serialise)
        {
            base.Serialise(serialise);
            short mediane = 0;

            serialise.Int16(ref mediane);

            this.Resize(this.numItems);

            for (int i = 0; i < this.numItems; ++i)
            {
                short x = (short)(this.verts[i].X - mediane);
                serialise.Int16(ref x);
                this.verts[i].X = x + mediane;
            }

            for (int i = 0; i < this.numItems; ++i)
            {
                short y = (short)(this.verts[i].Y - mediane);
                serialise.Int16(ref y);
                this.verts[i].Y = y + mediane;
            }

            for (int i = 0; i < this.numItems; ++i)
            {
                short z = (short)(this.verts[i].Z - mediane);
                serialise.Int16(ref z);
                this.verts[i].Z = z + mediane;
            }
        }
예제 #3
0
        /// <summary>
        /// The serialise.
        /// </summary>
        /// <param name="serialise">
        /// The serialise.
        /// </param>
        /// <exception cref="NotImplementedException">
        /// </exception>
        public override void Serialise(IwSerialise serialise)
        {
            base.Serialise(serialise);
            {
                serialise.UInt16(ref this.uniqueValues);
            }

            short mediane = 0;

            serialise.Int16(ref mediane);

            var len = this.uniqueValues;             // this.numItems; //

            this.Resize(this.numItems);

            if (serialise.IsWriting())
            {
                throw new NotImplementedException();
            }

            for (int i = 0; i < len; ++i)
            {
                short x = (short)(this.verts[i].X - mediane);
                serialise.Int16(ref x);
                this.verts[i].X = x + mediane;
            }

            for (int i = 0; i < len; ++i)
            {
                short y = (short)(this.verts[i].Y - mediane);
                serialise.Int16(ref y);
                this.verts[i].Y = y + mediane;
            }

            for (int i = 0; i < len; ++i)
            {
                short z = (short)(this.verts[i].Z - mediane);
                serialise.Int16(ref z);
                this.verts[i].Z = z + mediane;
            }

            ushort[] links = new ushort[this.numItems - this.uniqueValues];
            serialise.Serialise(ref links);
            for (int i = this.uniqueValues; i < this.numItems; ++i)
            {
                this.verts[i] = this.verts[links[i - this.uniqueValues]];
            }
        }
예제 #4
0
        /// <summary>
        /// The serialise.
        /// </summary>
        /// <param name="serialise">
        /// The serialise.
        /// </param>
        /// <exception cref="NotImplementedException">
        /// </exception>
        public override void Serialise(IwSerialise serialise)
        {
            base.Serialise(serialise);
            {
                serialise.UInt16(ref this.uniqueValues);
            }

            short mediane = 0;
            serialise.Int16(ref mediane);

            var len = this.uniqueValues; // this.numItems; //

            this.Resize(this.numItems);

            if (serialise.IsWriting())
            {
                throw new NotImplementedException();
            }

            for (int i = 0; i < len; ++i)
            {
                short x = (short)(this.verts[i].X - mediane);
                serialise.Int16(ref x);
                this.verts[i].X = x + mediane;
            }

            for (int i = 0; i < len; ++i)
            {
                short y = (short)(this.verts[i].Y - mediane);
                serialise.Int16(ref y);
                this.verts[i].Y = y + mediane;
            }

            for (int i = 0; i < len; ++i)
            {
                short z = (short)(this.verts[i].Z - mediane);
                serialise.Int16(ref z);
                this.verts[i].Z = z + mediane;
            }

            ushort[] links = new ushort[this.numItems - this.uniqueValues];
            serialise.Serialise(ref links);
            for (int i = this.uniqueValues; i < this.numItems; ++i)
            {
                this.verts[i] = this.verts[links[i - this.uniqueValues]];
            }
        }
예제 #5
0
        /// <summary>
        /// The serialise.
        /// </summary>
        /// <param name="serialise">
        /// The serialise.
        /// </param>
        public override void Serialise(IwSerialise serialise)
        {
            base.Serialise(serialise);
            short mediane = 0;

            // serialise.Int16(ref mediane);
            this.Resize(this.numItems);

            for (int i = 0; i < this.numItems; ++i)
            {
                short x = (short)((this.verts[i].X - mediane) * S3E.IwGeomOne);
                serialise.Int16(ref x);
                this.verts[i].X = (x + mediane) / (float)S3E.IwGeomOne;

                short y = (short)((this.verts[i].Y - mediane) * S3E.IwGeomOne);
                serialise.Int16(ref y);
                this.verts[i].Y = (y + mediane) / (float)S3E.IwGeomOne;
            }
        }
예제 #6
0
        /// <summary>
        /// The serialise.
        /// </summary>
        /// <param name="serialise">
        /// The serialise.
        /// </param>
        public override void Serialise(IwSerialise serialise)
        {
            base.Serialise(serialise);
            short mediane = 0;

            // serialise.Int16(ref mediane);
            this.Resize(this.numItems);

            for (int i = 0; i < this.numItems; ++i)
            {
                short x = (short)((this.verts[i].X - mediane) * S3E.IwGeomOne);
                serialise.Int16(ref x);
                this.verts[i].X = (x + mediane) / (float)S3E.IwGeomOne;

                short y = (short)((this.verts[i].Y - mediane) * S3E.IwGeomOne);
                serialise.Int16(ref y);
                this.verts[i].Y = (y + mediane) / (float)S3E.IwGeomOne;
            }
        }
예제 #7
0
        /// <summary>
        /// The serialise.
        /// </summary>
        /// <param name="serialise">
        /// The serialise.
        /// </param>
        public override void Serialise(IwSerialise serialise)
        {
            base.Serialise(serialise);
            serialise.UInt32(ref this.flags);
            serialise.UInt8(ref this.FormatSW);
            serialise.UInt8(ref this.FormatHW);
            short unknown3 = 0x1000;

            serialise.Int16(ref unknown3);
            short unknown4 = 0x1000;

            serialise.Int16(ref unknown4);
            if (this.image == null)
            {
                this.image = new CIwImage();
            }

            this.image.Serialise(serialise);
            bool unknown5 = false;

            serialise.Bool(ref unknown5);
        }
예제 #8
0
        /// <summary>
        /// The serialise.
        /// </summary>
        /// <param name="serialise">
        /// The serialise.
        /// </param>
        public override void Serialise(IwSerialise serialise)
        {
            base.Serialise(serialise);
            serialise.UInt32(ref this.flags);
            serialise.UInt8(ref this.FormatSW);
            serialise.UInt8(ref this.FormatHW);
            short unknown3 = 0x1000;
            serialise.Int16(ref unknown3);
            short unknown4 = 0x1000;
            serialise.Int16(ref unknown4);
            if (this.image == null)
            {
                this.image = new CIwImage();
            }

            this.image.Serialise(serialise);
            bool unknown5 = false;
            serialise.Bool(ref unknown5);
        }
예제 #9
0
        /// <summary>
        /// The serialise.
        /// </summary>
        /// <param name="serialise">
        /// The serialise.
        /// </param>
        public override void Serialise(IwSerialise serialise)
        {
            base.Serialise(serialise);

            bool someFlag = false;

            serialise.Bool(ref someFlag);
            {
                serialise.UInt32(ref this.flags);
            }

            if (!someFlag)
            {
                {
                    serialise.Int16(ref this.zDepthOfs);
                }
                {
                    serialise.Int16(ref this.zDepthOfsHW);
                }
                {
                    serialise.Colour(ref this.colEmissive);
                }
                {
                    serialise.Colour(ref this.colAmbient);
                }
                {
                    serialise.Colour(ref this.colDiffuse);
                }
                {
                    serialise.Colour(ref this.colSpecular);
                }
                {
                    uint val = 4;
                    serialise.UInt32(ref val);
                }
            }
            {
                // Texture is always presented
                CIwManaged t = this.texture0;
                serialise.ManagedHash("CIwTexture".ToeHash(), ref t);
                this.texture0 = (CIwTexture)t;
            }

            if (!someFlag)
            {
                CIwManaged t = this.texture1;
                serialise.ManagedHash("CIwTexture".ToeHash(), ref t);
                this.texture1 = (CIwTexture)t;
                {
                    CIwManaged val = null;
                    serialise.ManagedHash("?".ToeHash(), ref val);
                }
                {
                    CIwManaged val = null;
                    serialise.ManagedHash("?".ToeHash(), ref val);
                }

                byte isAnimated = 0;
                serialise.UInt8(ref isAnimated);
                if (isAnimated != 0)
                {
                    {
                        byte value = 0;
                        serialise.UInt8(ref value);
                    }

                    serialise.UInt8(ref this.celNum);
                    serialise.UInt8(ref this.celNumU);
                    serialise.UInt8(ref this.celW);
                    serialise.UInt8(ref this.celH);
                    serialise.UInt8(ref this.celPeriod);
                }

                serialise.UInt8(ref this.alphaTestValue);
                {
                    CIwManaged val = null;
                    serialise.ManagedHash("?".ToeHash(), ref val);
                }
            }
        }
예제 #10
0
        /// <summary>
        /// The serialise.
        /// </summary>
        /// <param name="serialise">
        /// The serialise.
        /// </param>
        public void Serialise(IwSerialise serialise)
        {
            if (serialise.IsReading())
            {
                this.m_IGIDs = new ushort[4];
                this.m_U0    = new short[8];
            }

            serialise.UInt32(ref this.m_Flags);
            int numVerts = 4;

            if (0 == (this.m_Flags & IW_MODEL_PRIM_QUAD_F) && serialise.IsVersionOlderThen(3, 5, 6))
            {
                numVerts = 3;
            }

            serialise.Serialise(ref this.m_IGIDs, numVerts);
            if (this.IsTextured)
            {
                // serialise.Int16(ref this.m_U0[0 * 2]);
                // serialise.Int16(ref this.m_U0[0 * 2 + 1]);

                // serialise.Int16(ref this.m_U0[1 * 2]);
                // serialise.Int16(ref this.m_U0[1 * 2 + 1]);

                // serialise.Int16(ref this.m_U0[2 * 2]);
                // serialise.Int16(ref this.m_U0[2 * 2 + 1]);

                // serialise.Int16(ref this.m_U0[3 * 2]);
                // serialise.Int16(ref this.m_U0[3 * 2 + 1]);

                if (0 != (this.m_Flags & IW_MODEL_PRIM_QUAD_F))
                {
                    serialise.Int16(ref this.m_U0[0 * 2]);
                    serialise.Int16(ref this.m_U0[0 * 2 + 1]);

                    serialise.Int16(ref this.m_U0[2 * 2]);
                    serialise.Int16(ref this.m_U0[2 * 2 + 1]);

                    serialise.Int16(ref this.m_U0[3 * 2]);
                    serialise.Int16(ref this.m_U0[3 * 2 + 1]);

                    serialise.Int16(ref this.m_U0[1 * 2]);
                    serialise.Int16(ref this.m_U0[1 * 2 + 1]);
                }
                else
                {
                    serialise.Int16(ref this.m_U0[0 * 2]);
                    serialise.Int16(ref this.m_U0[0 * 2 + 1]);

                    serialise.Int16(ref this.m_U0[2 * 2]);
                    serialise.Int16(ref this.m_U0[2 * 2 + 1]);

                    serialise.Int16(ref this.m_U0[1 * 2]);
                    serialise.Int16(ref this.m_U0[1 * 2 + 1]);
                    serialise.Int16(ref this.m_U0[3 * 2]);
                    serialise.Int16(ref this.m_U0[3 * 2 + 1]);
                }
            }
        }
예제 #11
0
        /// <summary>
        /// The serialise.
        /// </summary>
        /// <param name="serialise">
        /// The serialise.
        /// </param>
        public void Serialise(IwSerialise serialise)
        {
            if (serialise.IsReading())
            {
                this.m_IGIDs = new ushort[4];
                this.m_U0 = new short[8];
            }

            serialise.UInt32(ref this.m_Flags);
            int numVerts = 4;
            if (0 == (this.m_Flags & IW_MODEL_PRIM_QUAD_F) && serialise.IsVersionOlderThen(3, 5, 6))
            {
                numVerts = 3;
            }

            serialise.Serialise(ref this.m_IGIDs, numVerts);
            if (this.IsTextured)
            {
                // serialise.Int16(ref this.m_U0[0 * 2]);
                // serialise.Int16(ref this.m_U0[0 * 2 + 1]);

                // serialise.Int16(ref this.m_U0[1 * 2]);
                // serialise.Int16(ref this.m_U0[1 * 2 + 1]);

                // serialise.Int16(ref this.m_U0[2 * 2]);
                // serialise.Int16(ref this.m_U0[2 * 2 + 1]);

                // serialise.Int16(ref this.m_U0[3 * 2]);
                // serialise.Int16(ref this.m_U0[3 * 2 + 1]);

                if (0 != (this.m_Flags & IW_MODEL_PRIM_QUAD_F))
                {
                    serialise.Int16(ref this.m_U0[0 * 2]);
                    serialise.Int16(ref this.m_U0[0 * 2 + 1]);

                    serialise.Int16(ref this.m_U0[2 * 2]);
                    serialise.Int16(ref this.m_U0[2 * 2 + 1]);

                    serialise.Int16(ref this.m_U0[3 * 2]);
                    serialise.Int16(ref this.m_U0[3 * 2 + 1]);

                    serialise.Int16(ref this.m_U0[1 * 2]);
                    serialise.Int16(ref this.m_U0[1 * 2 + 1]);
                }
                else
                {
                    serialise.Int16(ref this.m_U0[0 * 2]);
                    serialise.Int16(ref this.m_U0[0 * 2 + 1]);

                    serialise.Int16(ref this.m_U0[2 * 2]);
                    serialise.Int16(ref this.m_U0[2 * 2 + 1]);

                    serialise.Int16(ref this.m_U0[1 * 2]);
                    serialise.Int16(ref this.m_U0[1 * 2 + 1]);
                    serialise.Int16(ref this.m_U0[3 * 2]);
                    serialise.Int16(ref this.m_U0[3 * 2 + 1]);
                }
            }
        }
예제 #12
0
        /// <summary>
        /// The serialise.
        /// </summary>
        /// <param name="serialise">
        /// The serialise.
        /// </param>
        public override void Serialise(IwSerialise serialise)
        {
            base.Serialise(serialise);

            bool someFlag = false;
            serialise.Bool(ref someFlag);
            {
                serialise.UInt32(ref this.flags);
            }

            if (!someFlag)
            {
                {
                    serialise.Int16(ref this.zDepthOfs);
                }
                {
                    serialise.Int16(ref this.zDepthOfsHW);
                }
                {
                    serialise.Colour(ref this.colEmissive);
                }
                {
                    serialise.Colour(ref this.colAmbient);
                }
                {
                    serialise.Colour(ref this.colDiffuse);
                }
                {
                    serialise.Colour(ref this.colSpecular);
                }
                {
                    uint val = 4;
                    serialise.UInt32(ref val);
                }
            }
            {
                // Texture is always presented
                CIwManaged t = this.texture0;
                serialise.ManagedHash("CIwTexture".ToeHash(), ref t);
                this.texture0 = (CIwTexture)t;
            }

            if (!someFlag)
            {
                CIwManaged t = this.texture1;
                serialise.ManagedHash("CIwTexture".ToeHash(), ref t);
                this.texture1 = (CIwTexture)t;
                {
                    CIwManaged val = null;
                    serialise.ManagedHash("?".ToeHash(), ref val);
                }
                {
                    CIwManaged val = null;
                    serialise.ManagedHash("?".ToeHash(), ref val);
                }

                byte isAnimated = 0;
                serialise.UInt8(ref isAnimated);
                if (isAnimated != 0)
                {
                    {
                        byte value = 0;
                        serialise.UInt8(ref value);
                    }

                    serialise.UInt8(ref this.celNum);
                    serialise.UInt8(ref this.celNumU);
                    serialise.UInt8(ref this.celW);
                    serialise.UInt8(ref this.celH);
                    serialise.UInt8(ref this.celPeriod);
                }

                serialise.UInt8(ref this.alphaTestValue);
                {
                    CIwManaged val = null;
                    serialise.ManagedHash("?".ToeHash(), ref val);
                }
            }
        }