ITexture2D

Description

interface Tinman.Terrain.Rendering.ITexture2D

Derived from

ITexture

Extended by

Texture2D abstract

Base interface for two-dimensional texture resources for rendering.

The texture UV-coordinates (0,0) correspond to the top-left corner of the top-left texel/pixel and the coordinates (1,1) correspond to the bottom-right corner of the bottom-right texel/pixel (see ColorBuffer.GetPixel).

Public / Methods

Set​Texels


public method SetTexels → (6)

source in : TexelBuffer

[not-null]
The source buffer that holds the texel data.

targetIdx opt : int32 = 0

[0..ITexture2D.Count-1]
The target texture array slice.

targetX opt : int32 = 0

[0..ITexture2D.Width]
X-coordinate of top-left target texel.

targetY opt : int32 = 0

[0..ITexture2D.Height]
Y-coordinate of top-left target texel.

targetWidth opt : int32 = Maths.MaxInt

[>=0]
Width of the target texel block. Will be clamped to the maximum valid width, based on ITexelBufferInfo.Width of source in, targetX opt and targetWidth opt.

targetHeight opt : int32 = Maths.MaxInt

[>=0]
Height of the target texel block. Will be clamped to the maximum valid height, based on ITexelBufferInfo.Height of source in, targetY opt and targetHeight opt.

Updates a rectangular region of this texture with GpuUpdateFlag.Discard semantic.

The given targetX opt and targetY opt coordinates must align with the mipmap level chain, which means that they must be a multiple of:

2 ^ (Mipmaps - 1) * BlockSize

The values of ITexture.Mipmaps and ITexelBufferInfo.MipmapCount of source in should be identical. Otherwise, some texture mipmap levels will not be updated or some texel buffer mipmaps will not be used.

Public / Attributes

Count


[Constant]
public attribute Count → (get)

value : int32

[>=1]
The number of texture array slices.

The number of texture array slices.

No explicit distinction is made between regular 2D textures and texture arrays with only one slice.

Height


[Constant]
public attribute Height → (get)

value : int32

The texture height, in texels.

The texture height, in texels.

The height is always aligned with the block size of the texture format (see TextureFormat.BlockSizeAlign), which means that the actual texture height may be greater than the requested texture height that had been specified when the texture was created.

Width


[Constant]
public attribute Width → (get)

value : int32

The texture width, in texels.

The texture width, in texels.

The width is always aligned with the block size of the texture format (see TextureFormat.BlockSizeAlign), which means that the actual texture width may be greater than the requested texture width that had been specified when the texture was created.

Extensions

Set​Texels


public static method SetTexels → (4)

source in : ColorBuffer

[not-null]
The source buffer that holds the texel data.

targetIdx opt : int32 = 0

[>=0]
The target texture array slice.

targetX opt : int32 = 0

[>=0]
X-coordinate of top-left target texel.

targetY opt : int32 = 0

[>=0]
Y-coordinate of top-left target texel.

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

This method encodes the pixels and then sets the texel data by calling ITexture2D.SetTexels.