diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-05-17 15:55:37 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-17 15:55:37 -0400 |
| commit | 90aadf3844386824140a20d7fbb847bc16009a94 (patch) | |
| tree | 6f83fce90e71abb22b1a8f3e09c79963b2a34d5d /src/renderer/renderer.h | |
| parent | bc63fa57ced1c7329f7fdcfd168eaf7e290158bc (diff) | |
| parent | 86f0106d0523825549f1e74b835688c78a10cf6c (diff) | |
| download | therapy-90aadf3844386824140a20d7fbb847bc16009a94.tar.gz therapy-90aadf3844386824140a20d7fbb847bc16009a94.tar.bz2 therapy-90aadf3844386824140a20d7fbb847bc16009a94.zip | |
Merge pull request #7 from hatkirby/es-rewrite
The ECS rewrite exceeds the original branch in functionality, so it is time to merge it in.
Diffstat (limited to 'src/renderer/renderer.h')
| -rw-r--r-- | src/renderer/renderer.h | 114 |
1 files changed, 114 insertions, 0 deletions
| diff --git a/src/renderer/renderer.h b/src/renderer/renderer.h new file mode 100644 index 0000000..0b10af5 --- /dev/null +++ b/src/renderer/renderer.h | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | #ifndef RENDERER_H | ||
| 2 | #define RENDERER_H | ||
| 3 | |||
| 4 | #include "gl.h" | ||
| 5 | #include "wrappers.h" | ||
| 6 | #include "mesh.h" | ||
| 7 | #include "shader.h" | ||
| 8 | #include <glm/glm.hpp> | ||
| 9 | |||
| 10 | class Texture; | ||
| 11 | struct Rectangle; | ||
| 12 | |||
| 13 | class Renderer { | ||
| 14 | public: | ||
| 15 | |||
| 16 | class Window { | ||
| 17 | public: | ||
| 18 | |||
| 19 | Window(); | ||
| 20 | |||
| 21 | Window(const Window& other) = delete; | ||
| 22 | Window& operator=(const Window& other) = delete; | ||
| 23 | |||
| 24 | ~Window(); | ||
| 25 | |||
| 26 | inline GLFWwindow* getHandle() | ||
| 27 | { | ||
| 28 | return window_; | ||
| 29 | } | ||
| 30 | |||
| 31 | private: | ||
| 32 | |||
| 33 | GLFWwindow* window_; | ||
| 34 | }; | ||
| 35 | |||
| 36 | static inline bool isSingletonInitialized() | ||
| 37 | { | ||
| 38 | return singletonInitialized_; | ||
| 39 | } | ||
| 40 | |||
| 41 | Renderer(); | ||
| 42 | |||
| 43 | Renderer(const Renderer& other) = delete; | ||
| 44 | Renderer& operator=(const Renderer& other) = delete; | ||
| 45 | |||
| 46 | ~Renderer(); | ||
| 47 | |||
| 48 | inline Window& getWindow() | ||
| 49 | { | ||
| 50 | return window_; | ||
| 51 | } | ||
| 52 | |||
| 53 | void fill( | ||
| 54 | Texture& tex, | ||
| 55 | Rectangle loc, | ||
| 56 | int r, | ||
| 57 | int g, | ||
| 58 | int b); | ||
| 59 | |||
| 60 | void blit( | ||
| 61 | const Texture& src, | ||
| 62 | Texture& dst, | ||
| 63 | Rectangle srcrect, | ||
| 64 | Rectangle dstrect, | ||
| 65 | double alpha = 1.0); | ||
| 66 | |||
| 67 | void renderScreen(const Texture& tex); | ||
| 68 | |||
| 69 | private: | ||
| 70 | |||
| 71 | friend void setFramebufferSize(GLFWwindow* w, int width, int height); | ||
| 72 | |||
| 73 | void initializeFramebuffers(); | ||
| 74 | |||
| 75 | void bloomPass1( | ||
| 76 | const GLTexture& src, | ||
| 77 | GLTexture& dst, | ||
| 78 | bool horizontal, | ||
| 79 | glm::vec2 srcRes, | ||
| 80 | glm::vec2 dstRes); | ||
| 81 | |||
| 82 | static bool singletonInitialized_; | ||
| 83 | |||
| 84 | Window window_; | ||
| 85 | GLVertexArray vao_; | ||
| 86 | |||
| 87 | GLFramebuffer genericFb_; | ||
| 88 | GLFramebuffer bloomFb_; | ||
| 89 | GLRenderbuffer bloomDepth_; | ||
| 90 | |||
| 91 | GLTexture renderPages_[2]; | ||
| 92 | GLTexture preBloomTex_; | ||
| 93 | GLTexture bloomPassTex1_; | ||
| 94 | GLTexture bloomPassTex2_; | ||
| 95 | |||
| 96 | Mesh monitor_; | ||
| 97 | GLBuffer quadBuffer_; | ||
| 98 | |||
| 99 | GLTexture artifactsTex_; | ||
| 100 | GLTexture scanlinesTex_; | ||
| 101 | |||
| 102 | Shader ntscShader_; | ||
| 103 | Shader finalShader_; | ||
| 104 | Shader blitShader_; | ||
| 105 | Shader fillShader_; | ||
| 106 | Shader bloom1Shader_; | ||
| 107 | Shader bloom2Shader_; | ||
| 108 | |||
| 109 | size_t curBuf_ = 0; | ||
| 110 | int width_; | ||
| 111 | int height_; | ||
| 112 | }; | ||
| 113 | |||
| 114 | #endif | ||
