citro3d
Data Structures | Typedefs | Functions
tex3ds.h File Reference

tex3ds support More...

#include <citro3d.h>
#include <stdint.h>
#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  Tex3DS_SubTexture
 Subtexture. More...
 

Typedefs

typedef struct Tex3DS_SubTexture Tex3DS_SubTexture
 Subtexture. More...
 
typedef struct Tex3DS_Texture_s * Tex3DS_Texture
 Texture.
 

Functions

Tex3DS_Texture Tex3DS_TextureImport (const void *input, size_t insize, C3D_Tex *tex, C3D_TexCube *texcube, bool vram)
 Import Tex3DS texture. More...
 
Tex3DS_Texture Tex3DS_TextureImportCallback (C3D_Tex *tex, C3D_TexCube *texcube, bool vram, decompressCallback callback, void *userdata)
 Import Tex3DS texture. More...
 
Tex3DS_Texture Tex3DS_TextureImportFD (int fd, C3D_Tex *tex, C3D_TexCube *texcube, bool vram)
 Import Tex3DS texture. More...
 
Tex3DS_Texture Tex3DS_TextureImportStdio (FILE *fp, C3D_Tex *tex, C3D_TexCube *texcube, bool vram)
 Import Tex3DS texture. More...
 
size_t Tex3DS_GetNumSubTextures (const Tex3DS_Texture texture)
 Get number of subtextures. More...
 
const Tex3DS_SubTextureTex3DS_GetSubTexture (const Tex3DS_Texture texture, size_t index)
 Get subtexture. More...
 
static bool Tex3DS_SubTextureRotated (const Tex3DS_SubTexture *subtex)
 Check if subtexture is rotated. More...
 
static void Tex3DS_SubTextureBottomLeft (const Tex3DS_SubTexture *subtex, float *u, float *v)
 Get bottom-left texcoords. More...
 
static void Tex3DS_SubTextureBottomRight (const Tex3DS_SubTexture *subtex, float *u, float *v)
 Get bottom-right texcoords. More...
 
static void Tex3DS_SubTextureTopLeft (const Tex3DS_SubTexture *subtex, float *u, float *v)
 Get top-left texcoords. More...
 
static void Tex3DS_SubTextureTopRight (const Tex3DS_SubTexture *subtex, float *u, float *v)
 Get top-right texcoords. More...
 
void Tex3DS_TextureFree (Tex3DS_Texture texture)
 Free Tex3DS texture. More...
 

Detailed Description

tex3ds support

Typedef Documentation

◆ Tex3DS_SubTexture

Subtexture.

Note
If top < bottom, the subtexture is rotated 1/4 revolution counter-clockwise

Function Documentation

◆ Tex3DS_GetNumSubTextures()

size_t Tex3DS_GetNumSubTextures ( const Tex3DS_Texture  texture)

Get number of subtextures.

Parameters
[in]textureTex3DS texture
Returns
Number of subtextures

◆ Tex3DS_GetSubTexture()

const Tex3DS_SubTexture* Tex3DS_GetSubTexture ( const Tex3DS_Texture  texture,
size_t  index 
)

Get subtexture.

Parameters
[in]textureTex3DS texture
[in]indexSubtexture index
Returns
Subtexture info

◆ Tex3DS_SubTextureBottomLeft()

static void Tex3DS_SubTextureBottomLeft ( const Tex3DS_SubTexture subtex,
float *  u,
float *  v 
)
inlinestatic

Get bottom-left texcoords.

Parameters
[in]subtexSubtexture
[out]uu-coordinate
[out]vv-coordinate

◆ Tex3DS_SubTextureBottomRight()

static void Tex3DS_SubTextureBottomRight ( const Tex3DS_SubTexture subtex,
float *  u,
float *  v 
)
inlinestatic

Get bottom-right texcoords.

Parameters
[in]subtexSubtexture
[out]uu-coordinate
[out]vv-coordinate

◆ Tex3DS_SubTextureRotated()

static bool Tex3DS_SubTextureRotated ( const Tex3DS_SubTexture subtex)
inlinestatic

Check if subtexture is rotated.

Parameters
[in]subtexSubtexture to check
Returns
whether subtexture is rotated

◆ Tex3DS_SubTextureTopLeft()

static void Tex3DS_SubTextureTopLeft ( const Tex3DS_SubTexture subtex,
float *  u,
float *  v 
)
inlinestatic

Get top-left texcoords.

Parameters
[in]subtexSubtexture
[out]uu-coordinate
[out]vv-coordinate

◆ Tex3DS_SubTextureTopRight()

static void Tex3DS_SubTextureTopRight ( const Tex3DS_SubTexture subtex,
float *  u,
float *  v 
)
inlinestatic

Get top-right texcoords.

Parameters
[in]subtexSubtexture
[out]uu-coordinate
[out]vv-coordinate

◆ Tex3DS_TextureFree()

void Tex3DS_TextureFree ( Tex3DS_Texture  texture)

Free Tex3DS texture.

Parameters
[in]textureTex3DS texture to free

◆ Tex3DS_TextureImport()

Tex3DS_Texture Tex3DS_TextureImport ( const void *  input,
size_t  insize,
C3D_Tex tex,
C3D_TexCube texcube,
bool  vram 
)

Import Tex3DS texture.

Parameters
[in]inputInput data
[in]insizeSize of the input data
[out]texcitro3d texture
[out]texcubecitro3d texcube
[in]vramWhether to store textures in VRAM
Returns
Tex3DS texture

◆ Tex3DS_TextureImportCallback()

Tex3DS_Texture Tex3DS_TextureImportCallback ( C3D_Tex tex,
C3D_TexCube texcube,
bool  vram,
decompressCallback  callback,
void *  userdata 
)

Import Tex3DS texture.

@description For example, use this if you want to import from a large file without pulling the entire file into memory.

Parameters
[out]texcitro3d texture
[out]texcubecitro3d texcube
[in]vramWhether to store textures in VRAM
[in]callbackData callback
[in]userdataUser data passed to callback
Returns
Tex3DS texture

◆ Tex3DS_TextureImportFD()

Tex3DS_Texture Tex3DS_TextureImportFD ( int  fd,
C3D_Tex tex,
C3D_TexCube texcube,
bool  vram 
)

Import Tex3DS texture.

Starts reading at the current file descriptor's offset. The file descriptor's position is left at the end of the decoded data. On error, the file descriptor's position is indeterminate.

Parameters
[in]fdOpen file descriptor
[out]texcitro3d texture
[out]texcubecitro3d texcube
[in]vramWhether to store textures in VRAM
Returns
Tex3DS texture

◆ Tex3DS_TextureImportStdio()

Tex3DS_Texture Tex3DS_TextureImportStdio ( FILE *  fp,
C3D_Tex tex,
C3D_TexCube texcube,
bool  vram 
)

Import Tex3DS texture.

Starts reading at the current file stream's offset. The file stream's position is left at the end of the decoded data. On error, the file stream's position is indeterminate.

Parameters
[in]fpOpen file stream
[out]texcitro3d texture
[out]texcubecitro3d texcube
[in]vramWhether to store textures in VRAM
Returns
Tex3DS texture