TextureFormat

Description

[ShutdownSurvive]
abstract class Tinman.Terrain.Rendering.TextureFormat

Derived from

SerializableBase abstract
IConfigurable

Extended by

Example_TextureFormat sealed

A TextureFormat object represents a binary texel format.

A custom implementation must override the FormatIdentifier methods and should provide meaningful mappings in Generalize. The following texture formats are the most common ones and will usually be supported by most graphics contexts:

Public / Constants

A16​B16​G16​R16


public static readonly attribute A16B16G16R16 → (TextureFormat)

16-bit channels for alpha, red, green and blue (64 bits per texel, uncompressed).

This texture format generalizes to:

A16​R16​G16​B16


public static readonly attribute A16R16G16B16 → (TextureFormat)

16-bit channels for alpha, red, green and blue (64 bits per texel, uncompressed).

This texture format generalizes to:

A1​B5​G5​R5


public static readonly attribute A1B5G5R5 → (TextureFormat)

1-bit channel for alpha, 5-bit channels for red, green and blue (16 bits per texel, uncompressed).

This texture format generalizes to:

A1​R5​G5​B5


public static readonly attribute A1R5G5B5 → (TextureFormat)

1-bit channel for alpha, 5-bit channels for red, green and blue (16 bits per texel, uncompressed).

This texture format generalizes to:

A2​B10​G10​R10


public static readonly attribute A2B10G10R10 → (TextureFormat)

2-bit channel for alpha, 10-bit channels for red, green and blue (32 bits per texel, uncompressed).

This texture format generalizes to:

A2​R10​G10​B10


public static readonly attribute A2R10G10B10 → (TextureFormat)

2-bit channel for alpha, 10-bit channels for red, green and blue (32 bits per texel, uncompressed).

This texture format generalizes to:

A4​B4​G4​R4


public static readonly attribute A4B4G4R4 → (TextureFormat)

4-bit channels for alpha, red, green and blue (16 bits per texel, uncompressed).

This texture format generalizes to:

A4​R4​G4​B4


public static readonly attribute A4R4G4B4 → (TextureFormat)

4-bit channels for alpha, red, green and blue (16 bits per texel, uncompressed).

This texture format generalizes to:

A8​B8​G8​R8


public static readonly attribute A8B8G8R8 → (TextureFormat)

8-bit channels for alpha, red, green and blue (32 bits per texel, uncompressed).

This texture format generalizes to:

A8​L8


public static readonly attribute A8L8 → (TextureFormat)

8-bit channels for alpha and luminance resp. grayscale (16 bits per texel, uncompressed).

This texture format generalizes to:

The luminance value is replicated into the red, green and blue channels.

A8​R8​G8​B8


public static readonly attribute A8R8G8B8 → (TextureFormat)

8-bit channels for alpha, red, green and blue (32 bits per texel, uncompressed).

This texture format generalizes to:

B5​G6​R5


public static readonly attribute B5G6R5 → (TextureFormat)

5-bit channel for red, 6-bit channel for green, 5-bit channel for blue (16 bits per texel, uncompressed).

This texture format generalizes to:

The normalized alpha channel value is 1.

BC1


public static readonly attribute BC1 → (TextureFormat)

1-bit channel for alpha, 5-bit channels for red and blue, 5-bit channel for green (4 bits per texel, using 4x4 block compression).

This texture format generalizes to:

  1. BC3

BC3


public static readonly attribute BC3 → (TextureFormat)

8-bit channel for alpha, 5-bit channels for red and blue, 5-bit channel for green (8 bits per texel, using 4x4 block compression).

This texture format generalizes to:

BC4


public static readonly attribute BC4 → (TextureFormat)

8-bit channel for red (4 bits per texel, using 4x4 block compression).

This texture format generalizes to:

The normalized alpha channel value is 1.

BC5


public static readonly attribute BC5 → (TextureFormat)

8-bit channels for red and green (8 bits per texel, using 4x4 block compression).

This texture format generalizes to:

The normalized alpha channel value is 1.

G16​R16


public static readonly attribute G16R16 → (TextureFormat)

16-bit channels for red and green (32bits per texel, uncompressed).

This texture format generalizes to:

The blue channel values are undefined.
The normalized alpha channel value is 1.

G8​R8


public static readonly attribute G8R8 → (TextureFormat)

8-bit channels for red and green (16 bits per texel, uncompressed).

This texture format generalizes to:

The blue channel values are undefined.
The normalized alpha channel value is 1.

L16


public static readonly attribute L16 → (TextureFormat)

16-bit channel for luminance resp. grayscale (16 bits per texel, uncompressed).

This texture format generalizes to:

The luminance value is replicated into the red, green and blue channels.
The normalized alpha channel value is 1.

L8


public static readonly attribute L8 → (TextureFormat)

8-bit channel for luminance resp. grayscale (8 bits per texel, uncompressed).

This texture format generalizes to:

The luminance value is replicated into the red, green and blue channels.
The normalized alpha channel value is 1.

R16


public static readonly attribute R16 → (TextureFormat)

16-bit channel for red (16 bits per texel, uncompressed).

This texture format generalizes to:

The green and blue channel values are undefined.
The normalized alpha channel value is 1.

R5​G6​B5


public static readonly attribute R5G6B5 → (TextureFormat)

5-bit channel for red, 6-bit channel for green, 5-bit channel for blue (16 bits per texel, uncompressed).

This texture format generalizes to:

The normalized alpha channel value is 1.

R8


public static readonly attribute R8 → (TextureFormat)

8-bit channel for red (8 bits per texel, uncompressed).

This texture format generalizes to:

The green and blue channel values are undefined.
The normalized alpha channel value is 1.

Public / Methods

Bits​Per​Component


public method BitsPerComponent → (1)

component in : int32

The texel component:
0 : red
1 : green
2 : blue
3 : alpha
4 : intensity

returns → int32

The number of effective bits per texel component. Will be 0 iff the texel component is not present.

Returns the effective number of bits that are used to encode the given texel component.

This value represents the number of bits that are used to encode component in as input to a possible texel compression scheme (for example BC1). In this case, the sum of BitsPerComponent will be greater than BitsPerTexel.

Block​Size​Align


[Pure]
public method BlockSizeAlign → (1)

in : int32

The size value.

returns → int32

The aligned size value.

Aligns the given size value with the block size of this texture format.

Check​Block​Size​Alignment

2 overloads


[Pure]
public method CheckBlockSizeAlignment1 → (2)

in : int32

X-coordinate of top-left texel rectangle.

in : int32

Y-coordinate of top-left texel rectangle.

returns → bool

true if the texel location is properly aligned to the block size, false if not.

Checks if the given texel location is aligned to this texture formats block size.


[Pure]
public method CheckBlockSizeAlignment2 → (6)

in : int32

X-coordinate of top-left texel rectangle.

in : int32

Y-coordinate of top-left texel rectangle.

width in : int32

Width of texel rectangle.

height in : int32

Height of texel rectangle.

widthMax in : int32

The width of the whole texture..

heightMax in : int32

The height of the whole texture.

returns → bool

true if the texel rectangle is properly aligned to the block size, false if not.

Checks if the given texel rectangle is aligned to this texture formats block size.

Create​Buffer


[OwnerReturn]
public method CreateBuffer → (3)

width in : int32

[>0]
The buffer width, in texels.

height in : int32

[>0]
The buffer height, in texels.

mipmaps opt : int32 = 1

[>=0]
The number of mipmap levels (including the full-resolution level). If 0 the number of levels will be inferred from width in and height in (see RenderingUtil.MipmapLevelsRect).

returns → TexelBuffer

The created TexelBuffer object.

Creates a texel buffer for this texture format.

For


[Pure]
public static method For → (1)

pixelFormat in : PixelFormat

The pixel format.

returns → TextureFormat

The default TextureFormat.

Returns the default TextureFormat for the given PixelFormat.

Format​Identifier


public virtual method FormatIdentifier → (2)

factory in : ITextureFactory

[not-null]
The texture factory.

srgb in : bool

The sRGB behaviour.

returns → Vec4I

The texture format identifier or Vec4I.Zero if none.

Returns the identifier for this texture format, as defined by the graphics API that is associated with the given texture factory.

Custom implementations of TextureFormat must override this method, in order to provide the correct format identifier.

The default implementation returns -1.

Generalize


[EmptyBody]
public abstract method Generalize → (1)

choices in : IVector<TextureFormat>

[not-null]
List of choices for alternative texture formats. The choices are probed in the order as they have been added to the list.

Returns a texture format that is capable of storing all information of this one (i.e. conversion is lossless) but is more general in terms of being supported by some GPU.

The documentation of the built-in texture formats shows the generalization list.

Public / Attributes

All


public static attribute All → (get)

value : IVectorConst<TextureFormat>

[not-null]
A list of all pre-defined TextureFormats.

Returns all pre-defined TextureFormats.

Bits​Per​Texel


public attribute BitsPerTexel → (get)

value : int32

[>0]
The number of storage bits per texture pixel.

The number of bits that must be stored per texture pixel.

This values represents the number of bits that result from applying a possible texel compression scheme (for example BC1). In this case, this value will be less than the sum of BitsPerComponent.

Block​Size


public attribute BlockSize → (get)

value : int32

[pow2]
The texel block size.

The texel block size of this texture format.

Uncompressed texture formats have a block size of 1. Texels accesses must always be aligned to the block size.

Bytes​Per​Block


public attribute BytesPerBlock → (get)

value : int32

[>0]
The number of bytes per texel block.

Returns the number of bytes per texel block.

Name


public attribute Name → (get)

value : string

[not-null]
The texture format name.

The name of this texture format.

Pixel​Format


public attribute PixelFormat → (get)

value : PixelFormat

The pixel format.

Returns the pixel format that best describes this texture format.

Protected / Constructors

Texture​Format


protected constructor TextureFormat → (9)

serialType in : ISerialTypeInfo

[not-null]
The serial type ID.

name in : string

[not-empty]
The texture format name.

bitsPerTexel in : int32

[>0]
Number of storage bits per texel (see BitsPerTexel).

bitsPerRed in : int32

[>=0]
Number of effective bits per red component (see BitsPerComponent).

bitsPerGreen opt : int32 = 0

[>=0]
Number of effective bits per green component (see BitsPerComponent).

bitsPerBlue opt : int32 = 0

[>=0]
Number of effective bits per blue component (see BitsPerComponent).

bitsPerAlpha opt : int32 = 0

[>=0]
Number of effective bits per alpha component (see BitsPerComponent).

bitsPerIntensity opt : int32 = 0

[>=0]
Number of effective bits per intensity component (see BitsPerComponent).

blockSize opt : int32 = 1

[>0]
The texel block size.

Creates a new instance of TextureFormat.

Protected / Methods

Create​Buffer


[OwnerReturn]
protected abstract method CreateBuffer → (3)

width in : int32

The buffer width, in texels.

height in : int32

The buffer height, in texels.

mipmap in : TexelBuffer own

The next smaller mipmap level or null.

returns → TexelBuffer

The created texel buffer.

Creates a texel buffer for this texture format.

Configuration

Config


public static attribute Config → (get)

value : IConfigurator<TextureFormat>

[not-null]
The configurator object.

The configurator object for this type.