diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2018-03-13 15:30:05 +0100 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2018-03-13 16:41:49 +0100 |
commit | cf647ebf504eb523d822fa79622cb59d009680da (patch) | |
tree | efaa792f312bb18db07c94d1460801209279ed3f /cwd/shaders | |
parent | Fixed holes when block on section border destroyed (diff) | |
download | AltCraft-cf647ebf504eb523d822fa79622cb59d009680da.tar AltCraft-cf647ebf504eb523d822fa79622cb59d009680da.tar.gz AltCraft-cf647ebf504eb523d822fa79622cb59d009680da.tar.bz2 AltCraft-cf647ebf504eb523d822fa79622cb59d009680da.tar.lz AltCraft-cf647ebf504eb523d822fa79622cb59d009680da.tar.xz AltCraft-cf647ebf504eb523d822fa79622cb59d009680da.tar.zst AltCraft-cf647ebf504eb523d822fa79622cb59d009680da.zip |
Diffstat (limited to '')
-rw-r--r-- | cwd/shaders/face.fs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/cwd/shaders/face.fs b/cwd/shaders/face.fs index c4405d4..a4e020c 100644 --- a/cwd/shaders/face.fs +++ b/cwd/shaders/face.fs @@ -9,6 +9,7 @@ in VS_OUT { uniform sampler2D textureAtlas; uniform vec2 windowSize; +uniform float DayTime; vec3 rgb2hsv(vec3 c) { @@ -29,12 +30,19 @@ vec3 hsv2rgb(vec3 c) } void main() { - gl_FragColor = texture(textureAtlas,fs_in.Texture); - if (gl_FragColor.a < 0.3) + vec4 color = texture(textureAtlas,fs_in.Texture); + if (color.a < 0.3) discard; - vec3 hsvColor = rgb2hsv(gl_FragColor.xyz); + + vec3 hsvColor = rgb2hsv(color.xyz); hsvColor+=fs_in.Color; - gl_FragColor = vec4(hsv2rgb(hsvColor),1); - //float faceLight = clamp((fs_in.Light.x + fs_in.Light.y) / 15.0,0.2,1.0); - //gl_FragColor = vec4(gl_FragColor.rgb * faceLight,gl_FragColor.a); + color = vec4(hsv2rgb(hsvColor),1); + + float light = fs_in.Light.x / 15.0; + float skyLight = (fs_in.Light.y / 15.0) * DayTime; + + float faceLight = clamp(light + skyLight,0.2,1.0); + + color = vec4(color.rgb * faceLight, color.a); + gl_FragColor = color; }
\ No newline at end of file |