diff options
author | clayjohn <claynjohn@gmail.com> | 2022-10-12 12:45:47 -0700 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2022-10-14 08:02:28 -0700 |
commit | b6f44859d7ab5b128d71ce0d64b46b171b9357aa (patch) | |
tree | c472b1e1f9e20dc541fc55aaca5b9bc66ec77072 /drivers | |
parent | 09b1a6f85f3f1ae1c7771d215770d9667747f198 (diff) |
Implement multiple clip_children modes for CanvasItems
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gles3/rasterizer_canvas_gles3.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
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; } } |