|
|
@ -43,8 +43,6 @@ attribute vec3 inNormal; |
|
|
|
varying vec3 vBinormal; |
|
|
|
varying vec3 vBinormal; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#else |
|
|
|
#else |
|
|
|
varying vec3 specularAccum; |
|
|
|
|
|
|
|
varying vec4 diffuseAccum; |
|
|
|
|
|
|
|
#ifdef COLORRAMP |
|
|
|
#ifdef COLORRAMP |
|
|
|
uniform sampler2D m_ColorRamp; |
|
|
|
uniform sampler2D m_ColorRamp; |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -131,14 +129,13 @@ void main(){ |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#ifdef VERTEX_LIGHTING |
|
|
|
#ifdef VERTEX_LIGHTING |
|
|
|
int i = 0; |
|
|
|
int i = 0; |
|
|
|
diffuseAccum = vec4(0.0); |
|
|
|
vec3 diffuseAccum = vec3(0.0); |
|
|
|
specularAccum = vec3(0.0); |
|
|
|
vec3 specularAccum = vec3(0.0); |
|
|
|
vec4 diffuseColor; |
|
|
|
vec4 diffuseColor; |
|
|
|
vec3 specularColor; |
|
|
|
vec3 specularColor; |
|
|
|
for (int i =0;i < NB_LIGHTS; i+=3){ |
|
|
|
for (int i =0;i < NB_LIGHTS; i+=3){ |
|
|
|
vec4 lightColor = g_LightData[i]; |
|
|
|
vec4 lightColor = g_LightData[i]; |
|
|
|
vec4 lightData1 = g_LightData[i+1]; |
|
|
|
vec4 lightData1 = g_LightData[i+1]; |
|
|
|
DiffuseSum = vec4(1.0); |
|
|
|
|
|
|
|
#ifdef MATERIAL_COLORS |
|
|
|
#ifdef MATERIAL_COLORS |
|
|
|
diffuseColor = m_Diffuse * vec4(lightColor.rgb, 1.0); |
|
|
|
diffuseColor = m_Diffuse * vec4(lightColor.rgb, 1.0); |
|
|
|
specularColor = m_Specular.rgb * lightColor.rgb; |
|
|
|
specularColor = m_Specular.rgb * lightColor.rgb; |
|
|
@ -166,13 +163,16 @@ void main(){ |
|
|
|
vec2 light = computeLighting(wvNormal, viewDir, lightDir.xyz, lightDir.w * spotFallOff, m_Shininess); |
|
|
|
vec2 light = computeLighting(wvNormal, viewDir, lightDir.xyz, lightDir.w * spotFallOff, m_Shininess); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef COLORRAMP |
|
|
|
#ifdef COLORRAMP |
|
|
|
diffuseAccum.rgb += texture2D(m_ColorRamp, vec2(light.x, 0.0)).rgb * diffuseColor.rgb; |
|
|
|
diffuseAccum += texture2D(m_ColorRamp, vec2(light.x, 0.0)).rgb * diffuseColor.rgb; |
|
|
|
specularAccum.rgb += texture2D(m_ColorRamp, vec2(light.y, 0.0)).rgb * specularColor; |
|
|
|
specularAccum += texture2D(m_ColorRamp, vec2(light.y, 0.0)).rgb * specularColor; |
|
|
|
#else |
|
|
|
#else |
|
|
|
diffuseAccum.rgb += light.x * diffuseColor.rgb; |
|
|
|
diffuseAccum += light.x * diffuseColor.rgb; |
|
|
|
specularAccum.rgb += light.y * specularColor; |
|
|
|
specularAccum += light.y * specularColor; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DiffuseSum.rgb *= diffuseAccum.rgb; |
|
|
|
|
|
|
|
SpecularSum.rgb *= specularAccum.rgb; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|