summaryrefslogtreecommitdiff
path: root/src/core/texture.h
blob: 06016ade572ba6dd11fff7b32db1c14aae707c3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef _SOFTSHADEROOM_TEXTURE_H_
#define _SOFTSHADEROOM_TEXTURE_H_

#include "vert.h"

typedef enum {
	FILTERMODE_POINT, 
	FILTERMODE_BILINEAR,
	/*FILTERMODE_TRILINEAR,*/
} FilterMode;

typedef enum {
	WRAPMODE_REPEAT,
	WRAPMODE_CLAMP,
} WrapMode;

typedef enum {
	COMPONENT_RGBA, 
	COMPONENT_DEPTH
} TextureComponent;

typedef struct {
	uint width, height;
	Color32* pixels; /*RGBA*/
	FilterMode filter_mode; 
	WrapMode wrap_mode;
} Texture;

Texture* texture_loadfromfile(const char* path);
Texture* texture_create(uint width, uint height);

void texture_setfiltermode(Texture* tex, FilterMode filter);
void texture_setwrapmode(Texture* tex, WrapMode wrap);

Color32 texture_sampling(Texture* tex, float x, float y);

void texture_free(Texture* tex);

#endif