Esempio n. 1
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]);
                }
            }
        }
Esempio n. 2
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]);
                }
            }
        }