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/basicShader.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/basicShader.fs')
-rw-r--r-- | gfx/gl/shaders/basicShader.fs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/gfx/gl/shaders/basicShader.fs b/gfx/gl/shaders/basicShader.fs index 0bd42b4..9c4945b 100644 --- a/gfx/gl/shaders/basicShader.fs +++ b/gfx/gl/shaders/basicShader.fs @@ -1,15 +1,20 @@ #version 330 core -in vec2 texCoord0; -in vec3 normal0; +in vec3 FragPos; +in vec2 TexCoords; +in vec3 Normal; -uniform sampler2D sampler; -uniform vec3 lightDirection; -uniform vec3 lightColor; -uniform vec3 ambientColor; +out vec4 gPosition; +out vec4 gNormal; +out vec4 gAlbedoSpec; -void main() +uniform sampler2D texture0; + +void +main() { - gl_FragColor = texture(sampler, texCoord0); - gl_FragColor.rgb *= clamp(ambientColor + (dot(-lightDirection, normal0) * lightColor), 0.0, 1.0); + float clear = round(texture(texture0, TexCoords).a); + gPosition = vec4(FragPos, clear); + gNormal = vec4(Normal, clear); + gAlbedoSpec = texture(texture0, TexCoords); } |