* Do not use control flow in GLSL version 1.0 in Lighting.frag
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8170 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
f6322b28ec
commit
dd7495185c
@ -174,16 +174,21 @@ void main(){
|
||||
|
||||
#ifndef VERTEX_LIGHTING
|
||||
float spotFallOff = 1.0;
|
||||
|
||||
#if __VERSION__ >= 110
|
||||
// allow use of control flow
|
||||
if(g_LightDirection.w != 0.0){
|
||||
#endif
|
||||
|
||||
vec3 L = normalize(lightVec.xyz);
|
||||
vec3 spotdir = normalize(g_LightDirection.xyz);
|
||||
float curAngleCos = dot(-L, spotdir);
|
||||
float innerAngleCos = floor(g_LightDirection.w) * 0.001;
|
||||
float outerAngleCos = fract(g_LightDirection.w);
|
||||
float innerMinusOuter = innerAngleCos - outerAngleCos;
|
||||
|
||||
spotFallOff = (curAngleCos - outerAngleCos) / innerMinusOuter;
|
||||
|
||||
#if __VERSION__ >= 110
|
||||
if(spotFallOff <= 0.0){
|
||||
gl_FragColor.rgb = AmbientSum * diffuseColor.rgb;
|
||||
gl_FragColor.a = alpha;
|
||||
@ -192,6 +197,9 @@ void main(){
|
||||
spotFallOff = clamp(spotFallOff, 0.0, 1.0);
|
||||
}
|
||||
}
|
||||
#else
|
||||
spotFallOff = clamp(spotFallOff, step(g_LightDirection.w, 0.001), 1.0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// ***********************
|
||||
|
Loading…
x
Reference in New Issue
Block a user