summaryrefslogtreecommitdiff
path: root/gfx/gl/sceneRenderer.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-11-26 13:51:33 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-11-26 14:14:13 +0000
commit7fba471728f2216d7e3b7900297fc3b3531e286c (patch)
tree5caef3b2efc23aefccb215ec9005cd8e7d2e91b8 /gfx/gl/sceneRenderer.cpp
parentFix todo for handling a terrain walk from outside the mesh (diff)
parentModel positions as integers (diff)
downloadilt-7fba471728f2216d7e3b7900297fc3b3531e286c.tar.bz2
ilt-7fba471728f2216d7e3b7900297fc3b3531e286c.tar.xz
ilt-7fba471728f2216d7e3b7900297fc3b3531e286c.zip
Merge branch 'ints' into terrain
Conflicts fix, compiles, some test failures remain. Trees not added, possibility of OM invalid handle assertion failures, normals broken due to integer overflow in Newell's method.
Diffstat (limited to 'gfx/gl/sceneRenderer.cpp')
-rw-r--r--gfx/gl/sceneRenderer.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/gfx/gl/sceneRenderer.cpp b/gfx/gl/sceneRenderer.cpp
index aa9453a..53178e5 100644
--- a/gfx/gl/sceneRenderer.cpp
+++ b/gfx/gl/sceneRenderer.cpp
@@ -13,8 +13,9 @@ static constexpr const std::array<const glm::i8vec4, 4> displayVAOdata {{
{1, 1, 1, 1},
{1, -1, 1, 0},
}};
-SceneRenderer::SceneRenderer(glm::ivec2 s, GLuint o) :
- camera {{-1250.0F, -1250.0F, 35.0F}, quarter_pi, ratio(s), 0.1F, 10000.0F}, size {s}, output {o},
+
+SceneRenderer::SceneRenderer(ScreenAbsCoord s, GLuint o) :
+ camera {{-1250000.0F, -1250000.0F, 35.0F}, quarter_pi, ratio(s), 100.F, 10000000.0F}, size {s}, output {o},
lighting {lighting_vs, lighting_fs}, shadowMapper {{2048, 2048}}
{
shader.setViewPort({0, 0, size.x, size.y});
@@ -51,7 +52,7 @@ SceneRenderer::SceneRenderer(glm::ivec2 s, GLuint o) :
void
SceneRenderer::render(const SceneProvider & scene) const
{
- shader.setViewProjection(camera.getViewProjection());
+ shader.setViewProjection(camera.getPosition(), camera.getViewProjection());
glViewport(0, 0, size.x, size.y);
// Geometry pass
@@ -96,7 +97,7 @@ SceneRenderer::render(const SceneProvider & scene) const
}
void
-SceneRenderer::setAmbientLight(const glm::vec3 & colour) const
+SceneRenderer::setAmbientLight(const RGB & colour) const
{
glBindFramebuffer(GL_FRAMEBUFFER, gBuffer);
glClearColor(colour.r, colour.g, colour.b, 1.0F);
@@ -104,8 +105,7 @@ SceneRenderer::setAmbientLight(const glm::vec3 & colour) const
}
void
-SceneRenderer::setDirectionalLight(
- const glm::vec3 & colour, const glm::vec3 & direction, const SceneProvider & scene) const
+SceneRenderer::setDirectionalLight(const RGB & colour, const Direction3D & direction, const SceneProvider & scene) const
{
if (colour.r > 0 || colour.g > 0 || colour.b > 0) {
const auto lvp = shadowMapper.update(scene, direction, camera);
@@ -134,8 +134,8 @@ SceneRenderer::DirectionalLightProgram::DirectionalLightProgram() :
}
void
-SceneRenderer::DirectionalLightProgram::setDirectionalLight(const glm::vec3 & c, const glm::vec3 & d,
- const std::span<const glm::mat4x4> lvp, const std::span<const glm::vec4> shadowMapRegions,
+SceneRenderer::DirectionalLightProgram::setDirectionalLight(const RGB & c, const Direction3D & d,
+ const std::span<const glm::mat4x4> lvp, const std::span<const TextureRelRegion> shadowMapRegions,
std::size_t maps) const
{
glUniform3fv(colourLoc, 1, glm::value_ptr(c));