summaryrefslogtreecommitdiff
path: root/shaders
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-05-10 15:40:02 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2011-05-10 15:40:02 +0200
commit7d93cab1eb1629b068858a68ac5e5840fe84a83a (patch)
treefc90eaecc54a03943e4114443ad3d6ad111b9b9a /shaders
parent0073f833c88f4a25dadc777495639069ba9d7bed (diff)
Added fog and implemented a simple skybox.
Diffstat (limited to 'shaders')
-rw-r--r--shaders/terrain_fragment.glsl3
1 files changed, 2 insertions, 1 deletions
diff --git a/shaders/terrain_fragment.glsl b/shaders/terrain_fragment.glsl
index 0925c6b..c3f0d46 100644
--- a/shaders/terrain_fragment.glsl
+++ b/shaders/terrain_fragment.glsl
@@ -4,7 +4,7 @@ varying vec3 normal, light_pos, pos;
uniform sampler2D tex[3];
uniform sampler2D marktex;
-uniform vec3 selpos;
+uniform vec3 selpos, player_pos;
uniform bool show_sel;
void main() {
@@ -27,6 +27,7 @@ void main() {
vec2 st = vec2((pos.x + 1 - selpos.x) / 2, (pos.z + 1 - selpos.z) / 2);
gl_FragColor += texture2D(marktex, st);
}
+ gl_FragColor = mix(gl_FragColor, gl_Fog.color, pow(length(player_pos - pos), 2) / 10000);
}
/* vim: set syn=glsl: */