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>
</texture>
<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>
<type>2d</type>
<filter>linear-mipmap-linear</filter>
@ -492,9 +505,8 @@
<image>
<use>texture[0]/image</use>
</image>
<filter>
<use>texture[0]/filter</use>
</filter>
<filter>nearest-mipmap-nearest</filter>
<mag-filter>nearest-mipmap-nearest</mag-filter>
<wrap-s>
<use>texture[0]/wrap-s</use>
</wrap-s>
@ -504,6 +516,11 @@
<internal-format>
<use>texture[0]/internal-format</use>
</internal-format>
<mipmap-control>
<r>max</r>
<g>max</g>
<b>max</b>
</mipmap-control>
</texture-unit>
<texture-unit>
@ -562,6 +579,25 @@
</internal-format>
</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>
<vertex-shader>Shaders/ALS/generic-base.vert</vertex-shader>
<vertex-shader>Shaders/ALS/shadows-include.vert</vertex-shader>
@ -732,20 +768,25 @@
<value type="int">0</value>
</uniform>
<uniform>
<name>texture1</name>
<name>grass</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>texture2</name>
<name>city</name>
<type>sampler-2d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>texture3</name>
<name>forest</name>
<type>sampler-2d</type>
<value type="int">3</value>
</uniform>
<uniform>
<name>water</name>
<type>sampler-2d</type>
<value type="int">4</value>
</uniform>
<uniform>
<name>colorMode</name>
<type>int</type>

View file

@ -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