Kanzi Graphics Engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
kzu_texture.h File Reference

Abstract texture. More...

Enumerations

enum  KzuTextureDataType {
  KZU_TEXTURE_DATA_TYPE_INVALID, KZU_TEXTURE_DATA_TYPE_UNKNOWN, KZU_TEXTURE_DATA_TYPE_U8, KZU_TEXTURE_DATA_TYPE_U16,
  KZU_TEXTURE_DATA_TYPE_U24, KZU_TEXTURE_DATA_TYPE_U32, KZU_TEXTURE_DATA_TYPE_565, KZU_TEXTURE_DATA_TYPE_F16,
  KZU_TEXTURE_DATA_TYPE_F32
}
 Data type of texture data. More...
 
enum  KzuTextureChannels {
  KZU_TEXTURE_CHANNELS_INVALID, KZU_TEXTURE_CHANNELS_RGB, KZU_TEXTURE_CHANNELS_RGBA, KZU_TEXTURE_CHANNELS_LUMINANCE,
  KZU_TEXTURE_CHANNELS_ALPHA, KZU_TEXTURE_CHANNELS_LUMINANCE_ALPHA, KZU_TEXTURE_CHANNELS_DEPTH
}
 Channels of texture data. More...
 
enum  KzuTextureCompression {
  KZU_TEXTURE_COMPRESSION_NONE, KZU_TEXTURE_COMPRESSION_ETC, KZU_TEXTURE_COMPRESSION_DXT1, KZU_TEXTURE_COMPRESSION_DXT3,
  KZU_TEXTURE_COMPRESSION_DXT5, KZU_TEXTURE_COMPRESSION_ATC, KZU_TEXTURE_COMPRESSION_ATC_EXPLICIT_ALPHA, KZU_TEXTURE_COMPRESSION_ATC_INTERPOLATED_ALPHA,
  KZU_TEXTURE_COMPRESSION_PVRTC1_RGB_2BPP, KZU_TEXTURE_COMPRESSION_PVRTC1_RGBA_2BPP, KZU_TEXTURE_COMPRESSION_PVRTC1_RGB_4BPP, KZU_TEXTURE_COMPRESSION_PVRTC1_RGBA_4BPP,
  KZU_TEXTURE_COMPRESSION_PVRTC2_RGBA_2BPP, KZU_TEXTURE_COMPRESSION_PVRTC2_RGBA_4BPP
}
 Compression of texture data. More...
 
enum  KzuTextureFilter {
  KZU_TEXTURE_FILTER_INVALID, KZU_TEXTURE_FILTER_POINT_SAMPLE, KZU_TEXTURE_FILTER_BILINEAR, KZU_TEXTURE_FILTER_TRILINEAR,
  KZU_TEXTURE_FILTER_MIPMAP
}
 Supported texture filters. More...
 
enum  KzuTextureWrap { KZU_TEXTURE_WRAP_INVALID, KZU_TEXTURE_WRAP_REPEAT, KZU_TEXTURE_WRAP_CLAMP }
 Supported texture wrapping modes. More...
 

Functions

struct KzuGPUResourcekzuTextureToGPUResource (const struct KzuTexture *texture)
 Converts texture to GPU resource. More...
 
struct KzuTexturekzuTextureFromGPUResource (const struct KzuGPUResource *gpuResource)
 Converts GPU resource to texture. More...
 
struct KzuResourcekzuTextureToResource (const struct KzuTexture *texture)
 Converts texture to resource. More...
 
struct KzuTexturekzuTextureFromResource (const struct KzuResource *resource)
 Converts resource to texture. More...
 
struct KzuTexturekzuTextureCastFromResource (const struct KzuResource *resource)
 Casts texture from resource, KZ_NULL if invalid type. More...
 
enum KzuTextureDataType kzuTextureGetDataType (const struct KzuTexture *texture)
 Gets the data type of a texture. More...
 
enum KzuTextureChannels kzuTextureGetChannels (const struct KzuTexture *texture)
 Gets the channels of a texture. More...
 
enum KzuTextureCompression kzuTextureGetCompression (const struct KzuTexture *texture)
 Gets the compression of a texture. More...
 
kzBool kzuTextureHasAlphaChannel (const struct KzuTexture *texture)
 Checks if a texture has an alpha channel. More...
 
kzUint kzuTextureGetWidth (const struct KzuTexture *texture)
 Gets the width of a texture. More...
 
kzUint kzuTextureGetHeight (const struct KzuTexture *texture)
 Gets the height of a texture. More...
 
void kzuTextureSetFilter (struct KzuTexture *texture, enum KzuTextureFilter filter)
 Sets the filter of a texture. More...
 
enum KzuTextureFilter kzuTextureGetFilter (const struct KzuTexture *texture)
 Gets the filter of a texture. More...
 
void kzuTextureSetWrap (struct KzuTexture *texture, enum KzuTextureWrap wrap)
 Sets the wrap mode of a texture. More...
 
enum KzuTextureWrap kzuTextureGetWrap (const struct KzuTexture *texture)
 Gets the wrap mode of a texture. More...
 
void kzuTextureSetAnisotropy (struct KzuTexture *texture, kzFloat anisotropy)
 Set maximum texture anisotropy. More...
 
kzFloat kzuTextureGetAnisotropy (const struct KzuTexture *texture)
 Get desired texture anisotropy. More...
 
kzBool kzuTextureIsRenderable (const struct KzuTexture *texture)
 Returns true if the texture is deployed and valid. More...
 
kzsError kzuTextureBind (struct KzuTexture *texture)
 Binds the texture for rendering. More...
 
kzsError kzuTextureUnbind (struct KzuTexture *texture)
 Unbinds the texture from rendering. More...
 

Variables

const KzuResourceType KZU_RESOURCE_TYPE_TEXTURE
 Resource type identifier for texture. More...
 

Detailed Description

Abstract texture.

Copyright 2008-2019 by Rightware. All rights reserved.

Enumeration Type Documentation

Data type of texture data.

Enumerator
KZU_TEXTURE_DATA_TYPE_INVALID 

Invalid texture data type.

KZU_TEXTURE_DATA_TYPE_UNKNOWN 

Unknown texture data type, e.g.

due to compression.

KZU_TEXTURE_DATA_TYPE_U8 

8-bit integer data type.

KZU_TEXTURE_DATA_TYPE_U16 

16-bit integer data type.

KZU_TEXTURE_DATA_TYPE_U24 

24-bit integer data type.

KZU_TEXTURE_DATA_TYPE_U32 

32-bit integer data type.

KZU_TEXTURE_DATA_TYPE_565 

RGB565 packed data type.

KZU_TEXTURE_DATA_TYPE_F16 

16-bit floating point data type (half-float).

KZU_TEXTURE_DATA_TYPE_F32 

32-bit floating point data type.

Channels of texture data.

Enumerator
KZU_TEXTURE_CHANNELS_INVALID 

Invalid texture channels.

KZU_TEXTURE_CHANNELS_RGB 

Red, Green and Blue channels.

KZU_TEXTURE_CHANNELS_RGBA 

Red, Green, Blue and Alpha channels.

KZU_TEXTURE_CHANNELS_LUMINANCE 

Luminance channel only.

KZU_TEXTURE_CHANNELS_ALPHA 

Alpha channel only.

KZU_TEXTURE_CHANNELS_LUMINANCE_ALPHA 

Luminance and Alpha channels.

KZU_TEXTURE_CHANNELS_DEPTH 

Depth channel only.

Compression of texture data.

Enumerator
KZU_TEXTURE_COMPRESSION_NONE 

No compression.

KZU_TEXTURE_COMPRESSION_ETC 

ETC compression (no alpha).

KZU_TEXTURE_COMPRESSION_DXT1 

DXT1 compression (with alpha).

KZU_TEXTURE_COMPRESSION_DXT3 

DXT3 compression (with alpha).

KZU_TEXTURE_COMPRESSION_DXT5 

DXT5 compression (with alpha).

KZU_TEXTURE_COMPRESSION_ATC 

ATC compression without alpha.

KZU_TEXTURE_COMPRESSION_ATC_EXPLICIT_ALPHA 

ATC compression with explicit alpha.

KZU_TEXTURE_COMPRESSION_ATC_INTERPOLATED_ALPHA 

ATC compression with interpolated alpha.

KZU_TEXTURE_COMPRESSION_PVRTC1_RGB_2BPP 

PVRTC1 compression, 2 bits per pixel.

KZU_TEXTURE_COMPRESSION_PVRTC1_RGBA_2BPP 

PVRTC1 compression, 2 bits per pixel.

KZU_TEXTURE_COMPRESSION_PVRTC1_RGB_4BPP 

PVRTC1 compression, 4 bits per pixel.

KZU_TEXTURE_COMPRESSION_PVRTC1_RGBA_4BPP 

PVRTC1 compression, 4 bits per pixel.

KZU_TEXTURE_COMPRESSION_PVRTC2_RGBA_2BPP 

PVRTC2 compression, 2 bits per pixel.

KZU_TEXTURE_COMPRESSION_PVRTC2_RGBA_4BPP 

PVRTC2 compression, 4 bits per pixel.

Supported texture filters.

Enumerator
KZU_TEXTURE_FILTER_INVALID 

Invalid texture filter.

KZU_TEXTURE_FILTER_POINT_SAMPLE 

Point sample filter.

KZU_TEXTURE_FILTER_BILINEAR 

Bilinear filter.

KZU_TEXTURE_FILTER_TRILINEAR 

Trilinear filter.

KZU_TEXTURE_FILTER_MIPMAP 

Mipmap point sample filter.

Supported texture wrapping modes.

Enumerator
KZU_TEXTURE_WRAP_INVALID 

Invalid texture wrap mode.

KZU_TEXTURE_WRAP_REPEAT 

Repeating texture, maps points outside [0, 1] inside the ares by repeating texture.

KZU_TEXTURE_WRAP_CLAMP 

Clamp texture, points outside [0, 1] are sampled from texture edges.

Function Documentation

struct KzuGPUResource* kzuTextureToGPUResource ( const struct KzuTexture texture)

Converts texture to GPU resource.

struct KzuTexture* kzuTextureFromGPUResource ( const struct KzuGPUResource gpuResource)

Converts GPU resource to texture.

struct KzuResource* kzuTextureToResource ( const struct KzuTexture texture)

Converts texture to resource.

struct KzuTexture* kzuTextureFromResource ( const struct KzuResource resource)

Converts resource to texture.

struct KzuTexture* kzuTextureCastFromResource ( const struct KzuResource resource)

Casts texture from resource, KZ_NULL if invalid type.

enum KzuTextureDataType kzuTextureGetDataType ( const struct KzuTexture texture)

Gets the data type of a texture.

enum KzuTextureChannels kzuTextureGetChannels ( const struct KzuTexture texture)

Gets the channels of a texture.

enum KzuTextureCompression kzuTextureGetCompression ( const struct KzuTexture texture)

Gets the compression of a texture.

kzBool kzuTextureHasAlphaChannel ( const struct KzuTexture texture)

Checks if a texture has an alpha channel.

kzUint kzuTextureGetWidth ( const struct KzuTexture texture)

Gets the width of a texture.

kzUint kzuTextureGetHeight ( const struct KzuTexture texture)

Gets the height of a texture.

void kzuTextureSetFilter ( struct KzuTexture texture,
enum KzuTextureFilter  filter 
)

Sets the filter of a texture.

enum KzuTextureFilter kzuTextureGetFilter ( const struct KzuTexture texture)

Gets the filter of a texture.

void kzuTextureSetWrap ( struct KzuTexture texture,
enum KzuTextureWrap  wrap 
)

Sets the wrap mode of a texture.

enum KzuTextureWrap kzuTextureGetWrap ( const struct KzuTexture texture)

Gets the wrap mode of a texture.

void kzuTextureSetAnisotropy ( struct KzuTexture texture,
kzFloat  anisotropy 
)

Set maximum texture anisotropy.

This specifies the amount of anisotropy to improve image quality on surfaces angled obliquely away from the viewer. In this case, 1.0f would be the default, isotropic texture for cases where projection of pixel filter footprint into texture space is square. Values of 1.0f and smaller turn off the anisotropy completely (this is the default mode of operation).

kzFloat kzuTextureGetAnisotropy ( const struct KzuTexture texture)

Get desired texture anisotropy.

kzBool kzuTextureIsRenderable ( const struct KzuTexture texture)

Returns true if the texture is deployed and valid.

kzsError kzuTextureBind ( struct KzuTexture texture)

Binds the texture for rendering.

kzsError kzuTextureUnbind ( struct KzuTexture texture)

Unbinds the texture from rendering.

Variable Documentation

const KzuResourceType KZU_RESOURCE_TYPE_TEXTURE

Resource type identifier for texture.