diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-10-10 01:01:24 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-10-10 01:01:24 +0100 |
commit | 493af2b220d6ba7f883d35a6bb30cb5d07b4a4b5 (patch) | |
tree | 521409fb60f70303a353724b454070d53dfaa1a5 | |
parent | Include foliage yaw rotation in vertex, pass through instead of whole model r... (diff) | |
download | ilt-493af2b220d6ba7f883d35a6bb30cb5d07b4a4b5.tar.bz2 ilt-493af2b220d6ba7f883d35a6bb30cb5d07b4a4b5.tar.xz ilt-493af2b220d6ba7f883d35a6bb30cb5d07b4a4b5.zip |
Use foliage yaw rotation to select shadow stencil layer
-rw-r--r-- | gfx/gl/shaders/shadowDynamicPointStencil.gs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gfx/gl/shaders/shadowDynamicPointStencil.gs b/gfx/gl/shaders/shadowDynamicPointStencil.gs index b91937d..7e81d97 100644 --- a/gfx/gl/shaders/shadowDynamicPointStencil.gs +++ b/gfx/gl/shaders/shadowDynamicPointStencil.gs @@ -2,12 +2,14 @@ #extension GL_ARB_viewport_array : enable const vec2[] corners = vec2[4](vec2(-1, -1), vec2(-1, 1), vec2(1, -1), vec2(1, 1)); +const float tau = 6.28318531; uniform mat4 viewProjection[4]; uniform int viewProjections; uniform vec3 sizes[4]; uniform float size; +in float vmodelYaw[]; in ivec3 vworldPos[]; flat out vec3 scale; @@ -19,13 +21,14 @@ layout(triangle_strip, max_vertices = 16) out; void main() { + int viewAngle = int(round(4.0 + (vmodelYaw[0] / tau))) % 8; for (gl_Layer = 0; gl_Layer < viewProjections; ++gl_Layer) { scale = 2.0 * size / sizes[gl_Layer]; vec4 pos = viewProjection[gl_Layer] * vec4(vworldPos[0], 1); for (int c = 0; c < corners.length(); ++c) { gl_Position = pos + vec4(scale.xy * corners[c], 0, 0); gl_Position.z = max(gl_Position.z, -1); - texCoord = vec3((corners[c] * 0.5) + 0.5, 0); + texCoord = vec3((corners[c] * 0.5) + 0.5, viewAngle); EmitVertex(); } EndPrimitive(); |