added shadow_color property to gles2
This commit is contained in:
parent
35963eb052
commit
9b0326d2f3
|
@ -1790,6 +1790,9 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
|
|||
Color color = light_ptr->color * sign * energy * Math_PI;
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_COLOR, color);
|
||||
|
||||
Color shadow_color = light_ptr->shadow_color.to_linear();
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::SHADOW_COLOR, shadow_color);
|
||||
|
||||
//specific parameters
|
||||
|
||||
switch (light_ptr->type) {
|
||||
|
|
|
@ -158,6 +158,7 @@ varying highp vec3 specular_interp;
|
|||
|
||||
// general for all lights
|
||||
uniform highp vec4 light_color;
|
||||
uniform highp vec4 shadow_color;
|
||||
uniform highp float light_specular;
|
||||
|
||||
// directional
|
||||
|
@ -912,6 +913,7 @@ uniform highp vec3 light_direction; //may be used by fog, so leave here
|
|||
//done in fragment
|
||||
// general for all lights
|
||||
uniform highp vec4 light_color;
|
||||
uniform highp vec4 shadow_color;
|
||||
uniform highp float light_specular;
|
||||
|
||||
// directional
|
||||
|
@ -1680,7 +1682,7 @@ FRAGMENT_SHADER_CODE
|
|||
|
||||
float shadow = sample_shadow(light_shadow_atlas, splane);
|
||||
|
||||
light_att *= shadow;
|
||||
light_att *= mix(shadow_color.rgb, vec3(1.0), shadow);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1757,7 +1759,7 @@ FRAGMENT_SHADER_CODE
|
|||
shadow_att = mix(shadow_att, shadow_att2, pssm_blend);
|
||||
}
|
||||
#endif
|
||||
light_att *= shadow_att;
|
||||
light_att *= mix(shadow_color.rgb, vec3(1.0), shadow_att);
|
||||
}
|
||||
|
||||
#endif //LIGHT_USE_PSSM4
|
||||
|
@ -1798,7 +1800,7 @@ FRAGMENT_SHADER_CODE
|
|||
shadow_att = mix(shadow_att, shadow_att2, pssm_blend);
|
||||
}
|
||||
#endif
|
||||
light_att *= shadow_att;
|
||||
light_att *= mix(shadow_color.rgb, vec3(1.0), shadow_att);
|
||||
}
|
||||
|
||||
#endif //LIGHT_USE_PSSM2
|
||||
|
@ -1905,7 +1907,7 @@ FRAGMENT_SHADER_CODE
|
|||
}
|
||||
#endif
|
||||
|
||||
light_att *= shadow;
|
||||
light_att *= mix(shadow_color.rgb, vec3(1.0), shadow);
|
||||
}
|
||||
}
|
||||
#endif //use vertex lighting
|
||||
|
@ -1953,7 +1955,7 @@ FRAGMENT_SHADER_CODE
|
|||
highp vec4 splane = shadow_coord;
|
||||
|
||||
float shadow = sample_shadow(light_shadow_atlas, splane);
|
||||
light_att *= shadow;
|
||||
light_att *= mix(shadow_color.rgb, vec3(1.0), shadow);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue