1
0
Fork 0

Merge commit 'refs/merge-requests/37' of git://gitorious.org/fg/fgdata into integration

This commit is contained in:
Vivian Meazza 2010-08-28 22:42:07 +01:00
commit 479f28600e
4 changed files with 91 additions and 10 deletions

View file

@ -34,6 +34,13 @@
<depth-factor type="float">0.04</depth-factor> <depth-factor type="float">0.04</depth-factor>
<canopy-height type="float">15.0</canopy-height> <canopy-height type="float">15.0</canopy-height>
<quality-level><use>/sim/rendering/quality-level</use></quality-level> <quality-level><use>/sim/rendering/quality-level</use></quality-level>
<!-- sets the season color -->
<season-red type="float">0.12</season-red>
<season-green type="float">0.86</season-green>
<season-blue type="float">0.22</season-blue>
<!-- end season color -->
</parameters> </parameters>
<generate> <generate>
<tangent type="int">6</tangent> <tangent type="int">6</tangent>
@ -173,6 +180,26 @@
<type>float</type> <type>float</type>
<value><use>quality-level</use></value> <value><use>quality-level</use></value>
</uniform> </uniform>
<uniform>
<name>red</name>
<type>float</type>
<value><use>season-red</use></value>
</uniform>
<uniform>
<name>green</name>
<type>float</type>
<value><use>season-green</use></value>
</uniform>
<uniform>
<name>blue</name>
<type>float</type>
<value><use>season-blue</use></value>
</uniform>
<uniform>
<name>alpha</name>
<type>float</type>
<value>0.0</value>
</uniform>
</pass> </pass>
</technique> </technique>
</PropertyList> </PropertyList>

View file

@ -34,6 +34,13 @@
<depth-factor type="float">0.01</depth-factor> <depth-factor type="float">0.01</depth-factor>
<canopy-height type="float">15.0</canopy-height> <canopy-height type="float">15.0</canopy-height>
<quality-level><use>/sim/rendering/quality-level</use></quality-level> <quality-level><use>/sim/rendering/quality-level</use></quality-level>
<!-- sets the season color -->
<season-red type="float">0.12</season-red>
<season-green type="float">0.86</season-green>
<season-blue type="float">0.22</season-blue>
<!-- end season color -->
</parameters> </parameters>
<generate> <generate>
<tangent type="int">6</tangent> <tangent type="int">6</tangent>
@ -173,6 +180,26 @@
<type>float</type> <type>float</type>
<value><use>quality-level</use></value> <value><use>quality-level</use></value>
</uniform> </uniform>
<uniform>
<name>red</name>
<type>float</type>
<value><use>season-red</use></value>
</uniform>
<uniform>
<name>green</name>
<type>float</type>
<value><use>season-green</use></value>
</uniform>
<uniform>
<name>blue</name>
<type>float</type>
<value><use>season-blue</use></value>
</uniform>
<uniform>
<name>alpha</name>
<type>float</type>
<value>0.0</value>
</uniform>
</pass> </pass>
</technique> </technique>
</PropertyList> </PropertyList>

View file

@ -11,7 +11,7 @@
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
</texture> </texture>
<texture n="3"> <texture n="3">
<image>Textures/Terrain/herbtundra-colors.png</image> <image>Textures/Terrain/forest-colors.png</image>
<filter>linear-mipmap-linear</filter> <filter>linear-mipmap-linear</filter>
<wrap-s>mirror</wrap-s> <wrap-s>mirror</wrap-s>
<internal-format>normalized</internal-format> <internal-format>normalized</internal-format>
@ -33,6 +33,13 @@
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level> <snow-level><use>/sim/rendering/snow-level-m</use></snow-level>
<depth-factor type="float">0.01</depth-factor> <depth-factor type="float">0.01</depth-factor>
<canopy-height type="float">15.0</canopy-height> <canopy-height type="float">15.0</canopy-height>
<!-- sets the season color -->
<season-red type="float">0.12</season-red>
<season-green type="float">0.86</season-green>
<season-blue type="float">0.22</season-blue>
<!-- end season color -->
<quality-level><use>/sim/rendering/quality-level</use></quality-level> <quality-level><use>/sim/rendering/quality-level</use></quality-level>
</parameters> </parameters>
<generate> <generate>
@ -173,6 +180,26 @@
<type>float</type> <type>float</type>
<value><use>quality-level</use></value> <value><use>quality-level</use></value>
</uniform> </uniform>
<uniform>
<name>red</name>
<type>float</type>
<value><use>season-red</use></value>
</uniform>
<uniform>
<name>green</name>
<type>float</type>
<value><use>season-green</use></value>
</uniform>
<uniform>
<name>blue</name>
<type>float</type>
<value><use>season-blue</use></value>
</uniform>
<uniform>
<name>alpha</name>
<type>float</type>
<value>0.0</value>
</uniform>
</pass> </pass>
</technique> </technique>
</PropertyList> </PropertyList>

View file

@ -15,6 +15,8 @@ uniform sampler2D SampleTex2;
uniform sampler2D NormalTex; uniform sampler2D NormalTex;
uniform float depth_factor; uniform float depth_factor;
uniform float red, green, blue, alpha;
uniform float quality_level; // From /sim/rendering/quality-level uniform float quality_level; // From /sim/rendering/quality-level
uniform float snowlevel; // From /sim/rendering/snow-level-m uniform float snowlevel; // From /sim/rendering/snow-level-m
@ -102,7 +104,7 @@ void main (void)
fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2); fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
float biasFactor = exp2(-0.00000002 * fogCoord * fogCoord * LOG2); float biasFactor = exp2(-0.00000002 * fogCoord * fogCoord * LOG2);
float n=0.02; float n=0.06;
n += nvL[0]*0.4; n += nvL[0]*0.4;
n += nvL[1]*0.6; n += nvL[1]*0.6;
n += nvL[2]*2.0; n += nvL[2]*2.0;
@ -126,9 +128,10 @@ void main (void)
//draw floor where !steep, and another blurb for smoothing transitions //draw floor where !steep, and another blurb for smoothing transitions
vec4 c3, c4, c5, c3a, c4a, c5a; vec4 c3, c4, c5, c3a, c4a, c5a;
c3 = mix(vec4(n-0.88, n-0.14, -n, 0.0), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.3)); float subred = 1.0 - red; float subgreen = 1.0 - green; float subblue = 1.0 - blue;
c4 = mix(vec4(n-0.88, n-0.74, -n, 0.0), c1, smoothstep(0.990, 0.890, abs(normalize(Normal).z)+nvL[2]*0.9)); c3 = mix(vec4(n-subred, n-subgreen, -n-subblue, 0.0), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.3));
c4a = mix(vec4(n-0.76, n-0.66, -n, 0.3), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.32)); c4 = mix(vec4(n-subred, n-subgreen-0.6, -n-subblue, 0.0), c1, smoothstep(0.990, 0.890, abs(normalize(Normal).z)+nvL[2]*0.9));
c4a = mix(vec4(n-subred+0.12, n-subgreen-0.52, -n-subblue, 0.3), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.32));
c5 = mix(c3, c4, 1.0); c5 = mix(c3, c4, 1.0);
c5a = mix(c3, c4a, 1.0); c5a = mix(c3, c4a, 1.0);
@ -172,11 +175,8 @@ void main (void)
c1 = mix(c1, c5, clamp(0.65, n*0.5, 0.6)); c1 = mix(c1, c5, clamp(0.65, n*0.5, 0.6));
diffuse = gl_Color.rgb * max(0.8, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz)); diffuse = gl_Color.rgb * max(0.8, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
} }
//should come as varying!
vec4 constantColor = vec4(1.0, 1.0, 1.0, 0.0);
vec4 ambient_light = gl_LightSource[0].diffuse * constantColor * vec4(diffuse, 1.0); vec4 ambient_light = gl_LightSource[0].diffuse * vec4(diffuse, 0.0);
c1 *= ambient_light; c1 *= ambient_light;
vec4 finalColor = c1; vec4 finalColor = c1;
@ -184,5 +184,5 @@ void main (void)
if(gl_Fog.density == 1.0) if(gl_Fog.density == 1.0)
fogFactor=1.0; fogFactor=1.0;
gl_FragColor = mix(gl_Fog.color ,finalColor, fogFactor); gl_FragColor = mix(gl_Fog.color,finalColor, fogFactor);
} }