浏览代码

Merge pull request #71772 from clayjohn/GLES3-li

Assign light indices after sorting in OpenGL renderer
Rémi Verschelde 2 年之前
父节点
当前提交
4db3716d8d
共有 1 个文件被更改,包括 2 次插入4 次删除
  1. 2 4
      drivers/gles3/rasterizer_scene_gles3.cpp

+ 2 - 4
drivers/gles3/rasterizer_scene_gles3.cpp

@@ -1535,8 +1535,6 @@ void RasterizerSceneGLES3::_setup_lights(const RenderDataGLES3 *p_render_data, b
 					}
 					}
 				}
 				}
 
 
-				li->gl_id = r_omni_light_count;
-
 				scene_state.omni_light_sort[r_omni_light_count].instance = li;
 				scene_state.omni_light_sort[r_omni_light_count].instance = li;
 				scene_state.omni_light_sort[r_omni_light_count].depth = distance;
 				scene_state.omni_light_sort[r_omni_light_count].depth = distance;
 				r_omni_light_count++;
 				r_omni_light_count++;
@@ -1560,8 +1558,6 @@ void RasterizerSceneGLES3::_setup_lights(const RenderDataGLES3 *p_render_data, b
 					}
 					}
 				}
 				}
 
 
-				li->gl_id = r_spot_light_count;
-
 				scene_state.spot_light_sort[r_spot_light_count].instance = li;
 				scene_state.spot_light_sort[r_spot_light_count].instance = li;
 				scene_state.spot_light_sort[r_spot_light_count].depth = distance;
 				scene_state.spot_light_sort[r_spot_light_count].depth = distance;
 				r_spot_light_count++;
 				r_spot_light_count++;
@@ -1587,6 +1583,8 @@ void RasterizerSceneGLES3::_setup_lights(const RenderDataGLES3 *p_render_data, b
 		real_t distance = (i < r_omni_light_count) ? scene_state.omni_light_sort[index].depth : scene_state.spot_light_sort[index].depth;
 		real_t distance = (i < r_omni_light_count) ? scene_state.omni_light_sort[index].depth : scene_state.spot_light_sort[index].depth;
 		RID base = li->light;
 		RID base = li->light;
 
 
+		li->gl_id = index;
+
 		Transform3D light_transform = li->transform;
 		Transform3D light_transform = li->transform;
 		Vector3 pos = inverse_transform.xform(light_transform.origin);
 		Vector3 pos = inverse_transform.xform(light_transform.origin);