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

interface ITexture2D in Tinman.Terrain.Rendering

Base interface for two-dimensional texture resources for rendering.

interface ITexture2D extends ITexture
  base of Texture2D

Attributes

BitsPerTexel

The number of bits per texture pixel.

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

CanCopyTexels

Is this a texture data object, to be used to update the content of another texture object?

property CanCopyTexels { get }
type bool
value true if this is a texture data object.
false if this is a regular texture object.

Remarks:

Texture data objects cannot be used for rendering.

See also:

CopyTexels

CanSetTexels

Can the content of this texture be updated?

property CanSetTexels { get }
type bool
value true if this texture is dynamic and its content can be updated.
false if this texture is static and its content cannot be updated.

See also:

SetTexels

Format

The texture format.

property Format { get }
type TextureFormat
value [not-null] The texture format.
inherited ITexture.Format

HasAlpha

Returns if texture pixels carry transparency data.

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

Height

The texture height, in texels.

property Height { get }
type int32
value The texture height, in texels.

IsSrgb

The sRGB behaviour of this texture.

property IsSrgb { get }
type bool
value The sRGB behaviour flag.
inherited ITexture.IsSrgb

Remarks:

When true, the GPU is supposed to do on-the-fly sRGB decompression for the texture object (e.g. in Direct3D 10+ by using DXGI_FORMAT_B8G8R8X8_UNORM_SRGB), so that the GPU shader receives linear color values. Depending on the underlying graphics API, it may be necessary to specify this sRGB behaviour in the shader effect source code (e.g. in a Direct3D 9 '.fx' file via SRGBTexture=true;, to enable the D3DSAMP_SRGBTEXTURE sampler state).

LifecycleState

Returns the lifecycle state of this object.

property LifecycleState { get }
type LifecycleState
value The lifecycle state.
inherited ILifecycleState.LifecycleState

MemoryConsumption

Returns the estimated memory consumption of this object.

property MemoryConsumption { get }
type int64
value [>=0] The estimated memory consumption, in bytes.
inherited IMemoryConsumption.MemoryConsumption

Mipmaps

The number of mipmap levels.

property Mipmaps { get }
type int32
value [>=0] The number of mipmap levels.
inherited ITexture.Mipmaps

NativeHandle

Returns the raw handle value of the native resource that is contained in this object.

property NativeHandle { get }
type IntPtr
value The raw handle value.
inherited INativeHandle.NativeHandle

Remarks:

The documentation of the implementing class will contain information on how to interpret the raw handle value.

Width

The texture width, in texels.

property Width { get }
type int32
value The texture width, in texels.

Methods

AcquireTry

Acquires a strong reference to this disposable object.

[OwnerReturn, ThreadSafe]
method AcquireTry ()
type IDisposable
returns this if a new strong reference has been acquired, null if this object is already being disposed.
inherited IDisposable.AcquireTry

Remarks:

The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls the AcquireTry method is responsible for calling the Dispose method accordingly.

This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.

CopyTexels

Copies a rectangular subset of texels from this texture data object to the given texture object.

method CopyTexels (ITexture2D target, int32 sourceX = 0, int32 sourceY = 0, int32 targetX = 0, int32 targetY = 0, int32 width = 0, int32 height = 0)
params target [not-null] The target texture object.
  sourceX [0..Width-width] X-coordinate of top-left corner of source rectangle. Defaults to 0.
  sourceY [0..Height-height] Y-coordinate of top-left corner of source rectangle. Defaults to 0.
  targetX [0..target.Width-width] X-coordinate of top-left corner of target rectangle. Defaults to 0.
  targetY [0..target.Height-height] Y-coordinate of top-left corner of target rectangle. Defaults to 0.
  width [>=0] Width of rectangle, in texels. If 0 the maximum valid width will be used. Defaults to 0.
  height [>=0] Height of rectangle, in texels. If 0 the maximum valid height will be used. Defaults to 0.

Remarks:

The following parameters must be a multiple of the texture format block size (see BlockSize), to make sure the copy operation can be performed on whole texel blocks:
sourceX, sourceY, targetX, targetY, width, height.

Exceptions:

Dispose

Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.

[Dispose, OwnerThis, ThreadSafe]
method Dispose ()
inherited IDisposable.Dispose

Remarks:

The Dispose method silently returns if the object has already been disposed.

SetTexels

Copies a region of texels from the given buffer to this texture data object.

method SetTexels (TexelBuffer source, int32 targetX = 0, int32 targetY = 0)
params source [not-null] The source buffer that holds the texel data.
  targetX [0..Width-source.Width] X-coordinate of top-left target texel. Defaults to 0.
  targetY [0..Height-source.Height] Y-coordinate of top-left target texel. Defaults to 0.

Remarks:

If CanCopyTexels of this texture object returns false, a temporary texture data object is created, the SetTexels method is called on that texture object and finally CopyTexels is used to update this texture object. Otherwise, the content of this texture data object is updated directly.

Exceptions:

Extensions

SetTexels

Copies a region of pixels from the given buffer to this texture data object, encoding them as necessary.

method SetTexels (ColorBuffer source, int32 targetX = 0, int32 targetY = 0)
params source [not-null] The source buffer that holds the texel data.
  targetX [>=0] X-coordinate of top-left target texel. Defaults to 0.
  targetY [>=0] Y-coordinate of top-left target texel. Defaults to 0.

Remarks:

This method encodes the pixels and then sets the texel data.