GrooveStomp's 3D Software Renderer  0.1.0
texture.h
Go to the documentation of this file.
1 /******************************************************************************
2  GrooveStomp's 3D Software Renderer
3  Copyright (c) 2019 Aaron Oman (GrooveStomp)
4 
5  File: texture.h
6  Created: 2019-08-18
7  Updated: 2019-08-27
8  Author: Aaron Oman
9  Notice: GNU GPLv3 License
10 
11  Based off of: One Lone Coder Console Game Engine Copyright (C) 2018 Javidx9
12  This program comes with ABSOLUTELY NO WARRANTY.
13  This is free software, and you are welcome to redistribute it under certain
14  conditions; See LICENSE for details.
15  ******************************************************************************/
16 
18 
19 #ifndef TEXTURE_VERSION
20 #define TEXTURE_VERSION "0.1.0"
21 
22 struct texture {
24  unsigned char *data;
25  int width;
26  int height;
27  int numBytesPerPixel;
28 };
29 
36 struct texture *
37 TextureInitFromFile(char *file);
38 
42 void
44 
53 unsigned int
54 TextureSample(struct texture *texture, float u, float v);
55 
56 #endif // TEXTURE_VERSION
struct texture * TextureInitFromFile(char *file)
Initialize a new texture object.
Definition: texture.c:28
unsigned char * data
data is always RGB with 8-bits per component and no padding in rows.
Definition: texture.h:24
unsigned int TextureSample(struct texture *texture, float u, float v)
Texel lookup.
Definition: texture.c:51
void TextureDeinit(struct texture *texture)
De-initialize a texture object.
Definition: texture.c:40
Structure representing a texture image.
Definition: texture.h:23