Lightmap: ATI fix by AndersG
This commit is contained in:
parent
8db0ca44ef
commit
4fd8621209
2 changed files with 8 additions and 1 deletions
|
@ -1,6 +1,10 @@
|
||||||
// -*-C++-*-
|
// -*-C++-*-
|
||||||
|
|
||||||
// Ambient term comes in gl_Color.rgb.
|
// Ambient term comes in gl_Color.rgb.
|
||||||
|
//
|
||||||
|
// See http://wiki.flightgear.org/index.php/Howto:_Lightmap for details on
|
||||||
|
// how to use it.
|
||||||
|
|
||||||
varying vec4 diffuse_term;
|
varying vec4 diffuse_term;
|
||||||
varying vec3 normal;
|
varying vec3 normal;
|
||||||
varying float fogCoord;
|
varying float fogCoord;
|
||||||
|
@ -46,7 +50,7 @@ void main()
|
||||||
texel = texture2D(texture, gl_TexCoord[0].st);
|
texel = texture2D(texture, gl_TexCoord[0].st);
|
||||||
fragColor = color * texel + specular;
|
fragColor = color * texel + specular;
|
||||||
vec3 lightmapTexel = texture2D(lightmap_texture, gl_TexCoord[0].st).rgb;
|
vec3 lightmapTexel = texture2D(lightmap_texture, gl_TexCoord[0].st).rgb;
|
||||||
fragColor.rgb = max(fragColor.rgb, lightmapTexel*gl_FrontMaterial.diffuse*texel);
|
fragColor.rgb = max(fragColor.rgb, lightmapTexel * gl_FrontMaterial.diffuse.rgb * texel.rgb);
|
||||||
fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
|
fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord);
|
||||||
gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor);
|
gl_FragColor = mix(gl_Fog.color, fragColor, fogFactor);
|
||||||
}
|
}
|
|
@ -7,6 +7,9 @@
|
||||||
//
|
//
|
||||||
// Diffuse colors come from the gl_Color, ambient from the material. This is
|
// Diffuse colors come from the gl_Color, ambient from the material. This is
|
||||||
// equivalent to osg::Material::DIFFUSE.
|
// equivalent to osg::Material::DIFFUSE.
|
||||||
|
//
|
||||||
|
// See http://wiki.flightgear.org/index.php/Howto:_Lightmap for details on
|
||||||
|
// how to use it.
|
||||||
|
|
||||||
#define MODE_OFF 0
|
#define MODE_OFF 0
|
||||||
#define MODE_DIFFUSE 1
|
#define MODE_DIFFUSE 1
|
||||||
|
|
Loading…
Add table
Reference in a new issue