51 lines
1.2 KiB
C++

#pragma once
#include <string>
#include <map>
#include <GL/glew.h>
#include "Shader.h"
#include "Models/Mesh.h"
#include "SceneContext.h"
class Multipass
{
public:
Multipass();
~Multipass();
void setDrawBuffers();
void bindToFrameBuffer(GLenum type, GLenum texture, std::string texName);
void addTexture(const std::string &tex_name, GLuint filter, GLuint type, GLuint type_2, GLuint type_3,
bool depth, SceneContext &scnctx, GLuint height = 0, GLuint width = 0);
void enableFrameBufferTexture(const std::string tex_name);
void gBufferSetup(SceneContext &scnctx, std::vector<std::shared_ptr<Mesh>>& meshes);
void recomputeDeferredLights(SceneContext &scnctx);
void drawGBufferToScreen(SceneContext &scnctx);
void deferredLightSetup(SceneContext &scnctx, std::vector<std::shared_ptr<Mesh>>& meshes);
void drawDeferredLightToScreen(SceneContext &scnctx);
void forwardLightSetup(SceneContext &scnctx, std::vector<std::shared_ptr<Mesh>>& meshes);
GLuint getCurrentTexture();
Shader *shader;
private:
void _createQuad();
GLuint _fboId;
GLuint _quad_vao;
GLuint _quad_vbo;
std::string _current_tex;
std::map<std::string, GLuint> _pass_textures;
GLenum _draw_buffers[5];
GLuint _draw_buffers_size;
};