summaryrefslogtreecommitdiff
path: root/ui/sceneRenderer.h
diff options
context:
space:
mode:
Diffstat (limited to 'ui/sceneRenderer.h')
-rw-r--r--ui/sceneRenderer.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/ui/sceneRenderer.h b/ui/sceneRenderer.h
index c06fa83..8b81d0c 100644
--- a/ui/sceneRenderer.h
+++ b/ui/sceneRenderer.h
@@ -9,9 +9,18 @@
class SceneRenderer {
public:
+ class SceneProvider {
+ public:
+ virtual ~SceneProvider() = default;
+ virtual void content(const SceneShader &) const = 0;
+ virtual void environment(const SceneShader &, const SceneRenderer &) const;
+ };
+
explicit SceneRenderer(glm::ivec2 size, GLuint output);
- void render(std::function<void(const SceneShader &)> content) const;
+ void render(const SceneProvider &) const;
+ void setAmbientLight(const glm::vec3 & colour) const;
+ void setDirectionalLight(const glm::vec3 & colour, const glm::vec3 & direction) const;
Camera camera;
@@ -19,14 +28,26 @@ private:
glm::ivec2 size;
GLuint output;
glFrameBuffer gBuffer;
- glTexture gPosition, gNormal, gAlbedoSpec;
+ glTexture gPosition, gNormal, gAlbedoSpec, gIllumination;
glRenderBuffer depth;
class DeferredLightProgram : public Program {
public:
using Program::Program;
using Program::use;
};
+ class DirectionalLightProgram : public Program {
+ public:
+ DirectionalLightProgram();
+ using Program::use;
+
+ void setDirectionalLight(const glm::vec3 &, const glm::vec3 &) const;
+
+ private:
+ RequiredUniformLocation directionLoc, colourLoc;
+ };
+
DeferredLightProgram lighting;
+ DirectionalLightProgram dirLight;
glVertexArray displayVAO;
glBuffer displayVBO;
SceneShader shader;