Ejemplo n.º 1
0
        /// <summary>
        /// Initializes an <see cref="RWTextureNative"/> instance using a name, width, height, palette, indices and a PS2 pixel format to encode to.
        /// </summary>
        /// <param name="name">Name of the texture used for material references.</param>
        /// <param name="width">Width of the texture.</param>
        /// <param name="height">Height of the texture.</param>
        /// <param name="palette">Texture palette data.</param>
        /// <param name="indices">Texture pixel indices into the palette.</param>
        /// <param name="pixelFormat">PS2 Pixel format to encode the bitmap to.</param>
        public RWTextureNative(string name, int width, int height, Color[] palette, byte[] indices, PS2PixelFormat pixelFormat)
            : base(RWNodeType.TextureNative)
        {
            if (width % 2 != 0 || height % 2 != 0)
            {
                throw new ArgumentException(EXCEPTION_NOT_POW2);
            }

            if (width > 1024 || width > 1024)
            {
                throw new ArgumentException(EXCEPTION_DIMENSION_TOO_BIG);
            }

            _struct = new RWTextureNativeStruct(this);
            _name = new RWString(name, this);
            _maskName = new RWString(string.Empty, this);
            _raster = new RWRaster(width, height, palette, indices, pixelFormat, this);
            _extension = new RWExtension(new RWSkyMipMapValue());
            _extension.Parent = this;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructor only to be called in <see cref="RWNodeFactory"/>.
 /// </summary>
 internal RWTextureNative(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
     : base(header)
 {
     _struct = RWNodeFactory.GetNode<RWTextureNativeStruct>(this, reader);
     _name = RWNodeFactory.GetNode<RWString>(this, reader);
     _maskName = RWNodeFactory.GetNode<RWString>(this, reader);
     _raster = RWNodeFactory.GetNode<RWRaster>(this, reader);
     _extension = RWNodeFactory.GetNode<RWExtension>(this, reader);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes an <see cref="RWTextureNative"/> instance using a bitmap, name and a PS2 pixel format to encode to.
        /// </summary>
        /// <param name="name">Name of the texture used for material references.</param>
        /// <param name="bitmap">Source bitmap used to encode.</param>
        /// <param name="pixelFormat">PS2 Pixel format to encode the bitmap to.</param>
        public RWTextureNative(string name, Bitmap bitmap, PS2PixelFormat pixelFormat)
            : base(RWNodeType.TextureNative)
        {
            if (bitmap.Width % 2 != 0 || bitmap.Height % 2 != 0)
            {
                throw new ArgumentException(EXCEPTION_NOT_POW2);
            }

            if (bitmap.Width > 1024 || bitmap.Width > 1024)
            {
                throw new ArgumentException(EXCEPTION_DIMENSION_TOO_BIG);
            }

            _struct = new RWTextureNativeStruct(this);
            _name = new RWString(name, this);
            _maskName = new RWString(string.Empty, this);
            _raster = new RWRaster(bitmap, pixelFormat, this);
            _extension = new RWExtension(new RWSkyMipMapValue());
            _extension.Parent = this;
        }