summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders/basicShader.fs
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-02-18 09:04:25 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-02-18 09:04:25 +0000
commitc0a0827a29536349f58e21023daf2963fb9247e6 (patch)
tree84748ccbb46eaad78da5bd8814a671f51fe88653 /gfx/gl/shaders/basicShader.fs
parentAllow setting any uniform in shaders (diff)
downloadilt-c0a0827a29536349f58e21023daf2963fb9247e6.tar.bz2
ilt-c0a0827a29536349f58e21023daf2963fb9247e6.tar.xz
ilt-c0a0827a29536349f58e21023daf2963fb9247e6.zip
Add support for directional light color and an ambient color
Diffstat (limited to 'gfx/gl/shaders/basicShader.fs')
-rw-r--r--gfx/gl/shaders/basicShader.fs4
1 files changed, 3 insertions, 1 deletions
diff --git a/gfx/gl/shaders/basicShader.fs b/gfx/gl/shaders/basicShader.fs
index 7d79575..b6c011d 100644
--- a/gfx/gl/shaders/basicShader.fs
+++ b/gfx/gl/shaders/basicShader.fs
@@ -5,9 +5,11 @@ in vec3 normal0;
uniform sampler2D sampler;
uniform vec3 lightDirection;
+uniform vec3 lightColor;
+uniform vec3 ambientColor;
void main()
{
gl_FragColor = texture(sampler, texCoord0);
- gl_FragColor.xyz *= clamp(dot(-lightDirection, normal0), 0.0, 1.0);
+ gl_FragColor.xyz *= clamp(ambientColor + (dot(-lightDirection, normal0) * lightColor), 0.0, 1.0);
}