diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-11-25 16:28:39 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-11-25 16:28:39 +0000 |
commit | 0aa665c3648d788755b00c9e431c872d57fddbb8 (patch) | |
tree | 859dba97d3026db485813d808e8180ac94a0ed2a /gfx/gl | |
parent | Remove getTransform (diff) | |
download | ilt-0aa665c3648d788755b00c9e431c872d57fddbb8.tar.bz2 ilt-0aa665c3648d788755b00c9e431c872d57fddbb8.tar.xz ilt-0aa665c3648d788755b00c9e431c872d57fddbb8.zip |
Model positions as integers
Introduces test failure in arcs due to rounding, but I don't want to create a complicated
fix as link positions are still floats and hopefully that'll go away... somehow
Diffstat (limited to 'gfx/gl')
-rw-r--r-- | gfx/gl/bufferedLocation.cpp | 8 | ||||
-rw-r--r-- | gfx/gl/bufferedLocation.h | 8 | ||||
-rw-r--r-- | gfx/gl/sceneShader.cpp | 2 | ||||
-rw-r--r-- | gfx/gl/shaders/dynamicPoint.vs | 2 | ||||
-rw-r--r-- | gfx/gl/shaders/dynamicPointInst.vs | 2 | ||||
-rw-r--r-- | gfx/gl/shaders/fixedPoint.vs | 2 | ||||
-rw-r--r-- | gfx/gl/shaders/shadowDynamicPoint.vs | 2 | ||||
-rw-r--r-- | gfx/gl/shaders/shadowDynamicPointInst.vs | 2 | ||||
-rw-r--r-- | gfx/gl/shaders/shadowFixedPoint.vs | 2 | ||||
-rw-r--r-- | gfx/gl/shadowMapper.cpp | 2 |
10 files changed, 16 insertions, 16 deletions
diff --git a/gfx/gl/bufferedLocation.cpp b/gfx/gl/bufferedLocation.cpp index 2a2e723..d6a63b9 100644 --- a/gfx/gl/bufferedLocation.cpp +++ b/gfx/gl/bufferedLocation.cpp @@ -2,7 +2,7 @@ #include "location.h" #include <glm/gtx/transform.hpp> -BufferedLocation::BufferedLocation(Position3D p, Rotation3D r) : BufferedLocation {Location {p, r}} { } +BufferedLocation::BufferedLocation(GlobalPosition3D p, Rotation3D r) : BufferedLocation {Location {p, r}} { } BufferedLocation::BufferedLocation(const Location & l) : loc {l} { } @@ -19,7 +19,7 @@ BufferedLocation::operator=(const Location & l) return *this; } -Position3D +GlobalPosition3D BufferedLocation::position() const { return loc.pos; @@ -32,7 +32,7 @@ BufferedLocation::rotation() const } void -BufferedLocation::setPosition(Position3D p, bool update) +BufferedLocation::setPosition(GlobalPosition3D p, bool update) { loc.pos = p; if (update) { @@ -50,7 +50,7 @@ BufferedLocation::setRotation(Position3D r, bool update) } void -BufferedLocation::setLocation(Position3D p, Rotation3D r) +BufferedLocation::setLocation(GlobalPosition3D p, Rotation3D r) { loc.pos = p; loc.rot = r; diff --git a/gfx/gl/bufferedLocation.h b/gfx/gl/bufferedLocation.h index 30967e3..87b957f 100644 --- a/gfx/gl/bufferedLocation.h +++ b/gfx/gl/bufferedLocation.h @@ -8,7 +8,7 @@ class BufferedLocation { public: - BufferedLocation(Position3D = {}, Rotation3D = {}); + BufferedLocation(GlobalPosition3D = {}, Rotation3D = {}); BufferedLocation(const Location &); virtual ~BufferedLocation() = default; @@ -16,11 +16,11 @@ public: operator const Location &() const; - [[nodiscard]] Position3D position() const; + [[nodiscard]] GlobalPosition3D position() const; [[nodiscard]] Rotation3D rotation() const; - void setPosition(Position3D, bool update = true); + void setPosition(GlobalPosition3D, bool update = true); void setRotation(Rotation3D, bool update = true); - void setLocation(Position3D, Rotation3D); + void setLocation(GlobalPosition3D, Rotation3D); [[nodiscard]] glm::mat4 getRotationTransform() const; diff --git a/gfx/gl/sceneShader.cpp b/gfx/gl/sceneShader.cpp index de75814..59a9748 100644 --- a/gfx/gl/sceneShader.cpp +++ b/gfx/gl/sceneShader.cpp @@ -69,7 +69,7 @@ void SceneShader::BasicProgram::setModel(Location const & location) const { glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(rotate_ypr(location.rot))); - glUniform3fv(modelPosLoc, 1, glm::value_ptr(location.pos)); + glUniform3iv(modelPosLoc, 1, glm::value_ptr(location.pos)); } void diff --git a/gfx/gl/shaders/dynamicPoint.vs b/gfx/gl/shaders/dynamicPoint.vs index 9dd6a47..667f247 100644 --- a/gfx/gl/shaders/dynamicPoint.vs +++ b/gfx/gl/shaders/dynamicPoint.vs @@ -7,6 +7,6 @@ include(`materialInterface.glsl') uniform mat4 viewProjection; uniform vec3 viewPoint; uniform mat4 model; -uniform vec3 modelPos; +uniform ivec3 modelPos; include(`commonPoint.glsl') diff --git a/gfx/gl/shaders/dynamicPointInst.vs b/gfx/gl/shaders/dynamicPointInst.vs index 4ae6813..adf39bd 100644 --- a/gfx/gl/shaders/dynamicPointInst.vs +++ b/gfx/gl/shaders/dynamicPointInst.vs @@ -7,6 +7,6 @@ include(`materialInterface.glsl') uniform mat4 viewProjection; uniform vec3 viewPoint; layout(location = 5) in mat4 model; -layout(location = 9) in vec3 modelPos; +layout(location = 9) in ivec3 modelPos; include(`commonPoint.glsl') diff --git a/gfx/gl/shaders/fixedPoint.vs b/gfx/gl/shaders/fixedPoint.vs index 0adbb02..6e1ab49 100644 --- a/gfx/gl/shaders/fixedPoint.vs +++ b/gfx/gl/shaders/fixedPoint.vs @@ -7,6 +7,6 @@ include(`materialInterface.glsl') uniform mat4 viewProjection; uniform vec3 viewPoint; const mat4 model = mat4(1); -const vec3 modelPos = vec3(0); +const vec3 modelPos = ivec3(0); include(`commonPoint.glsl') diff --git a/gfx/gl/shaders/shadowDynamicPoint.vs b/gfx/gl/shaders/shadowDynamicPoint.vs index eb25423..e20d31a 100644 --- a/gfx/gl/shaders/shadowDynamicPoint.vs +++ b/gfx/gl/shaders/shadowDynamicPoint.vs @@ -5,6 +5,6 @@ include(`meshIn.glsl') uniform mat4 viewProjection; uniform vec3 viewPoint; uniform mat4 model; -uniform vec3 modelPos; +uniform ivec3 modelPos; include(`commonShadowPoint.glsl') diff --git a/gfx/gl/shaders/shadowDynamicPointInst.vs b/gfx/gl/shaders/shadowDynamicPointInst.vs index a0f51c3..ab3e976 100644 --- a/gfx/gl/shaders/shadowDynamicPointInst.vs +++ b/gfx/gl/shaders/shadowDynamicPointInst.vs @@ -5,6 +5,6 @@ include(`meshIn.glsl') uniform mat4 viewProjection; uniform vec3 viewPoint; layout(location = 5) in mat4 model; -layout(location = 9) in vec3 modelPos; +layout(location = 9) in ivec3 modelPos; include(`commonShadowPoint.glsl') diff --git a/gfx/gl/shaders/shadowFixedPoint.vs b/gfx/gl/shaders/shadowFixedPoint.vs index dfc5c42..a9fb4a3 100644 --- a/gfx/gl/shaders/shadowFixedPoint.vs +++ b/gfx/gl/shaders/shadowFixedPoint.vs @@ -5,6 +5,6 @@ include(`meshIn.glsl') uniform mat4 viewProjection; uniform vec3 viewPoint; const mat4 model = mat4(1); -const vec3 modelPos = vec3(0); +const ivec3 modelPos = ivec3(0); include(`commonShadowPoint.glsl') diff --git a/gfx/gl/shadowMapper.cpp b/gfx/gl/shadowMapper.cpp index 4a8d7ec..07db6a1 100644 --- a/gfx/gl/shadowMapper.cpp +++ b/gfx/gl/shadowMapper.cpp @@ -202,5 +202,5 @@ void ShadowMapper::DynamicPoint::setModel(const Location & location) const { glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(rotate_ypr(location.rot))); - glUniform3fv(modelPosLoc, 1, glm::value_ptr(location.pos)); + glUniform3iv(modelPosLoc, 1, glm::value_ptr(location.pos)); } |