From 8391c63472641c67f59723d0a6706efff6fb17d4 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 23 Jan 2024 23:50:46 +0000 Subject: Fix network population of position in gBuffer Adds some rails to the basic test highlighting broken shadows --- gfx/gl/shaders/network.fs | 2 +- gfx/gl/shaders/networkCommon.glsl | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'gfx/gl') diff --git a/gfx/gl/shaders/network.fs b/gfx/gl/shaders/network.fs index e7d15b3..4e347b4 100644 --- a/gfx/gl/shaders/network.fs +++ b/gfx/gl/shaders/network.fs @@ -11,7 +11,7 @@ uniform ivec3 viewPoint; void main() { - gPosition = ivec4(viewPoint + rposition, 0); + gPosition = ivec4(viewPoint + rposition, 1); gNormal = vec4(0, 0, 1, 1); gAlbedoSpec = texture(texture0, texCoord); } diff --git a/gfx/gl/shaders/networkCommon.glsl b/gfx/gl/shaders/networkCommon.glsl index 7b55cad..0bc3c1c 100644 --- a/gfx/gl/shaders/networkCommon.glsl +++ b/gfx/gl/shaders/networkCommon.glsl @@ -21,9 +21,9 @@ ifelse( TYPE, .gs, // Begin: Geometry shader only function void doVertex(const ivec3 end, const uint v, const float texY, const mat2 rot) { - rposition = vec3(rot * profile[v].xy, profile[v].z); - ivec3 vpos = end + ivec3(rposition); - gl_Position = viewProjection * vec4(vpos - viewPoint, 1); + ivec3 vpos = end + ivec3(rot * profile[v].xy, profile[v].z); + rposition = vpos - viewPoint; + gl_Position = viewProjection * vec4(rposition, 1); texCoord = vec2(texturePos[v], texY); EmitVertex(); } -- cgit v1.2.3