-
Notifications
You must be signed in to change notification settings - Fork 0
/
texture_catalog.h
57 lines (45 loc) · 1.4 KB
/
texture_catalog.h
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once
#include "common.h"
#include <glad/glad.h>
#include "catalog.h"
enum class Texture_Format
{
ARGB8888 = 0,
RGB888 = 1,
ARGBhalf = 2,
ARGB8888_NO_SRGB = 3,
R8
};
struct Bitmap
{
i32 width;
i32 height;
u8 *data;
Texture_Format format;
i32 num_mipmap_levels;
i64 length_in_bytes;
};
// We should move this into opengl
struct Texture_Map
{
// @Note: For Catalog
String name;
String full_path;
// We store additional fields of width and height because we
// may use the Texture_Map as a framebuffer object
i32 width;
i32 height;
bool dirty = false;
GLuint id = 0; // GL texture handle
GLuint fbo_id = 0; // GL texture handle
Bitmap *data = NULL; // Used if this is a texture we dirty
// @Note: For Catalog
bool loaded = false;
};
using Texture_Catalog = Catalog<Texture_Map>;
void init_texture_catalog(Texture_Catalog *catalog);
void deinit_texture_catalog(Texture_Catalog *catalog);
Texture_Map *make_placeholder(Texture_Catalog *catalog, String short_name, String full_path);
void reload_asset(Texture_Catalog *catalog, Texture_Map *texture);
void init_bitmap(Bitmap *bitmap);
void init_texture_map(Texture_Map *map);