From e8476c994d92ecc055ffa171c7b16ee523576b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gilles=20Roudi=C3=A8re?= Date: Tue, 22 Jun 2021 10:30:11 +0200 Subject: [PATCH] Keep the drawing transform when drawing meshing in CanvasItem --- servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp index fe6d3be82ed..026969c09f8 100644 --- a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp @@ -408,6 +408,7 @@ void RendererCanvasRenderRD::_render_item(RD::DrawListID p_draw_list, RID p_rend PushConstant push_constant; Transform2D base_transform = p_canvas_transform_inverse * p_item->final_transform; + Transform2D draw_transform; _update_transform_2d_to_mat2x3(base_transform, push_constant.world); Color base_color = p_item->final_modulate; @@ -731,7 +732,7 @@ void RendererCanvasRenderRD::_render_item(RD::DrawListID p_draw_list, RID p_rend mesh_instance = m->mesh_instance; texture = m->texture; modulate = m->modulate; - _update_transform_2d_to_mat2x3(base_transform * m->transform, push_constant.world); + _update_transform_2d_to_mat2x3(base_transform * draw_transform * m->transform, push_constant.world); } else if (c->type == Item::Command::TYPE_MULTIMESH) { const Item::CommandMultiMesh *mm = static_cast(c); RID multimesh = mm->multimesh; @@ -864,10 +865,10 @@ void RendererCanvasRenderRD::_render_item(RD::DrawListID p_draw_list, RID p_rend for (int j = 0; j < 6; j++) { push_constant.world[j] = world_backup[j]; } - } break; case Item::Command::TYPE_TRANSFORM: { const Item::CommandTransform *transform = static_cast(c); + draw_transform = transform->xform; _update_transform_2d_to_mat2x3(base_transform * transform->xform, push_constant.world); } break;