fix light related crashes
This commit is contained in:
parent
40f0649e5b
commit
f1d0c391c7
|
@ -1169,7 +1169,7 @@ void RasterizerSceneGLES2::_add_geometry_with_material(RasterizerStorageGLES2::G
|
||||||
|
|
||||||
LightInstance *li = light_instance_owner.getornull(e->instance->light_instances[i]);
|
LightInstance *li = light_instance_owner.getornull(e->instance->light_instances[i]);
|
||||||
|
|
||||||
if (li->light_index >= render_light_instance_count || render_light_instances[li->light_index] != li) {
|
if (!li || li->light_index >= render_light_instance_count || render_light_instances[li->light_index] != li) {
|
||||||
continue; // too many or light_index did not correspond to the light instances to be rendered
|
continue; // too many or light_index did not correspond to the light instances to be rendered
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1887,8 +1887,8 @@ void RasterizerSceneGLES3::_setup_light(RenderList::Element *e, const Transform
|
||||||
const RID *lights = e->instance->light_instances.ptr();
|
const RID *lights = e->instance->light_instances.ptr();
|
||||||
|
|
||||||
for (int i = 0; i < lc; i++) {
|
for (int i = 0; i < lc; i++) {
|
||||||
LightInstance *li = light_instance_owner.getptr(lights[i]);
|
LightInstance *li = light_instance_owner.getornull(lights[i]);
|
||||||
if (li->last_pass != render_pass) //not visible
|
if (!li || li->last_pass != render_pass) //not visible
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (li && li->light_ptr->type == VS::LIGHT_OMNI) {
|
if (li && li->light_ptr->type == VS::LIGHT_OMNI) {
|
||||||
|
|
Loading…
Reference in New Issue