Lighting: fix colorramp feature
This commit is contained in:
@@ -154,8 +154,9 @@ void main(){
|
|||||||
#ifdef VERTEX_LIGHTING
|
#ifdef VERTEX_LIGHTING
|
||||||
vec2 light = vertexLightValues.xy;
|
vec2 light = vertexLightValues.xy;
|
||||||
#ifdef COLORRAMP
|
#ifdef COLORRAMP
|
||||||
light.x = texture2D(m_ColorRamp, vec2(light.x, 0.0)).r;
|
diffuseColor.rgb *= texture2D(m_ColorRamp, vec2(light.x, 0.0)).rgb;
|
||||||
light.y = texture2D(m_ColorRamp, vec2(light.y, 0.0)).r;
|
specularColor.rgb *= texture2D(m_ColorRamp, vec2(light.y, 0.0)).rgb;
|
||||||
|
light.xy = vec2(1.0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gl_FragColor.rgb = AmbientSum * diffuseColor.rgb +
|
gl_FragColor.rgb = AmbientSum * diffuseColor.rgb +
|
||||||
@@ -183,8 +184,9 @@ void main(){
|
|||||||
|
|
||||||
vec2 light = computeLighting(normal, viewDir, lightDir.xyz, lightDir.w * spotFallOff, m_Shininess) ;
|
vec2 light = computeLighting(normal, viewDir, lightDir.xyz, lightDir.w * spotFallOff, m_Shininess) ;
|
||||||
#ifdef COLORRAMP
|
#ifdef COLORRAMP
|
||||||
diffuseColor.rgb *= texture2D(m_ColorRamp, vec2(light.x, 0.0)).rgb;
|
diffuseColor.rgb *= texture2D(m_ColorRamp, vec2(light.x, 0.0)).rgb;
|
||||||
specularColor.rgb *= texture2D(m_ColorRamp, vec2(light.y, 0.0)).rgb;
|
specularColor.rgb *= texture2D(m_ColorRamp, vec2(light.y, 0.0)).rgb;
|
||||||
|
light.xy = vec2(1.0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Workaround, since it is not possible to modify varying variables
|
// Workaround, since it is not possible to modify varying variables
|
||||||
|
|||||||
Reference in New Issue
Block a user