GrooveStomp's 3D Software Renderer  0.1.0
Classes | Macros | Functions
texture.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  texture
 Structure representing a texture image. More...
 

Macros

#define TEXTURE_VERSION   "0.1.0"
 include guard
 

Functions

struct textureTextureInitFromFile (char *file)
 Initialize a new texture object. More...
 
void TextureDeinit (struct texture *texture)
 De-initialize a texture object. More...
 
unsigned int TextureSample (struct texture *texture, float u, float v)
 Texel lookup. More...
 

Function Documentation

◆ TextureDeinit()

void TextureDeinit ( struct texture texture)

De-initialize a texture object.

Parameters
[in,out]textureThe texture object to de-initialize

◆ TextureInitFromFile()

struct texture* TextureInitFromFile ( char *  file)

Initialize a new texture object.

This uses stb_image, and thus all the image formats supported by that library.

Parameters
[in]filePath to the image file to load
Returns
an initialized texture object

◆ TextureSample()

unsigned int TextureSample ( struct texture texture,
float  u,
float  v 
)

Texel lookup.

Textures are organized such that (0,0) is the top-left corner, and (0,1) is the lower-left corner.

Parameters
[in]texturethe Texture object to sample
[in]uthe horizontal texture coordinate
[in]vthe vertical texture coordinate