summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/gl/shaders')
-rw-r--r--gfx/gl/shaders/commonShadowPoint.glsl3
-rw-r--r--gfx/gl/shaders/commonShadowPoint.gs3
-rw-r--r--gfx/gl/shaders/shadowDynamicPointInstWithTextures.fs15
-rw-r--r--gfx/gl/shaders/shadowDynamicPointInstWithTextures.gs3
-rw-r--r--gfx/gl/shaders/shadowDynamicPointInstWithTextures.vs3
5 files changed, 27 insertions, 0 deletions
diff --git a/gfx/gl/shaders/commonShadowPoint.glsl b/gfx/gl/shaders/commonShadowPoint.glsl
index ba4611a..c4ea827 100644
--- a/gfx/gl/shaders/commonShadowPoint.glsl
+++ b/gfx/gl/shaders/commonShadowPoint.glsl
@@ -1,8 +1,11 @@
out vec4 vworldPos;
+ifdef(`TEXTURES', out vec2 vtexCoord;);
+
void
main()
{
vec3 worldPos = model * position;
vworldPos = vec4(worldPos - viewPoint + modelPos, 1);
+ ifdef(`TEXTURES', vtexCoord = texCoord;);
}
diff --git a/gfx/gl/shaders/commonShadowPoint.gs b/gfx/gl/shaders/commonShadowPoint.gs
index b008f29..b99bd20 100644
--- a/gfx/gl/shaders/commonShadowPoint.gs
+++ b/gfx/gl/shaders/commonShadowPoint.gs
@@ -7,6 +7,8 @@ in vec4 vworldPos[];
layout(triangles) in;
layout(triangle_strip, max_vertices = 12) out;
+ifdef(`TEXTURES', in vec2 vtexCoord[]; out vec2 texCoord;);
+
void
main()
{
@@ -15,6 +17,7 @@ main()
gl_Position = viewProjection[vp] * vworldPos[v];
gl_Position.z = max(gl_Position.z, -1);
gl_Layer = vp;
+ ifdef(`TEXTURES', texCoord = vtexCoord[v];);
EmitVertex();
}
EndPrimitive();
diff --git a/gfx/gl/shaders/shadowDynamicPointInstWithTextures.fs b/gfx/gl/shaders/shadowDynamicPointInstWithTextures.fs
new file mode 100644
index 0000000..90519e3
--- /dev/null
+++ b/gfx/gl/shaders/shadowDynamicPointInstWithTextures.fs
@@ -0,0 +1,15 @@
+#version 330 core
+#extension GL_ARB_shading_language_420pack : enable
+
+layout(binding = 3) uniform sampler2D texture0;
+
+in vec2 texCoord;
+
+void
+main()
+{
+ if (texture(texture0, texCoord).a < 0.5) {
+ discard;
+ }
+ gl_FragDepth = gl_FragCoord.z;
+}
diff --git a/gfx/gl/shaders/shadowDynamicPointInstWithTextures.gs b/gfx/gl/shaders/shadowDynamicPointInstWithTextures.gs
new file mode 100644
index 0000000..e6e213e
--- /dev/null
+++ b/gfx/gl/shaders/shadowDynamicPointInstWithTextures.gs
@@ -0,0 +1,3 @@
+define(`TEXTURES', 1)
+
+include(`commonShadowPoint.gs')
diff --git a/gfx/gl/shaders/shadowDynamicPointInstWithTextures.vs b/gfx/gl/shaders/shadowDynamicPointInstWithTextures.vs
new file mode 100644
index 0000000..27ad9d7
--- /dev/null
+++ b/gfx/gl/shaders/shadowDynamicPointInstWithTextures.vs
@@ -0,0 +1,3 @@
+define(`TEXTURES', 1)
+
+include(`shadowDynamicPointInst.vs')