diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-06-24 19:38:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-24 19:38:56 +0200 |
commit | a01ea509f5b2417cad1712f74642462fe85f5170 (patch) | |
tree | c27847eac8d2ba5b922f9ab50d6064f7a7b8b23f | |
parent | d8f284532a2a358d35e61c7664d99db92180cb7b (diff) | |
parent | e8476c994d92ecc055ffa171c7b16ee523576b94 (diff) |
Merge pull request #49826 from groud/fix_mesh_transform
Keep the drawing transform when drawing meshing in CanvasItem
-rw-r--r-- | servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp | 5 |
1 files 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 fe6d3be82e..026969c09f 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<const Item::CommandMultiMesh *>(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<const Item::CommandTransform *>(c); + draw_transform = transform->xform; _update_transform_2d_to_mat2x3(base_transform * transform->xform, push_constant.world); } break; |