Fixed "unshaded" flag not being updated if light_type and receive_shadows_state didn't change.
This commit is contained in:
parent
a14ad02d15
commit
5d691350c4
1 changed files with 6 additions and 2 deletions
|
@ -5971,6 +5971,7 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list, const Tran
|
||||||
RID prev_baked_light_texture;
|
RID prev_baked_light_texture;
|
||||||
const float *prev_morph_values = NULL;
|
const float *prev_morph_values = NULL;
|
||||||
int prev_receive_shadows_state = -1;
|
int prev_receive_shadows_state = -1;
|
||||||
|
int prev_unshaded_state = -1;
|
||||||
|
|
||||||
material_shader.set_conditional(MaterialShaderGLES2::USE_VERTEX_LIGHTING, !shadow && !p_fragment_light);
|
material_shader.set_conditional(MaterialShaderGLES2::USE_VERTEX_LIGHTING, !shadow && !p_fragment_light);
|
||||||
material_shader.set_conditional(MaterialShaderGLES2::USE_FRAGMENT_LIGHTING, !shadow && p_fragment_light);
|
material_shader.set_conditional(MaterialShaderGLES2::USE_FRAGMENT_LIGHTING, !shadow && p_fragment_light);
|
||||||
|
@ -6006,6 +6007,7 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list, const Tran
|
||||||
const BakedLightData *baked_light = e->instance->baked_light;
|
const BakedLightData *baked_light = e->instance->baked_light;
|
||||||
const float *morph_values = e->instance->morph_values.ptr();
|
const float *morph_values = e->instance->morph_values.ptr();
|
||||||
int receive_shadows_state = e->instance->receive_shadows == true ? 1 : 0;
|
int receive_shadows_state = e->instance->receive_shadows == true ? 1 : 0;
|
||||||
|
int unshaded_state = (material->flags[VS::MATERIAL_FLAG_UNSHADED] || current_debug == VS::SCENARIO_DEBUG_SHADELESS) ? 1 : 0;
|
||||||
|
|
||||||
bool rebind = false;
|
bool rebind = false;
|
||||||
bool bind_baked_light_octree = false;
|
bool bind_baked_light_octree = false;
|
||||||
|
@ -6028,15 +6030,16 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list, const Tran
|
||||||
prev_sort_flags = 0xFF;
|
prev_sort_flags = 0xFF;
|
||||||
prev_morph_values = NULL;
|
prev_morph_values = NULL;
|
||||||
prev_receive_shadows_state = -1;
|
prev_receive_shadows_state = -1;
|
||||||
|
prev_unshaded_state = -1;
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (light_type != prev_light_type || receive_shadows_state != prev_receive_shadows_state) {
|
if (light_type != prev_light_type || receive_shadows_state != prev_receive_shadows_state || unshaded_state != prev_unshaded_state) {
|
||||||
|
|
||||||
if (material->flags[VS::MATERIAL_FLAG_UNSHADED] || current_debug == VS::SCENARIO_DEBUG_SHADELESS) {
|
if (unshaded_state == 1) {
|
||||||
material_shader.set_conditional(MaterialShaderGLES2::LIGHT_TYPE_DIRECTIONAL, false);
|
material_shader.set_conditional(MaterialShaderGLES2::LIGHT_TYPE_DIRECTIONAL, false);
|
||||||
material_shader.set_conditional(MaterialShaderGLES2::LIGHT_TYPE_OMNI, false);
|
material_shader.set_conditional(MaterialShaderGLES2::LIGHT_TYPE_OMNI, false);
|
||||||
material_shader.set_conditional(MaterialShaderGLES2::LIGHT_TYPE_SPOT, false);
|
material_shader.set_conditional(MaterialShaderGLES2::LIGHT_TYPE_SPOT, false);
|
||||||
|
@ -6385,6 +6388,7 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list, const Tran
|
||||||
prev_baked_light = baked_light;
|
prev_baked_light = baked_light;
|
||||||
prev_morph_values = morph_values;
|
prev_morph_values = morph_values;
|
||||||
prev_receive_shadows_state = receive_shadows_state;
|
prev_receive_shadows_state = receive_shadows_state;
|
||||||
|
prev_unshaded_state = unshaded_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
//print_line("shaderchanges: "+itos(p_alpha_pass)+": "+itos(_rinfo.shader_change_count));
|
//print_line("shaderchanges: "+itos(p_alpha_pass)+": "+itos(_rinfo.shader_change_count));
|
||||||
|
|
Loading…
Reference in a new issue