Set rotation of container to be negative at render time. Removed unnecessary call to multiply on TransformMatrix rotate

This commit is contained in:
Felipe Alfonso 2018-04-10 13:25:13 -03:00
parent c5cc126a6e
commit 1eaee870c7
3 changed files with 15 additions and 5 deletions

View file

@ -317,8 +317,18 @@ var TransformMatrix = new Class({
{
var radianSin = Math.sin(radian);
var radianCos = Math.cos(radian);
var matrix = this.matrix;
var a = matrix[0];
var b = matrix[1];
var c = matrix[2];
var d = matrix[3];
return this.transform(radianCos, radianSin, -radianSin, radianCos, 0, 0);
matrix[0] = a * radianCos + c * radianSin;
matrix[1] = b * radianCos + d * radianSin;
matrix[2] = a * -radianSin + c * radianCos;
matrix[3] = b * -radianSin + d * radianCos;
return this;
},
/**

View file

@ -34,14 +34,14 @@ var ContainerCanvasRenderer = function (renderer, container, interpolationPercen
if (parentMatrix === undefined)
{
transformMatrix.applyITRS(container.x, container.y, container.rotation, container.scaleX, container.scaleY);
transformMatrix.applyITRS(container.x, container.y, -container.rotation, container.scaleX, container.scaleY);
}
else
{
transformMatrix.loadIdentity();
transformMatrix.multiply(parentMatrix);
transformMatrix.translate(container.x, container.y);
transformMatrix.rotate(container.rotation);
transformMatrix.rotate(-container.rotation);
transformMatrix.scale(container.scaleX, container.scaleY);
}

View file

@ -34,14 +34,14 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent
if (parentMatrix === undefined)
{
transformMatrix.applyITRS(container.x, container.y, container.rotation, container.scaleX, container.scaleY);
transformMatrix.applyITRS(container.x, container.y, -container.rotation, container.scaleX, container.scaleY);
}
else
{
transformMatrix.loadIdentity();
transformMatrix.multiply(parentMatrix);
transformMatrix.translate(container.x, container.y);
transformMatrix.rotate(container.rotation);
transformMatrix.rotate(-container.rotation);
transformMatrix.scale(container.scaleX, container.scaleY);
}