Rename misleading define
The macro USE_LIGHT_SHADOW_COLOR actually was being defined when the shader used SHADOW (the output shadow color), not the shadow color set for the light so it's better named USE_OUTPUT_SHADOW_COLOR. In 3D there's not that difference but renaming as well for consistency.
(cherry picked from commit b69e422af9
)
This commit is contained in:
parent
e0ddef3164
commit
ffe5ecd67d
3 changed files with 6 additions and 6 deletions
|
@ -4666,7 +4666,7 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const {
|
|||
enablers.push_back("#define USE_LIGHT_SHADER_CODE\n");
|
||||
}
|
||||
if (light_flags.uses_shadow_color) {
|
||||
enablers.push_back("#define USE_LIGHT_SHADOW_COLOR\n");
|
||||
enablers.push_back("#define USE_OUTPUT_SHADOW_COLOR\n");
|
||||
}
|
||||
if (light_flags.uses_time || fragment_flags.uses_time || vertex_flags.uses_time) {
|
||||
enablers.push_back("#define USE_TIME\n");
|
||||
|
@ -4709,7 +4709,7 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const {
|
|||
enablers.push_back("#define USE_TEXPIXEL_SIZE\n");
|
||||
}
|
||||
if (light_flags.uses_shadow_color) {
|
||||
enablers.push_back("#define USE_LIGHT_SHADOW_COLOR\n");
|
||||
enablers.push_back("#define USE_OUTPUT_SHADOW_COLOR\n");
|
||||
}
|
||||
|
||||
if (vertex_flags.uses_worldvec) {
|
||||
|
|
|
@ -244,7 +244,7 @@ FRAGMENT_SHADER_CODE
|
|||
|
||||
vec2 light_uv = light_uv_interp.xy;
|
||||
vec4 light = texture2D(light_texture,light_uv) * light_color;
|
||||
#if defined(USE_LIGHT_SHADOW_COLOR)
|
||||
#if defined(USE_OUTPUT_SHADOW_COLOR)
|
||||
vec4 shadow_color=vec4(0.0,0.0,0.0,0.0);
|
||||
#endif
|
||||
|
||||
|
@ -380,7 +380,7 @@ LIGHT_SHADER_CODE
|
|||
|
||||
#endif
|
||||
|
||||
#if defined(USE_LIGHT_SHADOW_COLOR)
|
||||
#if defined(USE_OUTPUT_SHADOW_COLOR)
|
||||
color=mix(shadow_color,color,shadow_attenuation);
|
||||
#else
|
||||
//color*=shadow_attenuation;
|
||||
|
|
|
@ -1181,7 +1181,7 @@ FRAGMENT_SHADER_CODE
|
|||
vec3 mdiffuse = diffuse.rgb;
|
||||
vec3 light;
|
||||
|
||||
#if defined(USE_LIGHT_SHADOW_COLOR)
|
||||
#if defined(USE_OUTPUT_SHADOW_COLOR)
|
||||
vec3 shadow_color=vec3(0.0,0.0,0.0);
|
||||
#endif
|
||||
|
||||
|
@ -1205,7 +1205,7 @@ LIGHT_SHADER_CODE
|
|||
#endif
|
||||
diffuse.rgb = const_light_mult * ambient_light *diffuse.rgb + light * attenuation * shadow_attenuation;
|
||||
|
||||
#if defined(USE_LIGHT_SHADOW_COLOR)
|
||||
#if defined(USE_OUTPUT_SHADOW_COLOR)
|
||||
diffuse.rgb += light * shadow_color * attenuation * (1.0 - shadow_attenuation);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue