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

class TextureFactory in Tinman.Terrain.Rendering

Abstract base class for ITextureFactory implementations.

abstract class TextureFactory implements ITextureFactory
  base of DirectX11TextureFactory
  DirectX9TextureFactory

Remarks

These protected fields must be initialized by subclasses in the constructor:

The default implementation of ValidateTextureFormat uses Generalize

Public / Attributes

AvailableVideoMemory

Returns the amount of available video memory.

public property AvailableVideoMemory { get }
type int64
value [>=0] The amount of available video memory, in bytes.
implements ITextureFactory.AvailableVideoMemory

Public / Methods

CreateTexture2D

Creates a static ITexture2D object (i.e. CanSetTexels and CanCopyTexels return false).

[OwnerReturn]
public method CreateTexture2D (TexelBuffer buffer, bool warn = true)
type ITexture2D
params buffer [not-null] The buffer that holds the texture content. The Srgb flag of this buffer defines the sRGB behaviour of the created texture (see IsSrgb).
  warn Emit a warning log message if the TextureFormat of the given buffer needs to be converted to a supported format? Defaults to true.
returns [not-null] The ITexture2D object.
implements ITextureFactory.CreateTexture2D

Remarks:

The texel buffer size is validated (see ValidateTextureSize) before the texture is created, so the size of the returned ITexture2D object might be different to Width and/or Height.

The ValidateTextureFormat method will be called to find a supported texture format for the given texture contents (see Format), and the texture contents will be transcoded, if necessary.


Creates a dynamic ITexture2D object (i.e. CanSetTexels returns true).

[OwnerReturn]
public method CreateTexture2D (int32 width, int32 height, TextureFormat format, int32 mipmaps = 1, bool data = false, bool srgb = true)
type ITexture2D
params width [>0] The texture width, in texels.
  height [>0] The texture height, in texels.
  format [not-null] The texture format (will be returned by Format).
  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. Defaults to 1.
  data Create a texture data object (i.e. CanCopyTexels returns true)? Defaults to false.
  srgb The sRGB behaviour of the created texture (see IsSrgb). Defaults to true.
returns [not-null] The ITexture2D object.
implements ITextureFactory.CreateTexture2D

Remarks:

The given texture size is validated (see ValidateTextureSize) before the texture is created, so the size of the returned ITexture2D object might be different to width and/or height.

See also:

ITextureFactory.ValidateTextureSize
ITextureFactory.ValidateTextureFormat

Exceptions:

ValidateTextureFormat

Checks if this texture factory supports the given texture format. If not it returns a supported format that matches format as closely as possible.

[Pure]
public method ValidateTextureFormat (TextureFormat format)
type TextureFormat
params format The texture format.
returns [not-null] The supported texture format to use.
implements ITextureFactory.ValidateTextureFormat

ValidateTextureSize

Validates the given texture size by adjusting the width and height according to the texture size restrictions of this factory (e.g. must-be-square).

[Pure]
public method ValidateTextureSize (int32 width, int32 height)
type Vec2I
params width The texture width.
  height The texture height.
returns The validated texture size.
implements ITextureFactory.ValidateTextureSize

Protected / Attributes

availableVideoMemory

The available video memory, in bytes.

protected field availableVideoMemory
type int64

Remarks:

This field must be initialized by subclasses during construction.

textureSizeMaximum

The maximum texture size (always a power of two).

protected field textureSizeMaximum
type int32

Remarks:

This field must be initialized by subclasses during construction.

textureSizeMustBePowerOfTwo

The texture size must be a power of two, but width and height can still be different.

protected field textureSizeMustBePowerOfTwo
type bool

Remarks:

This field must be initialized by subclasses during construction.

textureSizeMustBeSquare

Textures must be square, i.e. width and height must be equal?.

protected field textureSizeMustBeSquare
type bool

Remarks:

This field must be initialized by subclasses during construction.

Protected / Methods

DoCreateTexture2D

Creates a new instance of ITexture2D.

[OwnerReturn]
protected abstract method DoCreateTexture2D (int32 width, int32 height, int32 mipmaps, TextureFormat format, bool data, bool srgb, TexelBuffer content)
type ITexture2D
params width The validated texture width.
  height The validated texture height.
  mipmaps The validated mipmap level count.
  format The validated texture format.
  data Create a data texture?
  srgb The sRGB behaviour of the created texture (see IsSrgb). Defaults to true.
  content The static texture content or null to create a dynamic texture.
returns [not-null] The created texture.

DoValidateTextureFormat

Validates the given texture format for use with this graphics context.

protected abstract method DoValidateTextureFormat (TextureFormat format)
type bool
params format The texture format.
returns true if format can be used with this graphics context, false if not.

Logging

Logger

The logger object of this class.

public static readonly field Logger
type ILogger