Exemple #1
0
 public override void clearData()
 {
     m_texType = KPTextureType.TEX_NONE;
     for (int i = 0; i < MAX_MIPMAP_LEVEL_NUMBER; i++)
     {
         m_pMipmaps[i].reset();
     }
 }
Exemple #2
0
        private void init()
        {
            m_texType = KPTextureType.TEX_NONE;

            m_pMipmaps = new Mipmap[MAX_MIPMAP_LEVEL_NUMBER];
            for (int i = 0; i < MAX_MIPMAP_LEVEL_NUMBER; i++)
            {
                m_pMipmaps[i] = new Mipmap();
            }
        }
Exemple #3
0
        public void copyFrom(Texture tex)
        {
            clearData();
            m_id      = tex.Id;
            m_texType = tex.TexType;

            Mipmap[] mips = tex.Mipmaps;
            for (int i = 0; i < MAX_MIPMAP_LEVEL_NUMBER; i++)
            {
                m_pMipmaps[i].copyFrom(mips[i]);
            }
        }
Exemple #4
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();
        }