From f22f79330f9b8851cda76d1e11555877cbb72d80 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 3 Sep 2024 01:37:03 +0100 Subject: Populate all layers of the stencil texture Albeit with the same projection --- gfx/gl/shaders/shadowStencil.gs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 gfx/gl/shaders/shadowStencil.gs (limited to 'gfx/gl/shaders/shadowStencil.gs') diff --git a/gfx/gl/shaders/shadowStencil.gs b/gfx/gl/shaders/shadowStencil.gs new file mode 100644 index 0000000..eea4643 --- /dev/null +++ b/gfx/gl/shaders/shadowStencil.gs @@ -0,0 +1,28 @@ +#version 330 core +#extension GL_ARB_viewport_array : enable + +include(`materialDetail.glsl') + +layout(triangles) in; +layout(triangle_strip, max_vertices = 24) out; + +uniform mat4 viewProjection; +in vec3 FragPos[]; +in vec2 TexCoords[]; +flat in MaterialDetail Material[]; +out vec2 gTexCoords; +flat out MaterialDetail gMaterial; + +void +main() +{ + for (gl_Layer = 0; gl_Layer < 8; ++gl_Layer) { + for (int v = 0; v < FragPos.length(); ++v) { + gl_Position = viewProjection * vec4(FragPos[v], 1); + gTexCoords = TexCoords[v]; + gMaterial = Material[v]; + EmitVertex(); + } + EndPrimitive(); + } +} -- cgit v1.2.3 From 5ec74c35fb1f2524add7fd03ace78667f93edb2e Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 7 Sep 2024 12:35:03 +0100 Subject: Populate all layers of shadow stencil with view from all around --- gfx/gl/shaders/shadowStencil.gs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gfx/gl/shaders/shadowStencil.gs') diff --git a/gfx/gl/shaders/shadowStencil.gs b/gfx/gl/shaders/shadowStencil.gs index eea4643..2c3f9bd 100644 --- a/gfx/gl/shaders/shadowStencil.gs +++ b/gfx/gl/shaders/shadowStencil.gs @@ -6,7 +6,7 @@ include(`materialDetail.glsl') layout(triangles) in; layout(triangle_strip, max_vertices = 24) out; -uniform mat4 viewProjection; +uniform mat4 viewProjection[8]; in vec3 FragPos[]; in vec2 TexCoords[]; flat in MaterialDetail Material[]; @@ -16,9 +16,9 @@ flat out MaterialDetail gMaterial; void main() { - for (gl_Layer = 0; gl_Layer < 8; ++gl_Layer) { + for (gl_Layer = 0; gl_Layer < viewProjection.length(); ++gl_Layer) { for (int v = 0; v < FragPos.length(); ++v) { - gl_Position = viewProjection * vec4(FragPos[v], 1); + gl_Position = viewProjection[gl_Layer] * vec4(FragPos[v], 1); gTexCoords = TexCoords[v]; gMaterial = Material[v]; EmitVertex(); -- cgit v1.2.3