diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-11-01 19:12:04 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-11-01 19:12:04 +0000 |
commit | 3b791f79bf53e481d053ea4516eedce8be3423bf (patch) | |
tree | 39817b0996eaa867c7f7abbc5dbd5cb706ecbaa5 /gfx/gl/shaders/waterShader.fs | |
parent | Somewhat dirty but functional helper to save a texture (diff) | |
download | ilt-3b791f79bf53e481d053ea4516eedce8be3423bf.tar.bz2 ilt-3b791f79bf53e481d053ea4516eedce8be3423bf.tar.xz ilt-3b791f79bf53e481d053ea4516eedce8be3423bf.zip |
Switch to a deferred lighting based render pipeline
Tidy-up required.
Diffstat (limited to 'gfx/gl/shaders/waterShader.fs')
-rw-r--r-- | gfx/gl/shaders/waterShader.fs | 21 |
1 files changed, 15 insertions, 6 deletions
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); } |