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

Texture base definitions. More...

Data Structures

struct  KzuTextureClass
 Defines functions for different texture types. More...
 
struct  KzuTexture
 Abstract texture. More...
 

Typedefs

typedef kzsError(* KzuTextureBindFunction )(struct KzuTexture *texture)
 Function type for applying texture for rendering. More...
 
typedef kzsError(* KzuTextureUnbindFunction )(struct KzuTexture *texture)
 Function type for detaching the texture from rendering. More...
 

Functions

kzsError kzuTextureCreate_protected (struct KzuTexture *texture, const struct KzuTextureClass *textureClass, struct KzuResourceManager *resourceManager, kzString name, struct KzuResourceLoader *loader)
 Base function for creating textures. More...
 
kzsError kzuTextureInitialize_protected (struct KzuTexture *texture, enum KzuTextureFilter filter, enum KzuTextureWrap wrap, kzFloat anisotropy)
 Base function for initializing a texture. More...
 
kzsError kzuTextureDestructor_protected (struct KzuResource *resource)
 Base destructor for textures. More...
 
kzsError kzuTextureLoadFromKZB_protected (struct KzuResource *resource, const struct KzuResourceLoaderThreadContext *threadContext, struct KzcInputStream *inputStream, struct KzuBinaryFileInfo *file)
 Base function for loading textures from .KZB. More...
 
kzsError kzuTextureFinishLoading_protected (struct KzuResource *resource, const struct KzuResourceLoaderThreadContext *threadContext)
 Base function for finishing the loading of textures. More...
 
kzsError kzuTextureUnload_protected (struct KzuResource *resource)
 Base function for unloading textures. More...
 
kzUint kzuTextureGetCPUMemoryUsage_protected (const struct KzuResource *resource)
 Base function for getting CPU memory usage of textures. More...
 
kzsError kzuTextureDeploy_protected (struct KzuGPUResource *gpuResource)
 Base function for deploying textures. More...
 
kzsError kzuTextureUndeploy_protected (struct KzuGPUResource *gpuResource)
 Base function for undeploying textures. More...
 
kzsError kzuTextureFreeCommonData_protected (struct KzuGPUResource *gpuResource)
 Base function for freeing RAM of textures. More...
 
kzsError kzuTextureInvalidate_protected (struct KzuGPUResource *gpuResource)
 Base function for invalidating textures. More...
 
kzUint kzuTextureGetGPUMemoryUsage_protected (const struct KzuGPUResource *gpuResource)
 Base function for getting GPU memory usage of textures. More...
 
enum KzcRendererTextureFormat kzuTextureFormatToRendererFormat_protected (enum KzuTextureDataType dataType, enum KzuTextureChannels channels, enum KzuTextureCompression compression)
 Gets core renderer texture format from texture format (data type + channels + compression). More...
 
void kzuTextureFormatFromImageFormat_protected (enum KzcImageDataFormat imageFormat, enum KzuTextureDataType *out_dataType, enum KzuTextureChannels *out_channels, enum KzuTextureCompression *out_compression)
 Converts image format to texture format (data type + channels + compression). More...
 
enum KzcImageDataFormat kzuTextureFormatToImageFormat_protected (enum KzuTextureDataType dataType, enum KzuTextureChannels channels, enum KzuTextureCompression compression)
 Gets image format from texture format (data type + channels + compression). More...
 
kzUint kzuTextureGetChannelCount_protected (enum KzuTextureChannels channels)
 Gets the number of channels from channels enumeration. More...
 
kzUint kzuTextureFormatGetBytesPerPixel_protected (enum KzuTextureDataType dataType, enum KzuTextureChannels channels)
 Gets bytes per pixel from texture format (data type + channels). More...
 
enum KzcRendererTextureCompression kzuTextureCompressionToRendererCompression_protected (enum KzuTextureCompression compression)
 Gets renderer texture compression from texture compression. More...
 
kzsError kzuTextureGetImageFromPath_protected (const struct KzcMemoryManager *memoryManager, struct KzuBinaryDirectory *directory, kzString imagePath, kzUint maximumTextureSize, kzString defaultImagePath, struct KzcImage **out_image, kzBool *out_defaultImageUsed)
 Loads a texture image from given path. More...
 
kzsError kzuTextureValidateImageFormat_protected (const struct KzcMemoryManager *memoryManager, struct KzuTexture *texture, struct KzcImage *image, struct KzcRenderer *renderer, enum KzcImageDataFormat requestedImageFormat)
 Ensures that the given image is in requested and supported format. More...
 
kzBool kzuTextureRequiresMipmaps_protected (const struct KzuTexture *texture)
 Checks if the given texture needs mipmap data. More...
 

Variables

struct KzuTextureClass KZU_TEXTURE_CLASS
 Texture class. More...
 

Detailed Description

Texture base definitions.

Copyright 2008-2019 by Rightware. All rights reserved.

Typedef Documentation

typedef kzsError(* KzuTextureBindFunction)(struct KzuTexture *texture)

Function type for applying texture for rendering.

typedef kzsError(* KzuTextureUnbindFunction)(struct KzuTexture *texture)

Function type for detaching the texture from rendering.

Function Documentation

kzsError kzuTextureCreate_protected ( struct KzuTexture texture,
const struct KzuTextureClass textureClass,
struct KzuResourceManager resourceManager,
kzString  name,
struct KzuResourceLoader loader 
)

Base function for creating textures.

All texture sub type constructors should call this first.

Parameters
KzuResourceLoaderResource loader for loading resource data. Can be KZ_NULL, in which case the constructor should call kzuResourceStaticDataSet_protected after the data has been initialized.
kzsError kzuTextureInitialize_protected ( struct KzuTexture texture,
enum KzuTextureFilter  filter,
enum KzuTextureWrap  wrap,
kzFloat  anisotropy 
)

Base function for initializing a texture.

Parameters
anisotropySet anisotropic filtering level of texture. Values <= 1.0f disable the feature.
kzsError kzuTextureDestructor_protected ( struct KzuResource resource)

Base destructor for textures.

kzsError kzuTextureLoadFromKZB_protected ( struct KzuResource resource,
const struct KzuResourceLoaderThreadContext threadContext,
struct KzcInputStream inputStream,
struct KzuBinaryFileInfo file 
)

Base function for loading textures from .KZB.

kzsError kzuTextureFinishLoading_protected ( struct KzuResource resource,
const struct KzuResourceLoaderThreadContext threadContext 
)

Base function for finishing the loading of textures.

kzsError kzuTextureUnload_protected ( struct KzuResource resource)

Base function for unloading textures.

kzUint kzuTextureGetCPUMemoryUsage_protected ( const struct KzuResource resource)

Base function for getting CPU memory usage of textures.

kzsError kzuTextureDeploy_protected ( struct KzuGPUResource gpuResource)

Base function for deploying textures.

kzsError kzuTextureUndeploy_protected ( struct KzuGPUResource gpuResource)

Base function for undeploying textures.

kzsError kzuTextureFreeCommonData_protected ( struct KzuGPUResource gpuResource)

Base function for freeing RAM of textures.

kzsError kzuTextureInvalidate_protected ( struct KzuGPUResource gpuResource)

Base function for invalidating textures.

kzUint kzuTextureGetGPUMemoryUsage_protected ( const struct KzuGPUResource gpuResource)

Base function for getting GPU memory usage of textures.

enum KzcRendererTextureFormat kzuTextureFormatToRendererFormat_protected ( enum KzuTextureDataType  dataType,
enum KzuTextureChannels  channels,
enum KzuTextureCompression  compression 
)

Gets core renderer texture format from texture format (data type + channels + compression).

void kzuTextureFormatFromImageFormat_protected ( enum KzcImageDataFormat  imageFormat,
enum KzuTextureDataType out_dataType,
enum KzuTextureChannels out_channels,
enum KzuTextureCompression out_compression 
)

Converts image format to texture format (data type + channels + compression).

enum KzcImageDataFormat kzuTextureFormatToImageFormat_protected ( enum KzuTextureDataType  dataType,
enum KzuTextureChannels  channels,
enum KzuTextureCompression  compression 
)

Gets image format from texture format (data type + channels + compression).

kzUint kzuTextureGetChannelCount_protected ( enum KzuTextureChannels  channels)

Gets the number of channels from channels enumeration.

kzUint kzuTextureFormatGetBytesPerPixel_protected ( enum KzuTextureDataType  dataType,
enum KzuTextureChannels  channels 
)

Gets bytes per pixel from texture format (data type + channels).

Does not support compressed formats.

enum KzcRendererTextureCompression kzuTextureCompressionToRendererCompression_protected ( enum KzuTextureCompression  compression)

Gets renderer texture compression from texture compression.

kzsError kzuTextureGetImageFromPath_protected ( const struct KzcMemoryManager memoryManager,
struct KzuBinaryDirectory directory,
kzString  imagePath,
kzUint  maximumTextureSize,
kzString  defaultImagePath,
struct KzcImage **  out_image,
kzBool out_defaultImageUsed 
)

Loads a texture image from given path.

kzsError kzuTextureValidateImageFormat_protected ( const struct KzcMemoryManager memoryManager,
struct KzuTexture texture,
struct KzcImage image,
struct KzcRenderer renderer,
enum KzcImageDataFormat  requestedImageFormat 
)

Ensures that the given image is in requested and supported format.

kzBool kzuTextureRequiresMipmaps_protected ( const struct KzuTexture texture)

Checks if the given texture needs mipmap data.

Variable Documentation

struct KzuTextureClass KZU_TEXTURE_CLASS

Texture class.