mirror of
https://github.com/godotengine/godot
synced 2024-09-05 17:49:51 +00:00
Fixes SDF Collision Enable/Disable
- sets LightOccluderInstance field when sdf collision is updated - adds check for light occluder sdf_collision field in 2d renderers
This commit is contained in:
parent
7abe0c6014
commit
6d0dca76c0
|
@ -1922,7 +1922,7 @@ void RasterizerCanvasGLES3::render_sdf(RID p_render_target, LightOccluderInstanc
|
||||||
while (instance) {
|
while (instance) {
|
||||||
OccluderPolygon *oc = occluder_polygon_owner.get_or_null(instance->occluder);
|
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;
|
instance = instance->next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
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);
|
RendererCanvasRender::LightOccluderInstance *occluder = canvas_light_occluder_owner.get_or_null(p_occluder);
|
||||||
ERR_FAIL_NULL(occluder);
|
ERR_FAIL_NULL(occluder);
|
||||||
|
|
||||||
|
occluder->sdf_collision = p_enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererCanvasCull::canvas_light_occluder_set_transform(RID p_occluder, const Transform2D &p_xform) {
|
void RendererCanvasCull::canvas_light_occluder_set_transform(RID p_occluder, const Transform2D &p_xform) {
|
||||||
|
|
|
@ -1931,7 +1931,7 @@ void RendererCanvasRenderRD::render_sdf(RID p_render_target, LightOccluderInstan
|
||||||
while (instance) {
|
while (instance) {
|
||||||
OccluderPolygon *co = occluder_polygon_owner.get_or_null(instance->occluder);
|
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;
|
instance = instance->next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue