summaryrefslogtreecommitdiff
path: root/gfx/gl/sceneShader.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-07-07 23:21:25 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2024-07-07 23:21:25 +0100
commit07064efcfecb0f1140f829ee2481079fa02cc587 (patch)
treead9914fc74c46cacbfb6a1187ce99cb89171521a /gfx/gl/sceneShader.h
parentAdd shadow shader which takes into account texture transparency (diff)
downloadilt-07064efcfecb0f1140f829ee2481079fa02cc587.tar.bz2
ilt-07064efcfecb0f1140f829ee2481079fa02cc587.tar.xz
ilt-07064efcfecb0f1140f829ee2481079fa02cc587.zip
Simplify setup of uniform locations and containing programs
Diffstat (limited to 'gfx/gl/sceneShader.h')
-rw-r--r--gfx/gl/sceneShader.h24
1 files changed, 11 insertions, 13 deletions
diff --git a/gfx/gl/sceneShader.h b/gfx/gl/sceneShader.h
index 07b0b26..51f0e21 100644
--- a/gfx/gl/sceneShader.h
+++ b/gfx/gl/sceneShader.h
@@ -10,19 +10,15 @@ class Location;
class SceneShader {
class SceneProgram : public Program {
public:
- template<typename... S>
- inline explicit SceneProgram(const S &... srcs) :
- Program {srcs...}, viewProjectionLoc {*this, "viewProjection"}, viewPointLoc {*this, "viewPoint"},
- viewPortLoc {*this, "viewPort"}
- {
- }
+ using Program::Program;
void setViewProjection(const GlobalPosition3D &, const glm::mat4 &) const;
void setViewPort(const ViewPort &) const;
private:
- RequiredUniformLocation viewProjectionLoc, viewPointLoc;
- UniformLocation viewPortLoc;
+ RequiredUniformLocation viewProjectionLoc {*this, "viewProjection"};
+ RequiredUniformLocation viewPointLoc {*this, "viewPoint"};
+ UniformLocation viewPortLoc {*this, "viewPort"};
};
class BasicProgram : public SceneProgram {
@@ -32,8 +28,8 @@ class SceneShader {
void use(const Location &) const;
private:
- RequiredUniformLocation modelLoc;
- RequiredUniformLocation modelPosLoc;
+ RequiredUniformLocation modelLoc {*this, "model"};
+ RequiredUniformLocation modelPosLoc {*this, "modelPos"};
};
class AbsolutePosProgram : public SceneProgram {
@@ -44,12 +40,14 @@ class SceneShader {
class NetworkProgram : public AbsolutePosProgram {
public:
- template<typename... S> explicit NetworkProgram(S &&...);
+ using AbsolutePosProgram::AbsolutePosProgram;
void use(const std::span<const glm::vec3>, const std::span<const float>) const;
private:
- RequiredUniformLocation profileLoc, texturePosLoc, profileLengthLoc;
+ RequiredUniformLocation profileLoc {*this, "profile"};
+ RequiredUniformLocation texturePosLoc {*this, "texturePos"};
+ RequiredUniformLocation profileLengthLoc {*this, "profileLength"};
};
class WaterProgram : public SceneProgram {
@@ -58,7 +56,7 @@ class SceneShader {
void use(float waveCycle) const;
private:
- RequiredUniformLocation waveLoc;
+ RequiredUniformLocation waveLoc {*this, "waves"};
};
public: