-
Notifications
You must be signed in to change notification settings - Fork 1
/
Framebuffer.hpp
43 lines (35 loc) · 1.07 KB
/
Framebuffer.hpp
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
#pragma once
#include <vector>
#include <glad/glad.h>
#include "Config.hpp"
#include "RenderTarget.hpp"
#include "DrawBase.hpp"
#include "BufferGeo.hpp"
/**
* Framebuffer is a drawable render target. That means:
* Framebuffers can be drawn onto;
* And framebuffers can be drawn onto other stuffs.
*/
class Framebuffer : public RenderTarget, public BufferGeo
{
public:
CLASS_PTRS(Framebuffer)
Framebuffer(int width, int height, bool hdr, ShaderBase::Ptr shader);
~Framebuffer();
virtual void clear(glm::vec4 clearColor) override;
virtual void drawFrame() override;
virtual void addDrawable(DrawBase::Ptr draw) override;
virtual void clearDrawables() override;
virtual void draw() override;
int getWidth() const;
int getHeight() const;
GLuint getTexture() const;
static float rectData[18];
protected:
int _width, _height; // Framebuffer dimension
ShaderBase::Ptr _shader; // shader used to draw this framebuffer
std::vector<DrawBase::Ptr> _drawList;
GLuint _fbo, _rbo, _texture;
bool _hdr;
glm::vec4 _clearColor;
};