Class Texture
Texture implements IImageData and is used inside RenderContext to render bitmaps in fusee.
Inherited Members
Namespace: Fusee.Engine.Core
Assembly: Fusee.Engine.Core.dll
Syntax
public class Texture : ITexture, ITextureBase, IDisposable
Constructors
Texture()
Declaration
protected Texture()
Texture(IImageData, Boolean, TextureFilterMode, TextureWrapMode)
Initialize a Texture from an existing IImageData. The input IImageData will be copied into this Texture via Blt(Int32, Int32, IImageData, Int32, Int32, Int32, Int32) command.
Declaration
public Texture(IImageData imageData, bool generateMipMaps = true, TextureFilterMode filterMode = TextureFilterMode.NearestMipmapLinear, TextureWrapMode wrapMode = TextureWrapMode.Repeat)
Parameters
Type | Name | Description |
---|---|---|
IImageData | imageData | The existing IImageData that will be copied to initialize a Texture instance. |
System.Boolean | generateMipMaps | Defines if mipmaps are created. |
TextureFilterMode | filterMode | Defines the filter mode TextureFilterMode. |
TextureWrapMode | wrapMode | Defines the wrapping mode TextureWrapMode. |
Texture(Byte[], Int32, Int32, ImagePixelFormat, Boolean, TextureFilterMode, TextureWrapMode)
Constructor initializes a Texture from a pixelData byte buffer, width and height in pixels and ImagePixelFormat.
Declaration
public Texture(byte[] pixelData, int width, int height, ImagePixelFormat colorFormat, bool generateMipMaps = true, TextureFilterMode filterMode = TextureFilterMode.LinearMipmapLinear, TextureWrapMode wrapMode = TextureWrapMode.Repeat)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | pixelData | The raw pixelData byte buffer that makes up the texture. |
System.Int32 | width | Width in pixels. |
System.Int32 | height | Height in pixels. |
ImagePixelFormat | colorFormat | Provides additional information about pixel encoding. |
System.Boolean | generateMipMaps | Defines if mipmaps are created. |
TextureFilterMode | filterMode | Defines the filter mode TextureFilterMode. |
TextureWrapMode | wrapMode | Defines the wrapping mode TextureWrapMode. |
Fields
PathAndName
Reference to the original image. Should save path/file name.
Declaration
public string PathAndName
Field Value
Type | Description |
---|---|
System.String |
Properties
DoGenerateMipMaps
Specifies if mipmaps are created on the gpu or not for this texture.
Declaration
public bool DoGenerateMipMaps { get; protected set; }
Property Value
Type | Description |
---|---|
System.Boolean |
FilterMode
Specifies the texture's filter mode, see TextureFilterMode.
Declaration
public TextureFilterMode FilterMode { get; set; }
Property Value
Type | Description |
---|---|
TextureFilterMode |
Height
Height in pixels.
Declaration
public int Height { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
ImageData
The IImageData of this texture.
Declaration
public IImageData ImageData { get; protected set; }
Property Value
Type | Description |
---|---|
IImageData |
IsEmpty
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
PixelData
The raw pixel data byte buffer. This byte buffer will be uploaded to the GPU inside RenderContext
Declaration
public byte[] PixelData { get; }
Property Value
Type | Description |
---|---|
System.Byte[] |
PixelFormat
Provides additional information abut this Texture's pixel encoding.
Declaration
public ImagePixelFormat PixelFormat { get; }
Property Value
Type | Description |
---|---|
ImagePixelFormat |
SessionUniqueIdentifier
SessionUniqueIdentifier is used to verify a Textures's uniqueness in the current session.
Declaration
public Suid SessionUniqueIdentifier { get; protected set; }
Property Value
Type | Description |
---|---|
Suid |
TextureType
Type of the render texture, RenderTargetTextureTypes.
Declaration
public RenderTargetTextureTypes TextureType { get; protected set; }
Property Value
Type | Description |
---|---|
RenderTargetTextureTypes |
Width
Width in pixels.
Declaration
public int Width { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
WrapMode
Specifies the texture's wrap mode, see TextureWrapMode.
Declaration
public TextureWrapMode WrapMode { get; set; }
Property Value
Type | Description |
---|---|
TextureWrapMode |
Methods
Blt(Int32, Int32, IImageData, Int32, Int32, Int32, Int32)
Copies a rectangular block of pixel data from a source image to a this image (Blt = BlockTransfer).
Declaration
public void Blt(int xDst, int yDst, IImageData src, int xSrc = 0, int ySrc = 0, int width = 0, int height = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | xDst | The x destination coordinate (where to place the block within dst). |
System.Int32 | yDst | The y destination coordinate (where to place the block within dst). |
IImageData | src | The source image. |
System.Int32 | xSrc | The x source coordinate (where to start copying from within src). |
System.Int32 | ySrc | The y source coordinate (where to start copying from within src). |
System.Int32 | width | The width of the block to copy. (default is src.Width). |
System.Int32 | height | The height of the block to copy (default is src.Height). |
Remarks
All specified parameters are clipped to avoid out-of-bounds indices. No warnings or exceptions are issued in case clipping results in a smaller or an empty block.
Dispose()
Fire dispose mesh event
Declaration
public void Dispose()
Dispose(Boolean)
Fire dispose mesh event
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Finalize()
Destructor calls Dispose() in order to fire TextureChanged event.
Declaration
protected void Finalize()
ScanLines(Int32, Int32, Int32, Int32)
Retrieve a rectangular block from this image that is represented by horizontal ScanLines from top to bottom along width and height, beginning at offsets xSrc and ySrc.
Declaration
public IEnumerator<ScanLine> ScanLines(int xSrc = 0, int ySrc = 0, int width = 0, int height = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | xSrc | x offset in pixels. |
System.Int32 | ySrc | y offset in pixels. |
System.Int32 | width | width of ScanLines in pixels. |
System.Int32 | height | Height describes how many ScanLines will be returned. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<ScanLine> | Returns a rectangular block of horizontal ScanLine instances. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
Events
TextureChanged
TextureChanged event notifies observing TextureManager about property changes and the Texture's disposal.
Declaration
public event EventHandler<TextureEventArgs> TextureChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TextureEventArgs> |