summaryrefslogtreecommitdiff
path: root/gfx/gl
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-12-03 12:37:46 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-12-03 12:37:46 +0000
commit4e6f8db35ddc8fd3f310bb5616d257b5f9996d94 (patch)
treef764ab4c884cbad4e0621cb811701459cc57781c /gfx/gl
parentTest case for finding ray entry points (diff)
downloadilt-4e6f8db35ddc8fd3f310bb5616d257b5f9996d94.tar.bz2
ilt-4e6f8db35ddc8fd3f310bb5616d257b5f9996d94.tar.xz
ilt-4e6f8db35ddc8fd3f310bb5616d257b5f9996d94.zip
Shader viewPoint now an integer
Diffstat (limited to 'gfx/gl')
-rw-r--r--gfx/gl/sceneShader.cpp6
-rw-r--r--gfx/gl/sceneShader.h4
-rw-r--r--gfx/gl/shaders/dynamicPoint.vs2
-rw-r--r--gfx/gl/shaders/dynamicPointInst.vs2
-rw-r--r--gfx/gl/shaders/fixedPoint.vs2
-rw-r--r--gfx/gl/shaders/pointLight.gs2
-rw-r--r--gfx/gl/shaders/pointLight.vs2
-rw-r--r--gfx/gl/shaders/shadowDynamicPoint.vs2
-rw-r--r--gfx/gl/shaders/shadowDynamicPointInst.vs2
-rw-r--r--gfx/gl/shaders/shadowFixedPoint.vs2
-rw-r--r--gfx/gl/shaders/spotLight.gs2
-rw-r--r--gfx/gl/shaders/spotLight.vs2
-rw-r--r--gfx/gl/shaders/water.vs2
13 files changed, 16 insertions, 16 deletions
diff --git a/gfx/gl/sceneShader.cpp b/gfx/gl/sceneShader.cpp
index 59a9748..57c8bb7 100644
--- a/gfx/gl/sceneShader.cpp
+++ b/gfx/gl/sceneShader.cpp
@@ -26,7 +26,7 @@ SceneShader::SceneShader() :
}
void
-SceneShader::setViewProjection(const Position3D & viewPoint, const glm::mat4 & viewProjection) const
+SceneShader::setViewProjection(const GlobalPosition3D & viewPoint, const glm::mat4 & viewProjection) const
{
for (const auto & prog : std::array<const SceneProgram *, 7> {
&basic, &basicInst, &water, &landmass, &absolute, &pointLight, &spotLight}) {
@@ -44,11 +44,11 @@ SceneShader::setViewPort(const ViewPort & viewPort) const
}
void
-SceneShader::SceneProgram::setViewProjection(const Position3D & viewPoint, const glm::mat4 & viewProjection) const
+SceneShader::SceneProgram::setViewProjection(const GlobalPosition3D & viewPoint, const glm::mat4 & viewProjection) const
{
glUseProgram(*this);
glUniformMatrix4fv(viewProjectionLoc, 1, GL_FALSE, glm::value_ptr(viewProjection));
- glUniform3fv(viewPointLoc, 1, glm::value_ptr(viewPoint));
+ glUniform3iv(viewPointLoc, 1, glm::value_ptr(viewPoint));
}
void
diff --git a/gfx/gl/sceneShader.h b/gfx/gl/sceneShader.h
index 83c234c..7ffaacd 100644
--- a/gfx/gl/sceneShader.h
+++ b/gfx/gl/sceneShader.h
@@ -16,7 +16,7 @@ class SceneShader {
{
}
- void setViewProjection(const Position3D &, const glm::mat4 &) const;
+ void setViewProjection(const GlobalPosition3D &, const glm::mat4 &) const;
void setViewPort(const ViewPort &) const;
private:
@@ -91,6 +91,6 @@ public:
PointLightShader pointLight;
SpotLightShader spotLight;
- void setViewProjection(const Position3D & viewPoint, const glm::mat4 & viewProjection) const;
+ void setViewProjection(const GlobalPosition3D & viewPoint, const glm::mat4 & viewProjection) const;
void setViewPort(const ViewPort & viewPort) const;
};
diff --git a/gfx/gl/shaders/dynamicPoint.vs b/gfx/gl/shaders/dynamicPoint.vs
index 667f247..097cd11 100644
--- a/gfx/gl/shaders/dynamicPoint.vs
+++ b/gfx/gl/shaders/dynamicPoint.vs
@@ -5,7 +5,7 @@ include(`meshIn.glsl')
include(`materialInterface.glsl')
uniform mat4 viewProjection;
-uniform vec3 viewPoint;
+uniform ivec3 viewPoint;
uniform mat4 model;
uniform ivec3 modelPos;
diff --git a/gfx/gl/shaders/dynamicPointInst.vs b/gfx/gl/shaders/dynamicPointInst.vs
index adf39bd..529fe1d 100644
--- a/gfx/gl/shaders/dynamicPointInst.vs
+++ b/gfx/gl/shaders/dynamicPointInst.vs
@@ -5,7 +5,7 @@ include(`meshIn.glsl')
include(`materialInterface.glsl')
uniform mat4 viewProjection;
-uniform vec3 viewPoint;
+uniform ivec3 viewPoint;
layout(location = 5) in mat4 model;
layout(location = 9) in ivec3 modelPos;
diff --git a/gfx/gl/shaders/fixedPoint.vs b/gfx/gl/shaders/fixedPoint.vs
index 6e1ab49..3cea737 100644
--- a/gfx/gl/shaders/fixedPoint.vs
+++ b/gfx/gl/shaders/fixedPoint.vs
@@ -5,7 +5,7 @@ include(`meshIn.glsl')
include(`materialInterface.glsl')
uniform mat4 viewProjection;
-uniform vec3 viewPoint;
+uniform ivec3 viewPoint;
const mat4 model = mat4(1);
const vec3 modelPos = ivec3(0);
diff --git a/gfx/gl/shaders/pointLight.gs b/gfx/gl/shaders/pointLight.gs
index ec089f5..9c41ed4 100644
--- a/gfx/gl/shaders/pointLight.gs
+++ b/gfx/gl/shaders/pointLight.gs
@@ -19,7 +19,7 @@ const vec3[] cube = vec3[]( // http://www.cs.umd.edu/gvil/papers/av_ts.pdf
vec3(1, 1, -1) // Back-top-right
);
uniform mat4 viewProjection;
-uniform vec3 viewPoint;
+uniform ivec3 viewPoint;
in vec3 centre[];
in float size[];
diff --git a/gfx/gl/shaders/pointLight.vs b/gfx/gl/shaders/pointLight.vs
index 7694a25..00a34a3 100644
--- a/gfx/gl/shaders/pointLight.vs
+++ b/gfx/gl/shaders/pointLight.vs
@@ -4,7 +4,7 @@ layout(location = 0) in vec3 position;
uniform vec3 colour;
uniform float kq;
-uniform vec3 viewPoint;
+uniform ivec3 viewPoint;
out vec3 centre;
out float size;
diff --git a/gfx/gl/shaders/shadowDynamicPoint.vs b/gfx/gl/shaders/shadowDynamicPoint.vs
index e20d31a..f21b3b6 100644
--- a/gfx/gl/shaders/shadowDynamicPoint.vs
+++ b/gfx/gl/shaders/shadowDynamicPoint.vs
@@ -3,7 +3,7 @@
include(`meshIn.glsl')
uniform mat4 viewProjection;
-uniform vec3 viewPoint;
+uniform ivec3 viewPoint;
uniform mat4 model;
uniform ivec3 modelPos;
diff --git a/gfx/gl/shaders/shadowDynamicPointInst.vs b/gfx/gl/shaders/shadowDynamicPointInst.vs
index ab3e976..28a62d9 100644
--- a/gfx/gl/shaders/shadowDynamicPointInst.vs
+++ b/gfx/gl/shaders/shadowDynamicPointInst.vs
@@ -3,7 +3,7 @@
include(`meshIn.glsl')
uniform mat4 viewProjection;
-uniform vec3 viewPoint;
+uniform ivec3 viewPoint;
layout(location = 5) in mat4 model;
layout(location = 9) in ivec3 modelPos;
diff --git a/gfx/gl/shaders/shadowFixedPoint.vs b/gfx/gl/shaders/shadowFixedPoint.vs
index a9fb4a3..168d5f1 100644
--- a/gfx/gl/shaders/shadowFixedPoint.vs
+++ b/gfx/gl/shaders/shadowFixedPoint.vs
@@ -3,7 +3,7 @@
include(`meshIn.glsl')
uniform mat4 viewProjection;
-uniform vec3 viewPoint;
+uniform ivec3 viewPoint;
const mat4 model = mat4(1);
const ivec3 modelPos = ivec3(0);
diff --git a/gfx/gl/shaders/spotLight.gs b/gfx/gl/shaders/spotLight.gs
index 0529614..b58c169 100644
--- a/gfx/gl/shaders/spotLight.gs
+++ b/gfx/gl/shaders/spotLight.gs
@@ -10,7 +10,7 @@ const vec3[] pyramid = vec3[]( // four-sided
vec3(1, -1, 1) // Front-right
);
uniform mat4 viewProjection;
-uniform vec3 viewPoint;
+uniform ivec3 viewPoint;
uniform float arc;
in vec3 position[];
diff --git a/gfx/gl/shaders/spotLight.vs b/gfx/gl/shaders/spotLight.vs
index 08197a4..ac1d1db 100644
--- a/gfx/gl/shaders/spotLight.vs
+++ b/gfx/gl/shaders/spotLight.vs
@@ -6,7 +6,7 @@ uniform vec3 v_direction;
uniform vec3 colour;
uniform float kq;
uniform float arc;
-uniform vec3 viewPoint;
+uniform ivec3 viewPoint;
out vec3 position;
out vec3 direction;
diff --git a/gfx/gl/shaders/water.vs b/gfx/gl/shaders/water.vs
index 03eabb2..f609d9e 100644
--- a/gfx/gl/shaders/water.vs
+++ b/gfx/gl/shaders/water.vs
@@ -4,7 +4,7 @@ include(`meshIn.glsl')
include(`materialInterface.glsl')
uniform mat4 viewProjection;
-uniform vec3 viewPoint;
+uniform ivec3 viewPoint;
uniform vec3 waves;
void