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/basicShader.fs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'gfx/gl/shaders/basicShader.fs') 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); } -- cgit v1.2.3