diff --git a/Effects/ws30.eff b/Effects/ws30.eff index 14d3cbd25..660136316 100644 --- a/Effects/ws30.eff +++ b/Effects/ws30.eff @@ -19,19 +19,6 @@ 1.2 - - Textures/Terrain/cropgrass1.png - 2d - linear-mipmap-linear - - repeat - repeat - - - normalized - Textures/Terrain/city1.png 2d @@ -504,8 +491,8 @@ texture[0]/image - nearest-mipmap-nearest - nearest-mipmap-nearest + nearest + nearest texture[0]/wrap-s @@ -527,17 +514,16 @@ texture[1]/image - - texture[1]/filter - + nearest-mipmap-nearest + nearest-mipmap-nearest - texture[1]/wrap-s + texture[0]/wrap-s - texture[1]/wrap-t + texture[0]/wrap-t - texture[1]/internal-format + texture[0]/internal-format @@ -767,7 +753,7 @@ 0 - grass + atlas sampler-2d 1 diff --git a/Materials/base/landclass-mapping.xml b/Materials/base/landclass-mapping.xml index 98f632298..d73864f93 100644 --- a/Materials/base/landclass-mapping.xml +++ b/Materials/base/landclass-mapping.xml @@ -1,11 +1,11 @@ - - 111 - Continuous urban fabric - 1 - Urban - + + 111 - Continuous urban fabric + 1 + Urban + 112 - Discontinuous urban fabric @@ -268,7 +268,7 @@ 999 - NODATA 48 - Default + Ocean diff --git a/Shaders/ws30.frag b/Shaders/ws30.frag index f8fa8fb68..bd04e3837 100644 --- a/Shaders/ws30.frag +++ b/Shaders/ws30.frag @@ -1,7 +1,8 @@ // WS30 FRAGMENT SHADER // -*-C++-*- -#version 120 +#version 130 +#extension GL_EXT_texture_array : enable // written by Thorsten Renk, Oct 2011, based on default.frag // Ambient term comes in gl_Color.rgb. @@ -11,10 +12,10 @@ varying vec3 relPos; uniform sampler2D landclass; -uniform sampler2D grass; -uniform sampler2D city; -uniform sampler2D forest; -uniform sampler2D water; +uniform sampler2DArray atlas; +//uniform sampler2D city; +//uniform sampler2D forest; +//uniform sampler2D water; varying float yprime_alt; @@ -97,20 +98,11 @@ void main() // is closer to what the OpenGL fixed function pipeline does. color = clamp(color, 0.0, 1.0); - 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(grass, gl_TexCoord[0].st); - } + int lc = int(texture2D(landclass, gl_TexCoord[0].st).b * 255.0 + 0.5); + //vec2 st = mod(gl_TexCoord[0].st, 0.125); // mod to 1/8 of the space + //st.s = st.s + 0.125 * mod(lc, 8); + //st.y = st.y + 0.125 * int(lc/8); + texel = texture(atlas, vec3(gl_TexCoord[0].st, lc)); //texel = texture2D(texture, gl_TexCoord[0].st); fragColor = color * texel + specular;