1
0
Fork 0

Merge branch 'next' of ssh://git.code.sf.net/p/flightgear/fgdata into next

This commit is contained in:
Erik Hofman 2020-11-15 09:32:41 +01:00
commit 5dde54d43b
2 changed files with 68 additions and 25 deletions

View file

@ -46,6 +46,19 @@
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<texture n="3"> <texture n="3">
<image>Textures/Terrain/forest.png</image>
<type>2d</type>
<filter>linear-mipmap-linear</filter>
<!-- also repeat -->
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<!--
<wrap-r>clamp-to-border</wrap-r>
-->
<!-- float, signed-integer, integer -->
<internal-format>normalized</internal-format>
</texture>
<texture n="4">
<image>Textures/Terrain/water.png</image> <image>Textures/Terrain/water.png</image>
<type>2d</type> <type>2d</type>
<filter>linear-mipmap-linear</filter> <filter>linear-mipmap-linear</filter>
@ -492,9 +505,8 @@
<image> <image>
<use>texture[0]/image</use> <use>texture[0]/image</use>
</image> </image>
<filter> <filter>nearest-mipmap-nearest</filter>
<use>texture[0]/filter</use> <mag-filter>nearest-mipmap-nearest</mag-filter>
</filter>
<wrap-s> <wrap-s>
<use>texture[0]/wrap-s</use> <use>texture[0]/wrap-s</use>
</wrap-s> </wrap-s>
@ -504,6 +516,11 @@
<internal-format> <internal-format>
<use>texture[0]/internal-format</use> <use>texture[0]/internal-format</use>
</internal-format> </internal-format>
<mipmap-control>
<r>max</r>
<g>max</g>
<b>max</b>
</mipmap-control>
</texture-unit> </texture-unit>
<texture-unit> <texture-unit>
@ -562,6 +579,25 @@
</internal-format> </internal-format>
</texture-unit> </texture-unit>
<texture-unit>
<unit>4</unit>
<image>
<use>texture[4]/image</use>
</image>
<filter>
<use>texture[4]/filter</use>
</filter>
<wrap-s>
<use>texture[4]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[4]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[4]/internal-format</use>
</internal-format>
</texture-unit>
<program> <program>
<vertex-shader>Shaders/ALS/generic-base.vert</vertex-shader> <vertex-shader>Shaders/ALS/generic-base.vert</vertex-shader>
<vertex-shader>Shaders/ALS/shadows-include.vert</vertex-shader> <vertex-shader>Shaders/ALS/shadows-include.vert</vertex-shader>
@ -732,20 +768,25 @@
<value type="int">0</value> <value type="int">0</value>
</uniform> </uniform>
<uniform> <uniform>
<name>texture1</name> <name>grass</name>
<type>sampler-2d</type> <type>sampler-2d</type>
<value type="int">1</value> <value type="int">1</value>
</uniform> </uniform>
<uniform> <uniform>
<name>texture2</name> <name>city</name>
<type>sampler-2d</type> <type>sampler-2d</type>
<value type="int">2</value> <value type="int">2</value>
</uniform> </uniform>
<uniform> <uniform>
<name>texture3</name> <name>forest</name>
<type>sampler-2d</type> <type>sampler-2d</type>
<value type="int">3</value> <value type="int">3</value>
</uniform> </uniform>
<uniform>
<name>water</name>
<type>sampler-2d</type>
<value type="int">4</value>
</uniform>
<uniform> <uniform>
<name>colorMode</name> <name>colorMode</name>
<type>int</type> <type>int</type>

View file

@ -13,9 +13,10 @@ varying vec3 relPos;
uniform float fg_Fcoef; uniform float fg_Fcoef;
uniform sampler2D landclass; uniform sampler2D landclass;
uniform sampler2D texture1; uniform sampler2D grass;
uniform sampler2D texture2; uniform sampler2D city;
uniform sampler2D texture3; uniform sampler2D forest;
uniform sampler2D water;
varying float yprime_alt; varying float yprime_alt;
@ -34,6 +35,11 @@ uniform float overcast;
uniform float eye_alt; uniform float eye_alt;
uniform float cloud_self_shading; 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 EarthRadius = 5800000.0;
const float terminator_width = 200000.0; const float terminator_width = 200000.0;
@ -64,7 +70,6 @@ void main()
vec3 lightDir = gl_LightSource[0].position.xyz; vec3 lightDir = gl_LightSource[0].position.xyz;
vec3 halfVector = gl_LightSource[0].halfVector.xyz; vec3 halfVector = gl_LightSource[0].halfVector.xyz;
vec4 texel; vec4 texel;
vec4 lc;
vec4 fragColor; vec4 fragColor;
vec4 specular = vec4(0.0); vec4 specular = vec4(0.0);
float intensity; float intensity;
@ -96,27 +101,24 @@ void main()
// is closer to what the OpenGL fixed function pipeline does. // is closer to what the OpenGL fixed function pipeline does.
color = clamp(color, 0.0, 1.0); color = clamp(color, 0.0, 1.0);
/* int lc = int(texture2D(landclass, gl_TexCoord[0].st).r * 256.0 + 0.5);
landclass = texture2D(texture, gl_TexCoord[0].st);
texel = (landclass.r > 0.148) * texture2D(texture, gl_TexCoord[3].st) + if ((lc == 1) || (lc == 2) || (lc == 4) || (lc == 5))
(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); texel = texture2D(city, gl_TexCoord[0].st);
*/ } else if ((lc > 21) && (lc < 25))
lc = texture2D(landclass, gl_TexCoord[0].st); {
if (lc.r > 0.148) { texel = texture2D(forest, gl_TexCoord[0].st);
// Water } else if (lc > 38)
texel = texture2D(texture3, gl_TexCoord[0].st); {
} else if (lc.g > 0.02) { texel = texture2D(water, gl_TexCoord[0].st);
texel = texture2D(texture1, gl_TexCoord[0].st);
} else { } else {
texel = texture2D(texture2, gl_TexCoord[0].st); texel = texture2D(grass, gl_TexCoord[0].st);
} }
//texel = texture2D(texture, gl_TexCoord[0].st); //texel = texture2D(texture, gl_TexCoord[0].st);
fragColor = color * texel + specular; fragColor = color * texel + specular;
// here comes the terrain haze model // here comes the terrain haze model