summaryrefslogtreecommitdiff
path: root/gfx/gl/sceneShader.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-22 02:25:47 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-22 02:25:47 +0000
commit961f69d8cda0364c04ec98efc70a6f21e0a091e6 (patch)
treebffeb04832ea6615cc9d3908a6de1c8fb01e9bd6 /gfx/gl/sceneShader.cpp
parentAdd missing support for glUniform simple span of numbers (diff)
downloadilt-961f69d8cda0364c04ec98efc70a6f21e0a091e6.tar.bz2
ilt-961f69d8cda0364c04ec98efc70a6f21e0a091e6.tar.xz
ilt-961f69d8cda0364c04ec98efc70a6f21e0a091e6.zip
Bind the network profile in as uniforms
Makes the network shaders generic to network type
Diffstat (limited to 'gfx/gl/sceneShader.cpp')
-rw-r--r--gfx/gl/sceneShader.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/gfx/gl/sceneShader.cpp b/gfx/gl/sceneShader.cpp
index 146e642..bc64a88 100644
--- a/gfx/gl/sceneShader.cpp
+++ b/gfx/gl/sceneShader.cpp
@@ -86,6 +86,23 @@ SceneShader::BasicProgram::use(Location const & location) const
setModel(location);
}
+template<typename... S>
+SceneShader::NetworkProgram::NetworkProgram(S &&... s) :
+ AbsolutePosProgram {std::forward<S>(s)...}, profileLoc {*this, "profile"}, texturePosLoc {*this, "texturePos"},
+ profileLengthLoc {*this, "profileLength"}
+{
+}
+
+void
+SceneShader::NetworkProgram::use(
+ const std::span<const glm::vec3> profile, const std::span<const float> texturePos) const
+{
+ Program::use();
+ glUniform(profileLoc, profile);
+ glUniform(texturePosLoc, texturePos);
+ glUniform(profileLengthLoc, static_cast<GLuint>(profile.size()));
+}
+
SceneShader::WaterProgram::WaterProgram() : SceneProgram {water_vs, water_fs}, waveLoc {*this, "waves"} { }
void