1
0
Fork 0

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

This commit is contained in:
syd 2011-12-13 08:50:54 -07:00
commit 6348c04359
3 changed files with 14 additions and 13 deletions

View file

@ -1,7 +1,7 @@
// -*-C++-*-
// Texture switching based on face slope and snow level
// based on earlier work by Frederic Bouvier, Tim Moore, and Yves Sablonier.
// Š Emilian Huminiuc 2011
// <EFBFBD> Emilian Huminiuc 2011
// Ambient term comes in gl_Color.rgb.
varying vec4 diffuse_term, RawPos;
@ -35,7 +35,7 @@ void main()
Noise = texture3D(NoiseTex, RawPos.xyz*0.0011);
MixFactor = Noise.r * Noise.g * Noise.b; //Mixing Factor to create a more organic looking boundary
MixFactor *= 300;
MixFactor *= 300.0;
MixFactor = clamp(MixFactor, 0.0, 1.0);
L1 = 0.90 - 0.02 * MixFactor; //first transition slope
L2 = 0.78 + 0.04 * MixFactor; //Second transition slope
@ -69,7 +69,7 @@ void main()
vec4 baseTexel = texture2D(BaseTex, gl_TexCoord[0].st);
vec4 secondTexel = texture2D(SecondTex, gl_TexCoord[0].st);
vec4 thirdTexel = texture2D(ThirdTex, gl_TexCoord[0].st);
vec4 snowTexel = texture2D(SnowTex, gl_TexCoord[0].st * 2);
vec4 snowTexel = texture2D(SnowTex, gl_TexCoord[0].st);
//Normal transition. For more abrupt faces apply another texture (or 2).
if (InverseSlope == 0.0) {
//Do we do an intermediate transition
@ -123,10 +123,10 @@ void main()
texel.rgb = texel.rgb * wetness;
float altitude = RawPos.z;
//Snow texture for areas higher than SnowLevel
if (RawPos.z >= SnowLevel - (1000.0 * slope + 300 * MixFactor) && slope > L2 - 0.12) {
texel = mix(texel, mix(texel, snowTexel, smoothstep(L2 - 0.09 * MixFactor, L2, slope)), smoothstep(SnowLevel - (1000.0 * slope + 300 * MixFactor), SnowLevel - (1000 * slope - 150 * MixFactor), RawPos.z));
if (altitude >= SnowLevel - (1000.0 * slope + 300.0 * MixFactor) && slope > L2 - 0.12) {
texel = mix(texel, mix(texel, snowTexel, smoothstep(L2 - 0.09 * MixFactor, L2, slope)), smoothstep(SnowLevel - (1000.0 * slope + 300.0 * MixFactor), SnowLevel - (1000.0 * slope - 150.0 * MixFactor), altitude));
}
fragColor = color * texel + specular;
@ -139,6 +139,7 @@ void main()
}
//fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
fragColor.rgb *= 1.2 - 0.4 * MixFactor;
fragColor.rgb = fog_Func(fragColor.rgb, fogType);
//gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor);
gl_FragColor = fragColor;

View file

@ -69,7 +69,7 @@ void main (void)
float pf;
///BEGIN bump
if (nmap_enabled > 0 && shader_qual > 1){
if (nmap_enabled > 0 && shader_qual > 2){
N = nmap.rgb * 2.0 - 1.0;
N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal);
if (nmap_dds > 0)
@ -107,7 +107,7 @@ void main (void)
////////////////////////////////////////////////////////////////////
//BEGIN reflect
////////////////////////////////////////////////////////////////////
if (refl_enabled > 0 && shader_qual > 0){
if (refl_enabled > 0 && shader_qual > 1){
float reflFactor;
float transparency_offset = clamp(refl_correction, -1.0, 1.0);// set the user shininess offset
@ -115,7 +115,7 @@ void main (void)
// map the shininess of the object with user input
//float pam = (map.a * -2) + 1; //reverse map
reflFactor = reflmap.a + transparency_offset;
} else if (nmap_enabled > 0 && shader_qual > 1) {
} else if (nmap_enabled > 0 && shader_qual > 2) {
// set the reflectivity proportional to shininess with user input
reflFactor = (gl_FrontMaterial.shininess / 128.0) * nmap.a + transparency_offset;
} else {

View file

@ -50,7 +50,7 @@ void main(void)
fog_Func(fogType);
VNormal = normalize(gl_NormalMatrix * gl_Normal);
if (nmap_enabled > 0 && shader_qual > 1){
if (nmap_enabled > 0 && shader_qual > 2){
VTangent = normalize(gl_NormalMatrix * tangent);
VBinormal = normalize(gl_NormalMatrix * binormal);
} else {