From 3b791f79bf53e481d053ea4516eedce8be3423bf Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 1 Nov 2022 19:12:04 +0000 Subject: Switch to a deferred lighting based render pipeline Tidy-up required. --- gfx/gl/shaders/waterShader.fs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'gfx/gl/shaders/waterShader.fs') diff --git a/gfx/gl/shaders/waterShader.fs b/gfx/gl/shaders/waterShader.fs index abfa532..d242566 100644 --- a/gfx/gl/shaders/waterShader.fs +++ b/gfx/gl/shaders/waterShader.fs @@ -1,13 +1,22 @@ #version 330 core +#extension GL_ARB_shading_language_420pack : enable -in vec2 texCoord0; -in float depth; +in vec3 FragPos; +in vec2 TexCoords; +in vec3 Normal; -uniform sampler2D sampler; +out vec4 gPosition; +out vec4 gNormal; +out vec4 gAlbedoSpec; + +uniform sampler2D texture0; uniform vec3 waves; -void main() +void +main() { - gl_FragColor = texture(sampler, texCoord0); - gl_FragColor.a *= clamp(-depth * .7, .1, 1.0); + gPosition = vec4(FragPos, 1); + gNormal = vec4(Normal, 1); + gAlbedoSpec = texture(texture0, TexCoords); + gAlbedoSpec.a *= clamp(-FragPos.z * .7, .1, 1.0); } -- cgit v1.2.3