示例#1
0
 /// <summary>
 /// Initialize a texture reference instance with a referenced texture name.
 /// </summary>
 /// <param name="refTextureName">Name of the referenced texture.</param>
 /// <param name="parent">Parent of the texture reference node. Value is null if not specified.</param>
 public RWTextureReference(string refTextureName, RWNode parent = null)
     : base(RWNodeType.TextureReference, parent)
 {
     // Create a struct with default values
     _struct = new RWTextureReferenceStruct(this);
     _refTexName = new RWString(refTextureName, this);
     _refTexMaskName = new RWString(string.Empty, this);
     _extension = new RWExtension(new RWSkyMipMapValue());
     _extension.Parent = this;
 }
示例#2
0
 /// <summary>
 /// Initializer only to be called in <see cref="RWNodeFactory.GetNode(RWNode, BinaryReader)"/>
 /// </summary>
 internal RWTextureReference(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
     : base(header)
 {
     _struct = RWNodeFactory.GetNode<RWTextureReferenceStruct>(this, reader);
     _refTexName = RWNodeFactory.GetNode<RWString>(this, reader);
     _refTexMaskName = RWNodeFactory.GetNode<RWString>(this, reader);
     _extension = RWNodeFactory.GetNode<RWExtension>(this, reader);
 }
示例#3
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;
        }
示例#4
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);
 }
示例#5
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;
        }