4 STRING: sky-vertex-shader
6 uniform float sky_theta;
7 varying vec3 direction;
11 vec4 v = vec4(gl_Vertex.xy, 1.0, 1.0);
14 vec4 p = gl_ProjectionMatrixInverse * v;
17 float s = sin(sky_theta), c = cos(sky_theta);
18 direction = mat3(1, 0, 0, 0, c, s, 0, -s, c)
19 * (gl_ModelViewMatrixInverse * vec4(p.xyz, 0.0)).xyz;
24 STRING: sky-pixel-shader
26 uniform sampler2D sky;
27 uniform float sky_gradient, sky_theta;
29 const vec4 SKY_COLOR_A = vec4(0.25, 0.0, 0.5, 1.0),
30 SKY_COLOR_B = vec4(0.6, 0.5, 0.75, 1.0);
32 varying vec3 direction;
36 float t = texture2D(sky, normalize(direction.xyz).xy * 0.5 + vec2(0.5)).x + sky_gradient;
37 gl_FragColor = mix(SKY_COLOR_A, SKY_COLOR_B, sin(6.28*t));
42 STRING: terrain-vertex-shader
44 uniform sampler2D heightmap;
45 uniform vec4 component_scale;
47 varying vec2 heightcoords;
49 float height(sampler2D map, vec2 coords)
51 vec4 v = texture2D(map, coords);
52 return dot(v, component_scale);
57 gl_Position = gl_ModelViewProjectionMatrix
58 * (gl_Vertex + vec4(0, height(heightmap, gl_Vertex.xz), 0, 0));
59 heightcoords = gl_Vertex.xz;
64 STRING: terrain-pixel-shader
66 uniform sampler2D heightmap;
67 uniform vec4 component_scale;
69 varying vec2 heightcoords;
71 float height(sampler2D map, vec2 coords)
73 vec4 v = texture2D(map, coords);
74 return dot(v, component_scale);
79 gl_FragColor = texture2D(heightmap, heightcoords);