From b6f44859d7ab5b128d71ce0d64b46b171b9357aa Mon Sep 17 00:00:00 2001 From: clayjohn Date: Wed, 12 Oct 2022 12:45:47 -0700 Subject: Implement multiple clip_children modes for CanvasItems --- drivers/gles3/rasterizer_canvas_gles3.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'drivers/gles3') diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 1648dddea1..c2c92055fd 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -433,10 +433,12 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_ _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, starting_index, false); item_count = 0; - if (ci->canvas_group_owner->canvas_group->mode == RS::CANVAS_GROUP_MODE_OPAQUE) { + if (ci->canvas_group_owner->canvas_group->mode != RS::CANVAS_GROUP_MODE_TRANSPARENT) { Rect2i group_rect = ci->canvas_group_owner->global_rect_cache; texture_storage->render_target_copy_to_back_buffer(p_to_render_target, group_rect, false); - items[item_count++] = ci->canvas_group_owner; + if (ci->canvas_group_owner->canvas_group->mode == RS::CANVAS_GROUP_MODE_CLIP_AND_DRAW) { + items[item_count++] = ci->canvas_group_owner; + } } else if (!backbuffer_cleared) { texture_storage->render_target_clear_back_buffer(p_to_render_target, Rect2i(), Color(0, 0, 0, 0)); backbuffer_cleared = true; @@ -545,12 +547,14 @@ void RasterizerCanvasGLES3::_render_items(RID p_to_render_target, int p_item_cou RID material = ci->material_owner == nullptr ? ci->material : ci->material_owner->material; if (ci->canvas_group != nullptr) { - if (ci->canvas_group->mode == RS::CANVAS_GROUP_MODE_OPAQUE) { + if (ci->canvas_group->mode == RS::CANVAS_GROUP_MODE_CLIP_AND_DRAW) { if (!p_to_backbuffer) { material = default_clip_children_material; } } else { - if (material.is_null()) { + if (ci->canvas_group->mode == RS::CANVAS_GROUP_MODE_CLIP_ONLY) { + material = default_clip_children_material; + } else { material = default_canvas_group_material; } } -- cgit v1.2.3