4 #include <QOpenGLFunctions>
11 #define GL Globals::gl
74 static bool loadShader(std::string &path, GLuint
id);
75 static bool noGlErrors();
76 static bool checkFbo();
77 static void drawUnitQuad();
79 static GLuint unitQuadVao, unitQuadVbo;
81 static bool textFileRead(std::string &file, std::string &into);
82 static void printInfoLog(GLint
id,
bool program);
83 static void generateUnitQuad();
111 void setActive(
bool active);
116 void registerAsReceiver();
124 void unregisterAsReceiver();
126 unsigned char receiverCounter;
130 template<
class C>
bool helperMultiChannelContains(std::list<C*> &list, C &channel) {
131 std::list<C*>::iterator iter = list.begin();
132 while (iter != list.end()) {
133 if (*iter == &channel)
139 template<
class C>
void helperMultiChannelAdd(std::list<C*> &list, C &channel) {
140 if (channel.isActive() && !helperMultiChannelContains(list, channel)) {
141 list.push_back(&channel);
142 channel.registerAsReceiver();
145 template<
class C>
bool helperMultiChannelRemove(std::list<C*> &list, C &channel) {
146 std::list<C*>::iterator iter = list.begin();
147 while (iter != list.end()) {
148 if (*iter == &channel) {
149 channel.unregisterAsReceiver();
157 template<
class C>
void helperMultiChannelClean(std::list<C*> &list) {
158 std::list<C*>::iterator iter = list.begin();
159 while (iter != list.end()) {
160 if (!(*iter)->isActive()) {
161 (*iter)->unregisterAsReceiver();
162 iter = list.erase(iter);
167 template<
class C>
void helperMultiChannelClear(std::list<C*> &list) {
168 std::list<C*>::iterator iter = list.begin();
169 while (iter != list.end()) {
170 (*iter)->unregisterAsReceiver();
186 QMatrix4x4 *modelMat;
229 void reserveTexture(
unsigned int x,
unsigned int y,
bool floatPrecision);
253 #endif // RENDERPASS_H
VaoChannel(vao sentVao)
Create a new VaoChannel containing the given geometry.
Definition: renderpass.cpp:184
virtual void render()=0
Uses the input data to generate the output.
An abstract class for Render Passes.
Definition: renderpass.h:26
This channel is used to link textures or data maps.
Definition: renderpass.h:210
GLuint getID()
Getter for the OpenGL texture id.
Definition: renderpass.cpp:202
virtual ~RenderPass()
Calls cleanup()
Definition: renderpass.cpp:12
void freeTexture()
Tells the channel that it will not be updated anymore.
Definition: renderpass.cpp:234
static void cleanupHelpers()
Removes helper variables.
Definition: renderpass.cpp:14
This channel is used to link geometry.
Definition: renderpass.h:182
Definition: renderpass.h:184
vao * getVao()
Getter for the contained geometry.
Definition: renderpass.cpp:189
virtual void updateResolution()=0
Must be called after the screen resolution has changed.
void reserveDepthTexture(unsigned int x, unsigned int y)
Reserves a new depth map on the GPU.
Definition: renderpass.cpp:220
virtual void cleanup()=0
Resets the Render Pass to the state after creation but before initialization.
void reserveTexture(unsigned int x, unsigned int y, bool floatPrecision)
Reserves a new texture on the GPU.
Definition: renderpass.cpp:206
virtual void removeInput()=0
Removes all input channels except for VaoChannels. If the Render Pass uses VaoChannels as input use t...