ModelTexture

Description

abstract class Tinman.Engine.Models.ModelTexture

Derived from

IModelTexture

Abstract base class for IModelTexture implementations.

The default implementation of IModelTexture.ReadTexels delegates to ReadTexels, passing IModelTexture.PreferredTextureFormat and IModelTexture.IsSrgb, which results in null and true for the respective default implementation.

Public / Constants

Black


public static readonly attribute Black → (IModelTexture)

Uniform texture of color Colors.Black.

Blue


public static readonly attribute Blue → (IModelTexture)

Uniform texture of color Colors.Blue.

Cyan


public static readonly attribute Cyan → (IModelTexture)

Uniform texture of color Colors.Cyan.

Displacement​Zero


public static readonly attribute DisplacementZero → (IModelTexture)

Placeholder for encoded displacement map.

Error


public static readonly attribute Error → (IModelTexture)

Used to visually indicate a missing texture resource.

Gradient


public static readonly attribute Gradient → (IModelTexture)

A texture with some pseudo-random gradients in each color channel.

Green


public static readonly attribute Green → (IModelTexture)

Uniform texture of color Colors.Lime.

Lookup​Table


public static readonly attribute LookupTable → (IModelTexture)

The lookup table for lighting.

Magenta


public static readonly attribute Magenta → (IModelTexture)

Uniform texture of color Colors.Magenta.

Normal​Up​RB


public static readonly attribute NormalUpRB → (IModelTexture)

Placeholder for encoded normal map.

Normal​Up​RGB


public static readonly attribute NormalUpRGB → (IModelTexture)

Placeholder for normal map.

See also

IMaterial.Normal

Red


public static readonly attribute Red → (IModelTexture)

Uniform texture of color Colors.Red.

White


public static readonly attribute White → (IModelTexture)

Uniform texture of color Colors.White.

Yellow


public static readonly attribute Yellow → (IModelTexture)

Uniform texture of color Colors.Yellow.

Zero


public static readonly attribute Zero → (IModelTexture)

Uniform texture of color zero (i.e. transparent black).

Public / Constructors

Dynamic


[OwnerReturn]
public static method Dynamic → (6)

format in : TextureFormat

[not-null]
The texture format to use.

width in : int32

[>0]
The texture width.

height in : int32

[>0]
The texture height.

mipmaps opt : int32 = 0

[>=0]
The mipmap level count or 0 to create a full mipmap chain.

slices opt : int32 = 1

[>=1]
The number of texture slices.

srgb opt : bool = true

The sRGB behaviour of the model texture, see IModelTexture.IsSrgb.

returns → IModelTextureDynamic

The model texture.

Creates a new instance of IModelTextureDynamic that can be updated at runtime.

The dynamic model texture can be used to update dependent GPU texture resources from a TexelBuffer object that is maintained and updated by the CPU. Creation of a dynamic model texture instance for a specific graphics context will fail if the given combination of format in, width in, height in and slices opt is not supported. The application may use ITextureFactory.ValidateTextureFormat, ITextureFactory.ValidateTextureSize and ITextureFactory.MaximumCount to check for support up-front.

For

5 overloads


public static method For1 → (2)

color in : int64

The uniform color to use.

srgb opt : bool = true

The sRGB behaviour of the model texture, see IModelTexture.IsSrgb.

returns → IModelTexture

The model texture.

Creates a new instance of IModelTexture that has a uniform color.

This method will return one of the following constants, if color in matches:

Otherwise, a new IModelTexture object will be created.


public static method For2 → (3)

path in : Path

[not-null]
File path of the texture to refer to.
If srgb opt is set to false, no gamma-correction will be applied when loading the texture image.
If srgb opt is set to true, sRGB gamma-correction will be applied when loading the texture image.
Use For3 to apply the SRGB behaviour of the texture image.

format opt : TextureFormat = null

The texture format to use if the image file does not specify one. Set to null to choose a texture format from the pixel format automatically.

srgb opt : bool = true

The sRGB behaviour of the model texture, see IModelTexture.IsSrgb.

returns → IModelTexture

The model texture.

Creates a new instance of IModelTexture that refers to the given texture file.


public static method For3 → (3)

image in : IImage

[not-null]
Image descriptor of the texture to refer to. Gamma correction is controlled by the image descriptor.

format opt : TextureFormat = null

The texture format to use if the image file does not specify one. Set to null to choose a texture format from the pixel format automatically.

srgb opt : bool = true

The sRGB behaviour of the model texture, see IModelTexture.IsSrgb.

returns → IModelTexture

The model texture.

Creates a new instance of IModelTexture that refers to the given image descriptor.


public static method For4 → (1)

texture in : TexelBuffer

[not-null]
The texture data to use.

returns → IModelTexture

The model texture.

Creates a new instance of IModelTexture that uses a copy of the given texture data.


public static method For5 → (3)

pixels in : ColorBuffer

[not-null]
The pixel data to use.

format opt : TextureFormat = null

The preferred texture format or null for any suitable.

srgb opt : bool = true

The sRGB behaviour of the model texture, see IModelTexture.IsSrgb.

returns → IModelTexture

The model texture.

Creates a new instance of IModelTexture that uses the given pixel data.

Render​Target


public static method RenderTarget → (1)

handle in : RenderTargetHandle

[not-null]
The render target handle.

returns → IModelTexture

The model texture.

Creates a new instance of IModelTexture for the IRenderTarget.Texture resource of a IRenderTarget object in the graphics resource cache.

The dynamic model texture is updated by the GPU, based on the render commands that the CPU needs to submit.

Public / Methods

Slices


public static method Slices → (1)

slices in : IModelTexture [ ]

[not-null]
The texture array slices.

returns → IResourceHandle

The ITexture2D handle.

Creates a resource handle for a 2D texture array, using the given slices.

Protected / Methods

Read​Texels


[OwnerReturn]
protected method ReadTexels → (2)

format in : TextureFormat

The texture format to use. If null, it will be inferred from the pixel data (see TextureFormat.For).

srgb in : bool

The ISrgb.Srgb flags to use for encoding the pixel data.

returns → TexelBuffer

The resulting texel buffer.

Reads the pixel data into a texel buffer.

IOException

If an I/O error has occurred while reading the pixel data.

Configuration

Config


public static attribute Config → (get)

value : IConfigurator<IModelTexture>

[not-null]
The configurator object.

The configurator object for this type.