summaryrefslogtreecommitdiff
path: root/gfx/gl/shader.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-02-20 00:17:58 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-02-20 00:17:58 +0000
commit2bc4bcebc93e7211dfb84303888635f888ba8018 (patch)
tree3a349beadc079c544001f3a65ac0e26fe494f8e5 /gfx/gl/shader.cpp
parentCreate smoother terrain (diff)
downloadilt-2bc4bcebc93e7211dfb84303888635f888ba8018.tar.bz2
ilt-2bc4bcebc93e7211dfb84303888635f888ba8018.tar.xz
ilt-2bc4bcebc93e7211dfb84303888635f888ba8018.zip
Custom land and water shaders
Create sandy beaches, snow topped mountains and grassy hills with a single texture, coloured according to land height by a custom shader. Also use the land mass mesh with a new water texture and a custom shader to create rather nice looking water effect with depth, waves and motion.
Diffstat (limited to 'gfx/gl/shader.cpp')
-rw-r--r--gfx/gl/shader.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/gfx/gl/shader.cpp b/gfx/gl/shader.cpp
index 8c58c39..454ad4b 100644
--- a/gfx/gl/shader.cpp
+++ b/gfx/gl/shader.cpp
@@ -1,7 +1,11 @@
#include "shader.h"
#include <array>
#include <gfx/gl/shaders/fs-basicShader.h>
+#include <gfx/gl/shaders/fs-landmassShader.h>
+#include <gfx/gl/shaders/fs-waterShader.h>
#include <gfx/gl/shaders/vs-basicShader.h>
+#include <gfx/gl/shaders/vs-landmassShader.h>
+#include <gfx/gl/shaders/vs-waterShader.h>
#include <glm/glm.hpp>
#include <stdexcept>
#include <string>
@@ -28,9 +32,17 @@ Shader::ProgramHandle::ProgramHandle(std::initializer_list<GLuint> srcs) : viewP
Shader::Shader() :
programs {{{
- Source {{basicShader_vs, basicShader_vs_len}, GL_VERTEX_SHADER}.id,
- Source {{basicShader_fs, basicShader_fs_len}, GL_FRAGMENT_SHADER}.id,
- }}}
+ Source {{basicShader_vs, basicShader_vs_len}, GL_VERTEX_SHADER}.id,
+ Source {{basicShader_fs, basicShader_fs_len}, GL_FRAGMENT_SHADER}.id,
+ },
+ {
+ Source {{waterShader_vs, waterShader_vs_len}, GL_VERTEX_SHADER}.id,
+ Source {{waterShader_fs, waterShader_fs_len}, GL_FRAGMENT_SHADER}.id,
+ },
+ {
+ Source {{landmassShader_vs, landmassShader_vs_len}, GL_VERTEX_SHADER}.id,
+ Source {{landmassShader_fs, landmassShader_fs_len}, GL_FRAGMENT_SHADER}.id,
+ }}}
{
}