Skip to content

Commit

Permalink
Fix Camera2D rendering due to viewport transform applied twice
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelpicosean committed Jun 17, 2021
1 parent 28cca6b commit 8319e38
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/engine/servers/visual/visual_server_canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ export class VisualServerCanvas {
continue;
}

VSG.canvas_render.canvas_render_items(z_list[i], CANVAS_ITEM_Z_MIN + i, p_canvas.modulate, p_transform);
VSG.canvas_render.canvas_render_items(z_list[i], CANVAS_ITEM_Z_MIN + i, p_canvas.modulate, Transform2D.IDENTITY);
}
} else {
for (let i = 0; i < l; i++) {
Expand Down Expand Up @@ -976,7 +976,7 @@ export class VisualServerCanvas {
for (let i = 0; i < l; i++) {
this._render_canvas_item_fast(ci[i].item, p_transform, p_clip_rect, WHITE, item_list, null, null);
}
VSG.canvas_render.canvas_render_items_array(item_list, p_canvas.modulate, p_transform);
VSG.canvas_render.canvas_render_items_array(item_list, p_canvas.modulate, Transform2D.IDENTITY);
} else {
for (let i = 0; i < l; i++) {
const ci2 = ci[i];
Expand Down Expand Up @@ -1199,13 +1199,11 @@ export class VisualServerCanvas {
}

const rect = _i_render_canvas_item_Rect2_1.copy(ci.get_rect());
const xform = Transform2D.new().copy(ci.xform);
const xform = Transform2D.new().copy(p_transform).append(ci.xform);
if (this.snap_2d_transforms) {
xform.tx = Math.floor(xform.tx);
xform.ty = Math.floor(xform.ty);
}
const xx = _i_render_canvas_item_Transform2D_2.copy(xform);
xform.copy(p_transform).append(xx);

let global_rect = xform.xform_rect(rect, rect);
global_rect.x += p_clip_rect.x;
Expand Down

0 comments on commit 8319e38

Please sign in to comment.