-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTexture.h
More file actions
57 lines (52 loc) · 1.28 KB
/
Texture.h
File metadata and controls
57 lines (52 loc) · 1.28 KB
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
#ifndef OM_TEXTURE_H
#define OM_TEXTURE_H
#include <cstdint>
namespace ObjMaster {
/** Represents a texture */
struct Texture {
Texture() {}
Texture(
std::vector<uint8_t> t_bitmap,
unsigned int t_handle,
int t_width,
int t_heigth,
int t_bytepp
) : bitmap(t_bitmap),
handle(t_handle),
width(t_width),
heigth(t_heigth),
bytepp(t_bytepp)
{}
// Copies are defeaulted
Texture(const Texture &other) = default;
Texture& operator=(const Texture &other) = default;
// Moves are defaulted
Texture(Texture &&other) = default;
Texture& operator=(Texture &&other) = default;
/**
* The bitmap data of this texture when in the system memory.
*
* It can have a size of zero in case the texture is not loaded
* into the main RAM at this time.
*/
std::vector<uint8_t> bitmap;
/**
* The handle for the texture when it is on the GPU.
*
* It has the special value of 0 when the texture is not loaded
* onto the GPU unit.
*/
uintptr_t handle{};
/** Width in pixels */
int width{};
/** Height in pixels */
int heigth{};
/** How many BYTES a pixel is represented on */
int bytepp{};
/** Unload bitmap data from main memory - metadata and handle stays as is! */
void unloadBitmapFromMemory() {
bitmap.clear();
}
};
}
#endif