TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class TextureFormat in Tinman.Terrain.Rendering

A TextureFormat object represents a binary texel format.

abstract class TextureFormat implements IBitsPerTexel
  IConfigurable
  extends SerializableBase

Configuration

Config

The configurator object for this type.

public static readonly field Config
type IConfigurator<TextureFormat>

ToConfig

Returns the configuration value that describes this object.

public method ToConfig ()
type ConfigValue
returns [not-null] The configuration value.
implements IConfigurable.ToConfig

Remarks:

All configurable objects need to implement this interface. For simple types, it is preferable to delegate to ToValue.

The returned value may be of type Invalid, which means that this object in its current state cannot be described with the configuration API.

Before returning the resulting configuration value, Cache must be called on it, passing this IConfigurable object as parameter.

Public / Constants

A1R5G5B5

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

public static readonly field A1R5G5B5
type TextureFormat

A4R4G4B4

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

public static readonly field A4R4G4B4
type TextureFormat

A8L8

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

public static readonly field A8L8
type TextureFormat

Remarks:

The red, green and blue channels store the grayscale value.

A8R8G8B8

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

public static readonly field A8R8G8B8
type TextureFormat

BC1

Block compressed format (4 bits per texel: truecolor, 1-bit alpha).

public static readonly field BC1
type TextureFormat

BC3

Block compressed format (8 bits per texel: truecolor, alpha).

public static readonly field BC3
type TextureFormat

L16

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

public static readonly field L16
type TextureFormat

Remarks:

The red, green and blue channels store the grayscale value. The alpha channel value is 65535.

L8

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

public static readonly field L8
type TextureFormat

Remarks:

The red, green and blue channels store the grayscale value. The alpha channel value is 255.

R16

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

public static readonly field R16
type TextureFormat

Remarks:

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

R5G6B5

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

public static readonly field R5G6B5
type TextureFormat

R8

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

public static readonly field R8
type TextureFormat

Remarks:

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

Public / Attributes

BitsPerTexel

The number of bits per texture pixel.

public property BitsPerTexel { get }
type int32
value [>0] The number of bits per pixel.
implements IBitsPerTexel.BitsPerTexel

BlockSize

The texel block size of this texture format.

public property BlockSize { get }
type int32
value [pow2] The texel block size.

Remarks:

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

HasAlpha

Returns if texture pixels carry transparency data.

public property HasAlpha { get }
type bool
value true if texture pixels can be transparent, false if all texture pixels will always be fully opaque.
implements IBitsPerTexel.HasAlpha

Name

The name of this texture format.

public property Name { get }
type string
value [not-null] The texture format name.

PixelFormat

Returns the pixel format of this texture format.

public abstract property PixelFormat { get }
type PixelFormat
value The pixel format.

SerialType

Returns the serial type of this object.

public property SerialType { get }
type ISerialTypeInfo
value [not-null] The serial type.
inherited SerializableBase.SerialType

SerialVersion

Returns the serial data version.

public virtual property SerialVersion { get }
type int32
value [>=1] The serial data version tag.
inherited SerializableBase.SerialVersion

Remarks:

An ISerializable implementation is required to support all versions up to the one returned by SerialVersion.

See also:

ISerializable.Serialize
ISerializable.Deserialize

Public / Methods

BlockSizeAlign

[Pure]
public method BlockSizeAlign (int32 x)
type int32
params x

CheckBlockSizeAlignment

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

[Pure]
public method CheckBlockSizeAlignment (int32 x, int32 y)
type bool
params x X-coordinate of top-left texel rectangle.
  y Y-coordinate of top-left texel rectangle.
returns true if the texel location is properly aligned to the block size, false if not.

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

[Pure]
public method CheckBlockSizeAlignment (int32 x, int32 y, int32 width, int32 height)
type bool
params x X-coordinate of top-left texel rectangle.
  y Y-coordinate of top-left texel rectangle.
  width Width of texel rectangle.
  height Height of texel rectangle.
returns true if the texel rectangle is properly aligned to the block size, false if not.

CreateBuffer

Creates a texel buffer for this texture format.

[OwnerReturn]
public method CreateBuffer (int32 width, int32 height, int32 mipmaps = 1)
type TexelBuffer
params width [>0] The buffer width, in texels.
  height [>0] The buffer height, in texels.
  mipmaps [>=0] The number of mipmap levels (including the full-resolution level). If 0 the number of levels will be inferred from width and height (see MipmapLevelsRect). Defaults to 1.
returns [not-null] The created TexelBuffer object.

Deserialize

Initializes the state of this object from the given data stream.

public virtual method Deserialize (int32 serialVersion, ISerializer data)
type ISerializable
params serialVersion [>=1] The serial data version.
  data [not-null] The serial data stream.
returns [not-null] The deserialized object. This will typically be this, but in some circumstances, another instance may be returned (e.g. singletons).
inherited SerializableBase.Deserialize

Remarks:

The Deserialize method will be called immediately after the object has been instantiated via its default constructor.

The provided serialVersion number is guaranteed to be equal to or less than the SerialVersion returned by this object (i.e. ISerializable object must provide backwards compatibility).

See also:

ISerializable.Serialize
ISerializable.SerialVersion

For

Returns the default TextureFormat for the given PixelFormat.

[Pure]
public static method For (PixelFormat pixelFormat)
type TextureFormat
params pixelFormat The pixel format.
returns [not-null] The default TextureFormat.

Generalize

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

public virtual method Generalize ()
type TextureFormat
returns The texture format that is more general or null if this texture format cannot be generalized.

Remarks:

This default implementation establishes the following mappings for the pre-defined texture formats:

Subclasses may override this method in order to provide a custom mapping.

Serialize

Serializes the current state of this object to the given data stream.

public virtual method Serialize (ISerializer data)
params data [not-null] The serial data stream.
inherited SerializableBase.Serialize

See also:

ISerializable.Deserialize
ISerializable.SerialVersion

Protected / Constructors

TextureFormat

Creates a new instance of TextureFormat.

protected constructor TextureFormat (ISerialTypeInfo serialType, string name, int32 bitsPerTexel, bool hasAlpha, int32 blockSize = 1)
params serialType [not-null] The serial type ID.
  name [not-empty] The texture format name.
  bitsPerTexel [>0] Number of bits per texel.
  hasAlpha Does this texture format include transparency information?
  blockSize [>0] The texel block size. Defaults to 1.

Protected / Methods

CreateBuffer

Creates a texel buffer for this texture format.

[OwnerReturn]
protected abstract method CreateBuffer (int32 width, int32 height, [Owner] TexelBuffer mipmap)
type TexelBuffer
params width The buffer width, in texels.
  height The buffer height, in texels.
  mipmap The next smaller mipmap level or null.
returns [not-null] The created texel buffer.