diff --git a/Compositor/Effects/ws30.eff b/Compositor/Effects/ws30.eff
index 3471da921..acece4aa5 100644
--- a/Compositor/Effects/ws30.eff
+++ b/Compositor/Effects/ws30.eff
@@ -46,6 +46,19 @@
normalized
+ Textures/Terrain/forest.png
+ 2d
+ linear-mipmap-linear
+
+ repeat
+ repeat
+
+
+ normalized
+
+
Textures/Terrain/water.png
2d
linear-mipmap-linear
@@ -492,9 +505,8 @@
-
-
-
+ nearest-mipmap-nearest
+ nearest-mipmap-nearest
@@ -504,6 +516,11 @@
+
+ max
+ max
+ max
+
@@ -562,6 +579,25 @@
+
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Shaders/ALS/generic-base.vert
Shaders/ALS/shadows-include.vert
@@ -732,20 +768,25 @@
0
- texture1
+ grass
sampler-2d
1
- texture2
+ city
sampler-2d
2
- texture3
+ forest
sampler-2d
3
+
+ water
+ sampler-2d
+ 4
+
colorMode
int
diff --git a/Compositor/Shaders/ALS/ws30.frag b/Compositor/Shaders/ALS/ws30.frag
index f227d516a..c6eaac854 100644
--- a/Compositor/Shaders/ALS/ws30.frag
+++ b/Compositor/Shaders/ALS/ws30.frag
@@ -13,9 +13,10 @@ varying vec3 relPos;
uniform float fg_Fcoef;
uniform sampler2D landclass;
-uniform sampler2D texture1;
-uniform sampler2D texture2;
-uniform sampler2D texture3;
+uniform sampler2D grass;
+uniform sampler2D city;
+uniform sampler2D forest;
+uniform sampler2D water;
varying float yprime_alt;
@@ -34,6 +35,11 @@ uniform float overcast;
uniform float eye_alt;
uniform float cloud_self_shading;
+// Passed from VPBTechnique, not the Effect
+uniform int tile_level;
+uniform float tile_width;
+uniform float tile_height;
+
const float EarthRadius = 5800000.0;
const float terminator_width = 200000.0;
@@ -64,7 +70,6 @@ void main()
vec3 lightDir = gl_LightSource[0].position.xyz;
vec3 halfVector = gl_LightSource[0].halfVector.xyz;
vec4 texel;
- vec4 lc;
vec4 fragColor;
vec4 specular = vec4(0.0);
float intensity;
@@ -96,27 +101,24 @@ void main()
// is closer to what the OpenGL fixed function pipeline does.
color = clamp(color, 0.0, 1.0);
-/*
- landclass = texture2D(texture, gl_TexCoord[0].st);
- texel = (landclass.r > 0.148) * texture2D(texture, gl_TexCoord[3].st) +
- (landclass.g < 0.02) * texture2D(texture, gl_TexCoord[2].st) +
- (1 - ((landclass.r > 0.148) || (landclass.g < 0.02))) * texture2D(texture, gl_TexCoord[1].st);
-*/
- lc = texture2D(landclass, gl_TexCoord[0].st);
- if (lc.r > 0.148) {
- // Water
- texel = texture2D(texture3, gl_TexCoord[0].st);
- } else if (lc.g > 0.02) {
- texel = texture2D(texture1, gl_TexCoord[0].st);
+ int lc = int(texture2D(landclass, gl_TexCoord[0].st).r * 256.0 + 0.5);
+
+ if ((lc == 1) || (lc == 2) || (lc == 4) || (lc == 5))
+ {
+ texel = texture2D(city, gl_TexCoord[0].st);
+ } else if ((lc > 21) && (lc < 25))
+ {
+ texel = texture2D(forest, gl_TexCoord[0].st);
+ } else if (lc > 38)
+ {
+ texel = texture2D(water, gl_TexCoord[0].st);
} else {
- texel = texture2D(texture2, gl_TexCoord[0].st);
+ texel = texture2D(grass, gl_TexCoord[0].st);
}
//texel = texture2D(texture, gl_TexCoord[0].st);
fragColor = color * texel + specular;
-
-
// here comes the terrain haze model