summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-27 17:55:30 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-27 17:55:30 +0100
commit4f34ed9c949785784f0006f971b5fd2bb9508553 (patch)
tree20f6627a2f441212365d05d04160a5a6a97063e7 /gfx/gl/shaders
parentMerge remote-tracking branch 'origin/assimp-normals' (diff)
parentRevert "Export mesh size and primitive type" (diff)
downloadilt-4f34ed9c949785784f0006f971b5fd2bb9508553.tar.bz2
ilt-4f34ed9c949785784f0006f971b5fd2bb9508553.tar.xz
ilt-4f34ed9c949785784f0006f971b5fd2bb9508553.zip
Merge branch 'instancing-pt2'
Diffstat (limited to 'gfx/gl/shaders')
-rw-r--r--gfx/gl/shaders/commonPoint.glsl13
-rw-r--r--gfx/gl/shaders/commonShadowPoint.glsl6
-rw-r--r--gfx/gl/shaders/dynamicPoint.vs14
-rw-r--r--gfx/gl/shaders/dynamicPointInst.vs16
-rw-r--r--gfx/gl/shaders/fixedPoint.vs13
-rw-r--r--gfx/gl/shaders/shadowDynamicPoint.vs7
-rw-r--r--gfx/gl/shaders/shadowDynamicPointInst.vs8
-rw-r--r--gfx/gl/shaders/shadowFixedPoint.vs8
8 files changed, 35 insertions, 50 deletions
diff --git a/gfx/gl/shaders/commonPoint.glsl b/gfx/gl/shaders/commonPoint.glsl
new file mode 100644
index 0000000..ecf5fc9
--- /dev/null
+++ b/gfx/gl/shaders/commonPoint.glsl
@@ -0,0 +1,13 @@
+void
+main()
+{
+ vec4 worldPos = model * vec4(position, 1.0);
+
+ FragPos = worldPos.xyz;
+ TexCoords = texCoord;
+ Normal = (model * vec4(normal, 0.0)).xyz;
+ Colour = colour;
+ Material = material;
+
+ gl_Position = viewProjection * worldPos;
+}
diff --git a/gfx/gl/shaders/commonShadowPoint.glsl b/gfx/gl/shaders/commonShadowPoint.glsl
new file mode 100644
index 0000000..c7cbd3e
--- /dev/null
+++ b/gfx/gl/shaders/commonShadowPoint.glsl
@@ -0,0 +1,6 @@
+void
+main()
+{
+ gl_Position = viewProjection * model * vec4(position, 1.0);
+ gl_Position.z = max(gl_Position.z, -1);
+}
diff --git a/gfx/gl/shaders/dynamicPoint.vs b/gfx/gl/shaders/dynamicPoint.vs
index e1701ed..ffa8275 100644
--- a/gfx/gl/shaders/dynamicPoint.vs
+++ b/gfx/gl/shaders/dynamicPoint.vs
@@ -6,16 +6,4 @@ include(`materialInterface.glsl')
uniform mat4 viewProjection;
uniform mat4 model;
-void
-main()
-{
- vec4 worldPos = model * vec4(position, 1.0);
-
- FragPos = worldPos.xyz;
- TexCoords = texCoord;
- Normal = (model * vec4(normal, 0.0)).xyz;
- Colour = colour;
- Material = material;
-
- gl_Position = viewProjection * worldPos;
-}
+include(`commonPoint.glsl')
diff --git a/gfx/gl/shaders/dynamicPointInst.vs b/gfx/gl/shaders/dynamicPointInst.vs
index 1c66979..e4c8526 100644
--- a/gfx/gl/shaders/dynamicPointInst.vs
+++ b/gfx/gl/shaders/dynamicPointInst.vs
@@ -1,21 +1,9 @@
#version 330 core
include(`meshIn.glsl')
-layout(location = 5) in mat4 model;
include(`materialInterface.glsl')
uniform mat4 viewProjection;
+layout(location = 5) in mat4 model;
-void
-main()
-{
- vec4 worldPos = model * vec4(position, 1.0);
-
- FragPos = worldPos.xyz;
- TexCoords = texCoord;
- Normal = (model * vec4(normal, 0.0)).xyz;
- Colour = colour;
- Material = material;
-
- gl_Position = viewProjection * worldPos;
-}
+include(`commonPoint.glsl')
diff --git a/gfx/gl/shaders/fixedPoint.vs b/gfx/gl/shaders/fixedPoint.vs
index 0cc8153..6f517ca 100644
--- a/gfx/gl/shaders/fixedPoint.vs
+++ b/gfx/gl/shaders/fixedPoint.vs
@@ -4,15 +4,6 @@ include(`meshIn.glsl')
include(`materialInterface.glsl')
uniform mat4 viewProjection;
+const mat4 model = mat4(1);
-void
-main()
-{
- FragPos = position;
- TexCoords = texCoord;
- Normal = normal;
- Colour = colour;
- Material = material;
-
- gl_Position = viewProjection * vec4(position, 1.0);
-}
+include(`commonPoint.glsl')
diff --git a/gfx/gl/shaders/shadowDynamicPoint.vs b/gfx/gl/shaders/shadowDynamicPoint.vs
index 531d8de..f3ed533 100644
--- a/gfx/gl/shaders/shadowDynamicPoint.vs
+++ b/gfx/gl/shaders/shadowDynamicPoint.vs
@@ -5,9 +5,4 @@ include(`meshIn.glsl')
uniform mat4 viewProjection;
uniform mat4 model;
-void
-main()
-{
- gl_Position = viewProjection * model * vec4(position, 1.0);
- gl_Position.z = max(gl_Position.z, -1);
-}
+include(`commonShadowPoint.glsl')
diff --git a/gfx/gl/shaders/shadowDynamicPointInst.vs b/gfx/gl/shaders/shadowDynamicPointInst.vs
new file mode 100644
index 0000000..1bf74ef
--- /dev/null
+++ b/gfx/gl/shaders/shadowDynamicPointInst.vs
@@ -0,0 +1,8 @@
+#version 330 core
+
+include(`meshIn.glsl')
+
+uniform mat4 viewProjection;
+layout(location = 5) in mat4 model;
+
+include(`commonShadowPoint.glsl')
diff --git a/gfx/gl/shaders/shadowFixedPoint.vs b/gfx/gl/shaders/shadowFixedPoint.vs
index c9fa19b..8921707 100644
--- a/gfx/gl/shaders/shadowFixedPoint.vs
+++ b/gfx/gl/shaders/shadowFixedPoint.vs
@@ -3,10 +3,6 @@
include(`meshIn.glsl')
uniform mat4 viewProjection;
+const mat4 model = mat4(1);
-void
-main()
-{
- gl_Position = viewProjection * vec4(position, 1.0);
- gl_Position.z = max(gl_Position.z, -1);
-}
+include(`commonShadowPoint.glsl')