citro3d
|
Create and manipulate textures. More...
#include "types.h"
Go to the source code of this file.
Data Structures | |
struct | C3D_TexCube |
Cubemap texture data. More... | |
struct | C3D_Tex |
Texture data. More... | |
struct | C3D_TexInitParams |
Parameters for C3D_TexInitWithParams() More... | |
Functions | |
bool | C3D_TexInitWithParams (C3D_Tex *tex, C3D_TexCube *cube, C3D_TexInitParams p) |
Initializes texture with specified parameters. More... | |
void | C3D_TexLoadImage (C3D_Tex *tex, const void *data, GPU_TEXFACE face, int level) |
Copies raw texture data into C3D_Tex. More... | |
void | C3D_TexGenerateMipmap (C3D_Tex *tex, GPU_TEXFACE face) |
Generates mipmaps for C3D_Tex using previously specified max level The max level should have been specified using C3D_TexInitMipmap() or C3D_TexInitWithParams() More... | |
void | C3D_TexBind (int unitId, C3D_Tex *tex) |
Binds C3D_Tex to texture unit. More... | |
void | C3D_TexFlush (C3D_Tex *tex) |
Flushes texture data from cache into memory. More... | |
void | C3D_TexDelete (C3D_Tex *tex) |
Deletes texture data. More... | |
void | C3D_TexShadowParams (bool perspective, float bias) |
Configues texunit0 shadow texture properties. More... | |
static int | C3D_TexCalcMaxLevel (u32 width, u32 height) |
Calculates maximum mipmap level for given texture size. More... | |
static u32 | C3D_TexCalcLevelSize (u32 size, int level) |
Calculates size of mipmap level. More... | |
static u32 | C3D_TexCalcTotalSize (u32 size, int maxLevel) |
Calculates total size of mipmap texture data. More... | |
static bool | C3D_TexInit (C3D_Tex *tex, u16 width, u16 height, GPU_TEXCOLOR format) |
Initializes standard 2D texture. More... | |
static bool | C3D_TexInitMipmap (C3D_Tex *tex, u16 width, u16 height, GPU_TEXCOLOR format) |
Initializes standard 2D texture with mipmap Maximum miplevel is calculated using C3D_TexCalcMaxLevel() More... | |
static bool | C3D_TexInitCube (C3D_Tex *tex, C3D_TexCube *cube, u16 width, u16 height, GPU_TEXCOLOR format) |
Initializes cubemap texture. More... | |
static bool | C3D_TexInitVRAM (C3D_Tex *tex, u16 width, u16 height, GPU_TEXCOLOR format) |
Initializes 2D texture in VRAM. More... | |
static bool | C3D_TexInitShadow (C3D_Tex *tex, u16 width, u16 height) |
Initializes 2D shadowmap texture. More... | |
static bool | C3D_TexInitShadowCube (C3D_Tex *tex, C3D_TexCube *cube, u16 width, u16 height) |
Initializes shadowmap cubemap texture. More... | |
static GPU_TEXTURE_MODE_PARAM | C3D_TexGetType (C3D_Tex *tex) |
Gets type of texture. More... | |
static void * | C3D_TexGetImagePtr (C3D_Tex *tex, void *data, int level, u32 *size) |
Gets pointer to texture image. More... | |
static void * | C3D_Tex2DGetImagePtr (C3D_Tex *tex, int level, u32 *size) |
Gets pointer to 2D texture image. More... | |
static void * | C3D_TexCubeGetImagePtr (C3D_Tex *tex, GPU_TEXFACE face, int level, u32 *size) |
Gets pointer to cubemap texture image. More... | |
static void | C3D_TexUpload (C3D_Tex *tex, const void *data) |
Copies raw texture data into standard 2D texture. More... | |
static void | C3D_TexSetFilter (C3D_Tex *tex, GPU_TEXTURE_FILTER_PARAM magFilter, GPU_TEXTURE_FILTER_PARAM minFilter) |
Configures texture magnification and minification filters. More... | |
static void | C3D_TexSetFilterMipmap (C3D_Tex *tex, GPU_TEXTURE_FILTER_PARAM filter) |
Configures texture mipmap minification filters. More... | |
static void | C3D_TexSetWrap (C3D_Tex *tex, GPU_TEXTURE_WRAP_PARAM wrapS, GPU_TEXTURE_WRAP_PARAM wrapT) |
Configures texture wrapping options. More... | |
static void | C3D_TexSetLodBias (C3D_Tex *tex, float lodBias) |
Configures texture level of detail bias used to select the correct mipmap during sampling. More... | |
Create and manipulate textures.
Gets pointer to 2D texture image.
[in] | tex | Pointer to C3D_Tex. |
[in] | level | Specifies mipmap level. |
[out] | size | Can be used to get the size of the image data. |
void C3D_TexBind | ( | int | unitId, |
C3D_Tex * | tex | ||
) |
Calculates size of mipmap level.
[in] | size | Size of original texture. |
[in] | level | Mipmap level. |
Calculates maximum mipmap level for given texture size.
[in] | width | Width of texture. |
[in] | height | Height of texture. |
Calculates total size of mipmap texture data.
[in] | size | Size of original texture. |
[in] | maxLevel | Maximum mipmap level. |
|
inlinestatic |
Gets pointer to cubemap texture image.
[in] | tex | Pointer to C3D_Tex. |
[in] | face | Specifies the cubemap texture face. |
[in] | level | Specifies mipmap level. |
[out] | size | Can be used to get the size of the image data. |
void C3D_TexFlush | ( | C3D_Tex * | tex | ) |
Flushes texture data from cache into memory.
[in] | tex | Pointer to C3D_Tex. |
void C3D_TexGenerateMipmap | ( | C3D_Tex * | tex, |
GPU_TEXFACE | face | ||
) |
Generates mipmaps for C3D_Tex using previously specified max level The max level should have been specified using C3D_TexInitMipmap() or C3D_TexInitWithParams()
[in,out] | tex | Pointer to C3D_Tex. |
[in] | face | Specifies texture face. |
Gets pointer to texture image.
[in] | tex | Pointer to C3D_Tex. |
[in] | data | Pointer texture face. |
[in] | level | Specifies mipmap level. |
[out] | size | Can be used to get the size of the image data. |
|
inlinestatic |
Gets type of texture.
[in] | tex | Pointer to C3D_Tex. |
|
inlinestatic |
Initializes standard 2D texture.
[out] | tex | Pointer to uninitialized C3D_Tex. |
[in] | width | Specifies width of texture. (must be a power of 2) |
[in] | height | Specifies height of texture. (must be a power of 2) |
[in] | format | Specifies texture format. |
|
inlinestatic |
Initializes cubemap texture.
[out] | tex | Pointer to uninitialized C3D_Tex. |
[out] | cube | Pointer to C3D_TexCube. |
[in] | width | Specifies width of texture. (must be a power of 2) |
[in] | height | Specifies height of texture. (must be a power of 2) |
[in] | format | Specifies texture format. |
|
inlinestatic |
Initializes standard 2D texture with mipmap Maximum miplevel is calculated using C3D_TexCalcMaxLevel()
[out] | tex | Pointer to uninitialized C3D_Tex. |
[in] | width | Specifies width of texture. (must be a power of 2) |
[in] | height | Specifies height of texture. (must be a power of 2) |
[in] | format | Specifies texture format. |
Initializes 2D shadowmap texture.
[out] | tex | Pointer to uninitialized C3D_Tex. |
[in] | width | Specifies width of texture. (must be a power of 2) |
[in] | height | Specifies height of texture. (must be a power of 2) |
|
inlinestatic |
Initializes shadowmap cubemap texture.
[out] | tex | Pointer to uninitialized C3D_Tex. |
[out] | cube | Pointer to C3D_TexCube. |
[in] | width | Specifies width of texture. (must be a power of 2) |
[in] | height | Specifies height of texture. (must be a power of 2) |
|
inlinestatic |
Initializes 2D texture in VRAM.
[out] | tex | Pointer to uninitialized C3D_Tex. |
[in] | width | Specifies width of texture. (must be a power of 2) |
[in] | height | Specifies height of texture. (must be a power of 2) |
[in] | format | Specifies texture format. |
bool C3D_TexInitWithParams | ( | C3D_Tex * | tex, |
C3D_TexCube * | cube, | ||
C3D_TexInitParams | p | ||
) |
Initializes texture with specified parameters.
[out] | tex | Pointer to uninitialized C3D_Tex. |
[out] | cube | Pointer to C3D_TexCube. (Only used if texture type is cubemap) |
[in] | p | Parameters. See C3D_TexInitParams. |
void C3D_TexLoadImage | ( | C3D_Tex * | tex, |
const void * | data, | ||
GPU_TEXFACE | face, | ||
int | level | ||
) |
|
inlinestatic |
Configures texture magnification and minification filters.
[out] | tex | Pointer to C3D_Tex. |
[in] | magFilter | Specifies the filtering to use when magnifying the the texture. |
[in] | minFilter | Specifies the filtering to use when minifying the the texture. |
|
inlinestatic |
Configures texture mipmap minification filters.
[out] | tex | Pointer to C3D_Tex. |
[in] | filter | Specifies the filtering to use when minifying the the mipmap. |
|
inlinestatic |
Configures texture level of detail bias used to select the correct mipmap during sampling.
[out] | tex | Pointer to C3D_Tex. |
[in] | lodBias | Specifies the texture level of detail bias. |
|
inlinestatic |
Configures texture wrapping options.
[out] | tex | Pointer to C3D_Tex. |
[in] | wrapS | Specifies the texture wrapping mode for texture coordinate S (aka U). |
[in] | wrapT | Specifies the texture wrapping mode for texture coordinate T (aka V). |
void C3D_TexShadowParams | ( | bool | perspective, |
float | bias | ||
) |
Configues texunit0 shadow texture properties.
[in] | perspective | TODO |
[in] | bias | TODO |