SparrowRenderer/src/pipeline.h

101 lines
2.1 KiB
C++

#ifndef PIPELINE_H
#define PIPELINE_H
#include <vector>
#include <cstddef>
#include <string>
#include <glm/vec3.hpp>
class ShaderSource;
class Module;
class Scene;
class Camera;
class Pipeline
{
protected:
/**
* @brief every module in this vector will be used by the renderer for resizing, and rendering
*/
std::vector<Module*> modules;
public:
virtual void renderGL(Scene *scene) = 0;
virtual void resizeGL(int w, int h) {}
/**
* the destructor deletes all the modules
*/
~Pipeline();
};
/**
* @brief The SimplePipeline class creates a simple graphic pipeline able to render 3D meshes
*/
class SimplePipeline : public Pipeline
{
Camera *m_camera;
glm::vec3 m_clearColor;
int width;
int height;
public:
SimplePipeline(ShaderSource *forwardSource = NULL);
virtual void renderGL(Scene *scene);
virtual void resizeGL(int w, int h);
void refreshScene(Scene *scene);
void setCamera(Camera *camera) {m_camera = camera;}
void setClearColor(glm::vec3 clearColor) {m_clearColor = clearColor;}
};
/**
* @brief The DefaultPipeline class -> WORK IN PROGRESS
*/
class StandardPipeline : public Pipeline
{
Camera *m_camera;
glm::vec3 m_clearColor;
public:
struct Settings
{
bool usesDeferred;
bool hasSkybox;
bool hasPicking;
bool hasBloom;
};
struct SourcePack
{
std::string forward_frag;
std::string forward_vert;
std::string gbuffer_frag;
std::string gbuffer_vert;
std::string deferred_frag;
std::string deferred_vert;
std::string bloom_frag;
std::string blur_frag;
std::string hdr_frag;
std::string luminance_frag;
std::string reduction_frag;
};
StandardPipeline(const Settings &mySettings, const SourcePack &mySourcePack);
virtual void renderGL(Scene *scene);
virtual void resizeGL(int w, int h);
void refreshScene(Scene *scene);
void setCamera(Camera *camera) {m_camera = camera;}
void setClearColor(glm::vec3 clearColor) {m_clearColor = clearColor;}
};
#endif // PIPELINE_H