diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-07-07 23:21:25 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-07-07 23:21:25 +0100 |
commit | 07064efcfecb0f1140f829ee2481079fa02cc587 (patch) | |
tree | ad9914fc74c46cacbfb6a1187ce99cb89171521a /gfx/gl/sceneShader.h | |
parent | Add shadow shader which takes into account texture transparency (diff) | |
download | ilt-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.h | 24 |
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: |