Skip to content

Commit

Permalink
[unity] Fixes in render target matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyfa committed Nov 21, 2020
1 parent a11023c commit d4e5813
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions plugins/unity/runtime/src/backend/Draw.hx
Expand Up @@ -339,19 +339,21 @@ class Draw #if !completion implements spec.Draw #end {
var translateX = ((backendItem.width * camWidth / renderTarget.width) - backendItem.width) * 0.5;
var translateY = ((backendItem.height * camHeight / renderTarget.height) - backendItem.height) * 0.5;

var density = renderTarget.density;

_renderTargetTransform.identity();
_renderTargetTransform.scale(
renderTarget.density * camWidth / renderTarget.width,
renderTarget.density * camHeight / renderTarget.height
density * camWidth / renderTarget.width,
density * camHeight / renderTarget.height
);
_renderTargetTransform.translate(-translateX, -translateY);

updateViewMatrix(
renderTarget.density,
density,
renderTarget.width,
renderTarget.height,
_renderTargetTransform,
-1, -1
1, 1
);

updateCurrentMatrix();
Expand Down

0 comments on commit d4e5813

Please sign in to comment.