diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-16 16:04:32 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-16 16:04:32 -0500 |
commit | ed08b673c50b076042d8f0c49501372168142764 (patch) | |
tree | 18ecda99942ef11ce4023c3ad4437976f96b75da /src/renderer/texture.h | |
parent | 224645d1071c14b4829dbb3ae35870868fcff85a (diff) | |
download | therapy-ed08b673c50b076042d8f0c49501372168142764.tar.gz therapy-ed08b673c50b076042d8f0c49501372168142764.tar.bz2 therapy-ed08b673c50b076042d8f0c49501372168142764.zip |
Refactored renderer
Renderer is basically now more C++'y, as it makes more use of classes (a lot of GL types have been wrapped), and the renderer itself is now a class. The monitor mesh is also now indexed. Tweaked the NTSC artifacting after inadvertently fixing a bug with the way the image was loaded.
Diffstat (limited to 'src/renderer/texture.h')
-rw-r--r-- | src/renderer/texture.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/renderer/texture.h b/src/renderer/texture.h new file mode 100644 index 0000000..3aa8773 --- /dev/null +++ b/src/renderer/texture.h | |||
@@ -0,0 +1,52 @@ | |||
1 | #ifndef TEXTURE_H_84EC6DF6 | ||
2 | #define TEXTURE_H_84EC6DF6 | ||
3 | |||
4 | #include "wrappers.h" | ||
5 | |||
6 | struct Rectangle { | ||
7 | int x; | ||
8 | int y; | ||
9 | int w; | ||
10 | int h; | ||
11 | }; | ||
12 | |||
13 | class Texture { | ||
14 | public: | ||
15 | |||
16 | Texture(int width, int height); | ||
17 | |||
18 | Texture(const char* file); | ||
19 | |||
20 | Texture(const Texture& tex); | ||
21 | |||
22 | Texture(Texture&& tex); | ||
23 | |||
24 | Texture& operator= (Texture tex); | ||
25 | |||
26 | friend void swap(Texture& tex1, Texture& tex2); | ||
27 | |||
28 | Rectangle entirety() const; | ||
29 | |||
30 | inline GLuint getId() const | ||
31 | { | ||
32 | return texture_.getId(); | ||
33 | } | ||
34 | |||
35 | inline int getWidth() const | ||
36 | { | ||
37 | return width_; | ||
38 | } | ||
39 | |||
40 | inline int getHeight() const | ||
41 | { | ||
42 | return height_; | ||
43 | } | ||
44 | |||
45 | private: | ||
46 | |||
47 | GLTexture texture_; | ||
48 | int width_; | ||
49 | int height_; | ||
50 | }; | ||
51 | |||
52 | #endif /* end of include guard: TEXTURE_H_84EC6DF6 */ | ||