1
0
Fork 0

Standardize fog

Signed-off-by: Vivian Meazza <vivian.meazza@lineone.net>
This commit is contained in:
Vivian Meazza 2011-12-01 21:05:05 +00:00
parent 47ec25ba08
commit a37de2ec49
2 changed files with 133 additions and 115 deletions

View file

@ -18,6 +18,12 @@ uniform float snowlevel; // From /sim/rendering/snow-level-m
const float scale = 1.0;
int linear_search_steps = 10;
////fog "include" /////
uniform int fogType;
vec3 fog_Func(vec3 color, int type);
//////////////////////
float ray_intersect(sampler2D reliefMap, vec2 dp, vec2 ds)
{
@ -63,7 +69,7 @@ void main (void)
vec2 uv, dp = vec2(0, 0), ds = vec2(0, 0);
vec3 N;
float d = 0;
if ( bump > 0.9 && quality_level >= 2.0 && quality_level < 3.5)
if ( bump > 0.9 && quality_level > 2.0 && quality_level <= 4.0)
{
vec3 V = normalize(ecPosition.xyz);
float a = dot(VNormal, -V);
@ -136,8 +142,11 @@ void main (void)
c1 *= ambient_light;
vec4 finalColor = c1;
if(gl_Fog.density == 1.0)
fogFactor=1.0;
//if(gl_Fog.density == 1.0)
// fogFactor=1.0;
// gl_FragColor = mix(gl_Fog.color ,finalColor, fogFactor);
finalColor.rgb = fog_Func(finalColor.rgb, fogType);
gl_FragColor = finalColor;
gl_FragColor = mix(gl_Fog.color ,finalColor, fogFactor);
}

View file

@ -9,6 +9,13 @@ varying vec4 constantColor;
attribute vec3 tangent;
attribute vec3 binormal;
////fog "include" /////
uniform int fogType;
void fog_Func(int type);
//////////////////////
void main(void)
{
rawpos = gl_Vertex;
@ -23,4 +30,6 @@ void main(void)
+ gl_FrontColor * (gl_LightModel.ambient + gl_LightSource[0].ambient);
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
fog_Func(fogType);
}