Skip to content

Commit

Permalink
Merge pull request #90883 from cosparks/fix-sdf-collision-2d
Browse files Browse the repository at this point in the history
Fix LightOccluder2D SDF Collision Enable/Disable
  • Loading branch information
akien-mga committed Apr 23, 2024
2 parents ba804f1 + 6d0dca7 commit 99cff79
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/gles3/rasterizer_canvas_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1922,7 +1922,7 @@ void RasterizerCanvasGLES3::render_sdf(RID p_render_target, LightOccluderInstanc
while (instance) {
OccluderPolygon *oc = occluder_polygon_owner.get_or_null(instance->occluder);

if (!oc || oc->sdf_vertex_array == 0) {
if (!oc || oc->sdf_vertex_array == 0 || !instance->sdf_collision) {
instance = instance->next;
continue;
}
Expand Down
2 changes: 2 additions & 0 deletions servers/rendering/renderer_canvas_cull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1970,6 +1970,8 @@ void RendererCanvasCull::canvas_light_occluder_set_polygon(RID p_occluder, RID p
void RendererCanvasCull::canvas_light_occluder_set_as_sdf_collision(RID p_occluder, bool p_enable) {
RendererCanvasRender::LightOccluderInstance *occluder = canvas_light_occluder_owner.get_or_null(p_occluder);
ERR_FAIL_NULL(occluder);

occluder->sdf_collision = p_enable;
}

void RendererCanvasCull::canvas_light_occluder_set_transform(RID p_occluder, const Transform2D &p_xform) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1931,7 +1931,7 @@ void RendererCanvasRenderRD::render_sdf(RID p_render_target, LightOccluderInstan
while (instance) {
OccluderPolygon *co = occluder_polygon_owner.get_or_null(instance->occluder);

if (!co || co->sdf_index_array.is_null()) {
if (!co || co->sdf_index_array.is_null() || !instance->sdf_collision) {
instance = instance->next;
continue;
}
Expand Down

0 comments on commit 99cff79

Please sign in to comment.