1
0
Fork 0

Merge branch 'master' of gitorious.org:fg/fgdata

This commit is contained in:
Frederic Bouvier 2011-12-17 18:23:31 +01:00
commit 9dc155f832
3 changed files with 81 additions and 19 deletions

View file

@ -88,10 +88,14 @@
<heading-deg>
<use>/environment/Vinson/hdg-deg</use>
</heading-deg>
<rendering-hint>transparent</rendering-hint>
<shade-model>smooth</shade-model>
<rendering-hint>transparent</rendering-hint>
<transparent>true</transparent>
<render-bin>
<bin-number type="int">6</bin-number>
<bin-name>DepthSortedBin</bin-name>
</render-bin>
<!-- fog include -->
<visibility>
<use>/environment/ground-visibility-m</use>
@ -527,14 +531,14 @@
</alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<!--<render-bin>
<render-bin>
<bin-number>
<use>render-bin/bin-number</use>
</bin-number>
<bin-name>
<use>render-bin/bin-name</use>
</bin-name>
</render-bin>-->
</render-bin>
<texture-unit>
<unit>0</unit>
<type>noise</type>

View file

@ -91,8 +91,13 @@ please see Docs/README.model-combined.eff for documentation
<!-- END Reflection -->
<!-- Dirt -->
<dirt-enabled type="int">0</dirt-enabled>
<dirt-color type="vec3d">0.0 0.0 0.0</dirt-color>
<dirt-factor type="float">0.0</dirt-factor>
<dirt-multi type="int">0</dirt-multi>
<dirt-color type="vec3d" n="0">0.0 0.0 0.0</dirt-color>
<dirt-factor type="float" n="0">0.0</dirt-factor>
<dirt-color type="vec3d" n="1">0.0 0.0 0.0</dirt-color>
<dirt-factor type="float" n="1">0.0</dirt-factor>
<dirt-color type="vec3d" n="2">0.0 0.0 0.0</dirt-color>
<dirt-factor type="float" n="2">0.0</dirt-factor>
<!-- ambient correction -->
<ambient-correction type="float">0.05</ambient-correction>
<!-- quality slider -->
@ -602,20 +607,61 @@ please see Docs/README.model-combined.eff for documentation
</uniform>
<uniform>
<name>dirt_color</name>
<type>float-vec3</type>
<name>dirt_multi</name>
<type>int</type>
<value>
<use>dirt-color</use>
<use>dirt-multi</use>
</value>
</uniform>
<uniform>
<name>dirt_factor</name>
<type>float</type>
<name>dirt_r_color</name>
<type>float-vec3</type>
<value>
<use>dirt-factor</use>
<use>dirt-color[0]</use>
</value>
</uniform>
<uniform>
<name>dirt_r_factor</name>
<type>float</type>
<value>
<use>dirt-factor[0]</use>
</value>
</uniform>
<uniform>
<name>dirt_g_color</name>
<type>float-vec3</type>
<value>
<use>dirt-color[1]</use>
</value>
</uniform>
<uniform>
<name>dirt_g_factor</name>
<type>float</type>
<value>
<use>dirt-factor[1]</use>
</value>
</uniform>
<uniform>
<name>dirt_b_color</name>
<type>float-vec3</type>
<value>
<use>dirt-color[2]</use>
</value>
</uniform>
<uniform>
<name>dirt_b_factor</name>
<type>float</type>
<value>
<use>dirt-factor[2]</use>
</value>
</uniform>
<!-- set the amount of ambient light correction 0.0 - 1.0 -->
<uniform>
<name>amb_correction</name>

View file

@ -32,6 +32,7 @@ uniform int lightmap_enabled;
uniform int lightmap_multi;
uniform int shader_qual;
uniform int dirt_enabled;
uniform int dirt_multi;
uniform float lightmap_r_factor;
uniform float lightmap_g_factor;
@ -42,14 +43,18 @@ uniform float refl_fresnel;
uniform float refl_rainbow;
uniform float refl_noise;
uniform float amb_correction;
uniform float dirt_factor;
uniform float dirt_r_factor;
uniform float dirt_g_factor;
uniform float dirt_b_factor;
uniform vec3 lightmap_r_color;
uniform vec3 lightmap_g_color;
uniform vec3 lightmap_b_color;
uniform vec3 lightmap_a_color;
uniform vec3 dirt_color;
uniform vec3 dirt_r_color;
uniform vec3 dirt_g_color;
uniform vec3 dirt_b_color;
///fog include//////////////////////
uniform int fogType;
@ -151,10 +156,17 @@ void main (void)
//begin DIRT
//////////////////////////////////////////////////////////////////////
if (dirt_enabled > 0.0){
vec3 dirtColor = dirt_color * noisevec.rgb;
float dirtFactor = reflmap.r * dirt_factor;
dirtFactor = smoothstep(0.0, 1.0, dirtFactor);
fragColor.rgb = mix(fragColor.rgb, dirtColor, dirtFactor);
float dirtFactorR = reflmap.r * dirt_r_factor;
dirtFactorR = smoothstep(0.0, 1.0, dirtFactorR);
fragColor.rgb = mix(fragColor.rgb, dirt_r_color, dirtFactorR);
if (dirt_multi > 0) {
float dirtFactorG = reflmap.g * dirt_g_factor;
float dirtFactorB = reflmap.b * dirt_b_factor;
dirtFactorG = smoothstep(0.0, 1.0, dirtFactorG);
dirtFactorB = smoothstep(0.0, 1.0, dirtFactorB);
fragColor.rgb = mix(fragColor.rgb, dirt_g_color, dirtFactorG);
fragColor.rgb = mix(fragColor.rgb, dirt_b_color, dirtFactorB);
}
}
//////////////////////////////////////////////////////////////////////
//END Dirt