SPLighting: fix syntax errors with vertex lighting + color ramp

experimental
Kirill Vainer 10 years ago
parent 5cf6b0c9a6
commit 0c846eaf6a
  1. 13
      jme3-core/src/main/resources/Common/MatDefs/Light/SPLighting.vert

@ -45,6 +45,9 @@ attribute vec3 inNormal;
#else
varying vec3 specularAccum;
varying vec4 diffuseAccum;
#ifdef COLORRAMP
uniform sampler2D m_ColorRamp;
#endif
#endif
#ifdef USE_REFLECTION
@ -160,14 +163,14 @@ void main(){
#if __VERSION__ >= 110
}
#endif
vec2 v = computeLighting(wvNormal, viewDir, lightDir.xyz, lightDir.w * spotFallOff, m_Shininess);
vec2 light = computeLighting(wvNormal, viewDir, lightDir.xyz, lightDir.w * spotFallOff, m_Shininess);
#ifdef COLORRAMP
diffuseAccum += texture2D(m_ColorRamp, vec2(light.x, 0.0)).rgb * diffuseColor;
specularAccum += texture2D(m_ColorRamp, vec2(light.y, 0.0)).rgb * specularColor;
diffuseAccum.rgb += texture2D(m_ColorRamp, vec2(light.x, 0.0)).rgb * diffuseColor.rgb;
specularAccum.rgb += texture2D(m_ColorRamp, vec2(light.y, 0.0)).rgb * specularColor;
#else
diffuseAccum += v.x * diffuseColor;
specularAccum += v.y * specularColor;
diffuseAccum.rgb += light.x * diffuseColor.rgb;
specularAccum.rgb += light.y * specularColor;
#endif
}
#endif

Loading…
Cancel
Save