summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-11 22:54:44 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-11 22:54:44 +0100
commitd0186d81127056ac2647807dcf05b454e234a7cb (patch)
treec479dfcf588927ebc87d95c4a8e1d01c28205799 /gfx/gl/shaders
parentMove lots of common glsl interface to include files (diff)
downloadilt-d0186d81127056ac2647807dcf05b454e234a7cb.tar.bz2
ilt-d0186d81127056ac2647807dcf05b454e234a7cb.tar.xz
ilt-d0186d81127056ac2647807dcf05b454e234a7cb.zip
Move the vertex/fragment shader interface for materials into an include
Diffstat (limited to 'gfx/gl/shaders')
-rw-r--r--gfx/gl/shaders/basicShader.fs5
-rw-r--r--gfx/gl/shaders/basicShader.vs5
-rw-r--r--gfx/gl/shaders/landmassShader.fs4
-rw-r--r--gfx/gl/shaders/landmassShader.vs5
-rw-r--r--gfx/gl/shaders/materialInterface.glsl4
-rw-r--r--gfx/gl/shaders/waterShader.fs4
-rw-r--r--gfx/gl/shaders/waterShader.vs4
7 files changed, 10 insertions, 21 deletions
diff --git a/gfx/gl/shaders/basicShader.fs b/gfx/gl/shaders/basicShader.fs
index 0d0b904..8bb6350 100644
--- a/gfx/gl/shaders/basicShader.fs
+++ b/gfx/gl/shaders/basicShader.fs
@@ -1,9 +1,6 @@
#version 330 core
-in vec3 FragPos;
-in vec2 TexCoords;
-in vec3 Normal;
-in vec4 Colour;
+include(`materialInterface.glsl')
include(`geometryOut.glsl')
uniform sampler2D texture0;
diff --git a/gfx/gl/shaders/basicShader.vs b/gfx/gl/shaders/basicShader.vs
index a96d478..4d648f3 100644
--- a/gfx/gl/shaders/basicShader.vs
+++ b/gfx/gl/shaders/basicShader.vs
@@ -1,10 +1,7 @@
#version 330 core
include(`meshIn.glsl')
-out vec3 FragPos;
-out vec2 TexCoords;
-out vec3 Normal;
-out vec4 Colour;
+include(`materialInterface.glsl')
uniform mat4 viewProjection;
uniform mat4 model;
diff --git a/gfx/gl/shaders/landmassShader.fs b/gfx/gl/shaders/landmassShader.fs
index 5daeeb6..f3cc3e8 100644
--- a/gfx/gl/shaders/landmassShader.fs
+++ b/gfx/gl/shaders/landmassShader.fs
@@ -1,8 +1,6 @@
#version 330 core
-in vec3 FragPos;
-in vec2 TexCoords;
-in vec3 Normal;
+include(`materialInterface.glsl')
include(`geometryOut.glsl')
uniform sampler2D texture0;
diff --git a/gfx/gl/shaders/landmassShader.vs b/gfx/gl/shaders/landmassShader.vs
index 3eb9aa3..cabe39f 100644
--- a/gfx/gl/shaders/landmassShader.vs
+++ b/gfx/gl/shaders/landmassShader.vs
@@ -1,10 +1,7 @@
#version 330 core
include(`meshIn.glsl')
-out vec3 FragPos;
-out vec2 TexCoords;
-out vec3 Normal;
-out vec4 Colour;
+include(`materialInterface.glsl')
uniform mat4 viewProjection;
diff --git a/gfx/gl/shaders/materialInterface.glsl b/gfx/gl/shaders/materialInterface.glsl
new file mode 100644
index 0000000..3e09c85
--- /dev/null
+++ b/gfx/gl/shaders/materialInterface.glsl
@@ -0,0 +1,4 @@
+ifelse(TYPE, .fs, in, out) vec3 FragPos;
+ifelse(TYPE, .fs, in, out) vec2 TexCoords;
+ifelse(TYPE, .fs, in, out) vec3 Normal;
+ifelse(TYPE, .fs, in, out) vec4 Colour;
diff --git a/gfx/gl/shaders/waterShader.fs b/gfx/gl/shaders/waterShader.fs
index d457f27..5936da4 100644
--- a/gfx/gl/shaders/waterShader.fs
+++ b/gfx/gl/shaders/waterShader.fs
@@ -1,9 +1,7 @@
#version 330 core
#extension GL_ARB_shading_language_420pack : enable
-in vec3 FragPos;
-in vec2 TexCoords;
-in vec3 Normal;
+include(`materialInterface.glsl')
include(`geometryOut.glsl')
uniform sampler2D texture0;
diff --git a/gfx/gl/shaders/waterShader.vs b/gfx/gl/shaders/waterShader.vs
index 6f96c19..a21b49f 100644
--- a/gfx/gl/shaders/waterShader.vs
+++ b/gfx/gl/shaders/waterShader.vs
@@ -1,9 +1,7 @@
#version 330 core
include(`meshIn.glsl')
-out vec3 FragPos;
-out vec2 TexCoords;
-out vec3 Normal;
+include(`materialInterface.glsl')
uniform mat4 viewProjection;
uniform vec3 waves;