Ejemplo n.º 1
0
        private static object loadTexture2D(
            ref DataInputStream @in,
            ref List <Object3D> objectList,
            ref List <Object3D> rootObjectList)
        {
            Texture2D texture2D = new Texture2D();

            Loader.loadTransformable((Transformable)texture2D, ref @in, ref objectList, ref rootObjectList);
            Image2D reference = (Image2D)Loader.getReference(ref @in, ref objectList, ref rootObjectList);

            texture2D.setImage(reference);
            uint num1        = (uint)@in.readUnsignedByte();
            uint num2        = (uint)@in.readUnsignedByte();
            uint num3        = (uint)@in.readUnsignedByte();
            int  blending    = @in.readUnsignedByte();
            int  wrapS       = @in.readUnsignedByte();
            int  wrapT       = @in.readUnsignedByte();
            int  levelFilter = @in.readUnsignedByte();
            int  imageFilter = @in.readUnsignedByte();

            texture2D.setBlendColor((int)num1 << 16 | (int)num2 << 8 | (int)num3);
            texture2D.setBlending(blending);
            texture2D.setWrapping(wrapS, wrapT);
            texture2D.setFiltering(levelFilter, imageFilter);
            return((object)texture2D);
        }
Ejemplo n.º 2
0
        public void set(int format, int width, int height)
        {
            Image2D.requirePowerOf2(width);
            Image2D.requirePowerOf2(height);
            this.m_format       = format;
            this.m_width        = width;
            this.m_height       = height;
            this.m_bitsPerPixel = 0;
            switch (format)
            {
            case 96:
            case 97:
                this.m_bitsPerPixel = 8;
                break;

            case 98:
                this.m_bitsPerPixel = 16;
                break;

            case 99:
                this.m_bitsPerPixel = 24;
                break;

            case 100:
                this.m_bitsPerPixel = 32;
                break;

            case 101:
                this.m_bitsPerPixel = 16;
                break;

            case 102:
                this.m_bitsPerPixel = 16;
                break;

            case 103:
                this.m_bitsPerPixel = 16;
                break;

            case 120:
                this.m_bitsPerPixel = 4;
                break;

            case 121:
                this.m_bitsPerPixel = 8;
                break;

            case 122:
            case 123:
                this.m_bitsPerPixel = 2;
                break;

            case 124:
            case 125:
                this.m_bitsPerPixel = 4;
                break;
            }
            this.m_mutable = true;
        }
Ejemplo n.º 3
0
        protected override void duplicateTo(ref Object3D ret)
        {
            base.duplicateTo(ref ret);
            Image2D image2D = (Image2D)ret;

            image2D.m_format       = this.m_format;
            image2D.m_width        = this.m_width;
            image2D.m_height       = this.m_height;
            image2D.m_mutable      = this.m_mutable;
            image2D.m_bitsPerPixel = this.m_bitsPerPixel;
            image2D.texture2d      = this.texture2d;
        }
Ejemplo n.º 4
0
        private static object loadImage2D(
            ref DataInputStream @in,
            ref List <Object3D> objectList,
            ref List <Object3D> rootObjectList)
        {
            Image2D image2D = new Image2D();

            Loader.loadObject3D((Object3D)image2D, ref @in, ref objectList, ref rootObjectList);
            int  format = @in.readUnsignedByte();
            bool flag   = @in.readBoolean();
            int  width  = Loader.readIntLE(ref @in);
            int  height = Loader.readIntLE(ref @in);

            image2D.set(format, width, height);
            if (!flag)
            {
                sbyte[] numArray1 = (sbyte[])null;
                int     length    = Loader.readIntLE(ref @in);
                if (length > 0)
                {
                    numArray1 = new sbyte[length];
                    @in.readFully(numArray1);
                }
                int     len       = Loader.readIntLE(ref @in);
                sbyte[] numArray2 = new sbyte[len];
                @in.readFully(numArray2, len);
                if (numArray1 != null)
                {
                    image2D.commit(numArray1, numArray2);
                }
                else
                {
                    byte[] pixels = new byte[numArray2.Length];
                    Buffer.BlockCopy((Array)numArray2, 0, (Array)pixels, 0, numArray2.Length);
                    image2D.commit(pixels);
                }
            }
            return((object)image2D);
        }