summaryrefslogtreecommitdiff
path: root/gfx/gl
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/gl')
-rw-r--r--gfx/gl/sceneRenderer.cpp2
-rw-r--r--gfx/gl/sceneRenderer.h2
-rw-r--r--gfx/gl/sceneShader.cpp4
-rw-r--r--gfx/gl/sceneShader.h4
-rw-r--r--gfx/gl/shadowMapper.cpp47
-rw-r--r--gfx/gl/shadowMapper.h2
6 files changed, 31 insertions, 30 deletions
diff --git a/gfx/gl/sceneRenderer.cpp b/gfx/gl/sceneRenderer.cpp
index 6965175..4a3fec9 100644
--- a/gfx/gl/sceneRenderer.cpp
+++ b/gfx/gl/sceneRenderer.cpp
@@ -135,7 +135,7 @@ SceneRenderer::DirectionalLightProgram::DirectionalLightProgram() :
void
SceneRenderer::DirectionalLightProgram::setDirectionalLight(const RGB & c, const Direction3D & d,
- const std::span<const glm::mat4x4> lvp, const std::span<const glm::vec4> shadowMapRegions,
+ 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));
diff --git a/gfx/gl/sceneRenderer.h b/gfx/gl/sceneRenderer.h
index 87f474b..30fd8d3 100644
--- a/gfx/gl/sceneRenderer.h
+++ b/gfx/gl/sceneRenderer.h
@@ -40,7 +40,7 @@ private:
using Program::use;
void setDirectionalLight(const RGB &, const Direction3D &, const std::span<const glm::mat4x4>,
- const std::span<const glm::vec4>, std::size_t maps) const;
+ const std::span<const TextureRelRegion>, std::size_t maps) const;
private:
RequiredUniformLocation directionLoc, colourLoc, lightViewProjectionLoc, lightViewProjectionCountLoc,
diff --git a/gfx/gl/sceneShader.cpp b/gfx/gl/sceneShader.cpp
index 04b6d9e..2dc2e70 100644
--- a/gfx/gl/sceneShader.cpp
+++ b/gfx/gl/sceneShader.cpp
@@ -35,7 +35,7 @@ SceneShader::setViewProjection(const glm::mat4 & viewProjection) const
}
void
-SceneShader::setViewPort(const glm::ivec4 & viewPort) const
+SceneShader::setViewPort(const ViewPort & viewPort) const
{
for (const auto & prog : std::array<const SceneProgram *, 7> {
&basic, &basicInst, &water, &landmass, &absolute, &pointLight, &spotLight}) {
@@ -51,7 +51,7 @@ SceneShader::SceneProgram::setViewProjection(const glm::mat4 & viewProjection) c
}
void
-SceneShader::SceneProgram::setViewPort(const glm::ivec4 & viewPort) const
+SceneShader::SceneProgram::setViewPort(const ViewPort & viewPort) const
{
if (viewPortLoc >= 0) {
glUseProgram(*this);
diff --git a/gfx/gl/sceneShader.h b/gfx/gl/sceneShader.h
index d1c6ef2..f46b842 100644
--- a/gfx/gl/sceneShader.h
+++ b/gfx/gl/sceneShader.h
@@ -16,7 +16,7 @@ class SceneShader {
}
void setViewProjection(const glm::mat4 &) const;
- void setViewPort(const glm::ivec4 &) const;
+ void setViewPort(const ViewPort &) const;
private:
RequiredUniformLocation viewProjectionLoc;
@@ -88,5 +88,5 @@ public:
SpotLightShader spotLight;
void setViewProjection(const glm::mat4 & viewProjection) const;
- void setViewPort(const glm::ivec4 & viewPort) const;
+ void setViewPort(const ViewPort & viewPort) const;
};
diff --git a/gfx/gl/shadowMapper.cpp b/gfx/gl/shadowMapper.cpp
index aea5af3..94a0791 100644
--- a/gfx/gl/shadowMapper.cpp
+++ b/gfx/gl/shadowMapper.cpp
@@ -24,7 +24,7 @@ ShadowMapper::ShadowMapper(const TextureAbsCoord & s) :
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
- static constexpr glm::vec4 border {std::numeric_limits<float>::infinity()};
+ static constexpr RGBA border {std::numeric_limits<RGBA::value_type>::infinity()};
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, glm::value_ptr(border));
glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);
@@ -37,7 +37,7 @@ ShadowMapper::ShadowMapper(const TextureAbsCoord & s) :
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
-constexpr std::array<std::array<glm::ivec4, ShadowMapper::SHADOW_BANDS>, ShadowMapper::SHADOW_BANDS> viewports {{
+constexpr std::array<std::array<TextureAbsRegion, ShadowMapper::SHADOW_BANDS>, ShadowMapper::SHADOW_BANDS> viewports {{
{{
{31, 31, 0, 0}, // full
}},
@@ -57,27 +57,28 @@ constexpr std::array<std::array<glm::ivec4, ShadowMapper::SHADOW_BANDS>, ShadowM
{1, 1, 1, 1}, // upper right
}},
}};
-constexpr std::array<std::array<glm::vec4, ShadowMapper::SHADOW_BANDS>, ShadowMapper::SHADOW_BANDS> shadowMapRegions {{
- {{
- {0.5F, 0.5F, 0.5F, 0.5F}, // full
- }},
- {{
- {0.5F, 0.25F, 0.5F, 0.25F}, // lower half
- {0.5F, 0.25F, 0.5F, 0.75F}, // upper half
- }},
- {{
- {0.5F, 0.25F, 0.5F, 0.25F}, // lower half
- {0.25F, 0.25F, 0.25F, 0.75F}, // upper left
- {0.25F, 0.25F, 0.75F, 0.75F}, // upper right
- }},
-
- {{
- {0.25F, 0.25F, 0.25F, 0.25F}, // lower left
- {0.25F, 0.25F, 0.75F, 0.25F}, // lower right
- {0.25F, 0.25F, 0.25F, 0.75F}, // upper left
- {0.25F, 0.25F, 0.75F, 0.75F}, // upper right
- }},
-}};
+constexpr std::array<std::array<TextureAbsRegion, ShadowMapper::SHADOW_BANDS>, ShadowMapper::SHADOW_BANDS>
+ shadowMapRegions {{
+ {{
+ {0.5F, 0.5F, 0.5F, 0.5F}, // full
+ }},
+ {{
+ {0.5F, 0.25F, 0.5F, 0.25F}, // lower half
+ {0.5F, 0.25F, 0.5F, 0.75F}, // upper half
+ }},
+ {{
+ {0.5F, 0.25F, 0.5F, 0.25F}, // lower half
+ {0.25F, 0.25F, 0.25F, 0.75F}, // upper left
+ {0.25F, 0.25F, 0.75F, 0.75F}, // upper right
+ }},
+
+ {{
+ {0.25F, 0.25F, 0.25F, 0.25F}, // lower left
+ {0.25F, 0.25F, 0.75F, 0.25F}, // lower right
+ {0.25F, 0.25F, 0.25F, 0.75F}, // upper left
+ {0.25F, 0.25F, 0.75F, 0.75F}, // upper right
+ }},
+ }};
constexpr std::array<float, ShadowMapper::SHADOW_BANDS + 1> shadowBands {
1.F,
250.F,
diff --git a/gfx/gl/shadowMapper.h b/gfx/gl/shadowMapper.h
index e5272a3..d54734c 100644
--- a/gfx/gl/shadowMapper.h
+++ b/gfx/gl/shadowMapper.h
@@ -18,7 +18,7 @@ public:
struct Definitions {
std::array<glm::mat4x4, SHADOW_BANDS> projections {};
- std::array<glm::vec4, SHADOW_BANDS> regions {};
+ std::array<TextureRelRegion, SHADOW_BANDS> regions {};
size_t maps {};
};