Esempio n. 1
0
        public override void fromMessage(Message msg)
        {
            clearData();

            MyBinStream stream = new MyBinStream(msg.Data);

            m_id      = stream.readUInt();
            m_texType = (KPTextureType)stream.readInt();

            int mipmapCount = stream.readInt();

            for (int i = 0; i < mipmapCount; i++)
            {
                int level = stream.readInt();
                Utils.assert(level >= 0 && level < MAX_MIPMAP_LEVEL_NUMBER);
                Mipmap mip = m_pMipmaps[level];

                mip.reset();

                mip.Width        = stream.readInt();
                mip.Height       = stream.readInt();
                mip.IsCompressed = stream.readByte();
                mip.Format       = stream.readInt();
                mip.Type         = stream.readUInt();

                byte hasPixel = stream.readByte();
                if (hasPixel == 1)
                {
                    int mipSize = mip.calculateSize();
                    if (mipSize > 0)
                    {
                        mip.Pixels = new byte[mipSize];
                        stream.readBytes(mip.Pixels, 0, mipSize);
                    }
                }

                mip.HasData = true;
            }

            stream.close();
        }