diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-11-19 15:04:30 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-11-23 18:38:43 +0000 |
commit | ffdaa93edf5eeaf9db7dc17e51554a77dd9d596d (patch) | |
tree | 5ec8af60e0761417d4f80a012679e3071de59888 /ui/sceneRenderer.h | |
parent | Shared context, persist main window in test, send test for upcoming pointlight (diff) | |
download | ilt-ffdaa93edf5eeaf9db7dc17e51554a77dd9d596d.tar.bz2 ilt-ffdaa93edf5eeaf9db7dc17e51554a77dd9d596d.tar.xz ilt-ffdaa93edf5eeaf9db7dc17e51554a77dd9d596d.zip |
Separate out the illumation of the scene
Diffstat (limited to 'ui/sceneRenderer.h')
-rw-r--r-- | ui/sceneRenderer.h | 25 |
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; |