summaryrefslogtreecommitdiff
path: root/shaders
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-05-10 16:46:26 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2011-05-10 16:46:26 +0200
commitd42ec5c0e89559abd276334b6c4804e1eaa5e9c7 (patch)
treec6afda3e3f51d4ac79ffcdabd2edfc6d36df4201 /shaders
parentfa1216b691dc5be3429858dcff845239b1aec417 (diff)
parent7d93cab1eb1629b068858a68ac5e5840fe84a83a (diff)
Merge branch 'master' into win32
Conflicts: gui.h quadtree.cpp scene.cpp scene.h
Diffstat (limited to 'shaders')
-rw-r--r--shaders/terrain_fragment.glsl3
-rw-r--r--shaders/terrain_vertex.glsl3
2 files changed, 4 insertions, 2 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: */
diff --git a/shaders/terrain_vertex.glsl b/shaders/terrain_vertex.glsl
index 5fcd17b..27da83f 100644
--- a/shaders/terrain_vertex.glsl
+++ b/shaders/terrain_vertex.glsl
@@ -1,11 +1,12 @@
#version 120
varying vec3 normal, light_pos, pos;
+uniform vec2 chunk_pos;
void main() {
normal = gl_Normal;
light_pos = vec3(0, 1, 0);
- pos = gl_Vertex.xyz;
+ pos = gl_Vertex.xyz + vec3(chunk_pos.x, 0, chunk_pos.y);
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;