mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 05:33:35 +00:00
Set rotation of container to be negative at render time. Removed unnecessary call to multiply on TransformMatrix rotate
This commit is contained in:
parent
c5cc126a6e
commit
1eaee870c7
3 changed files with 15 additions and 5 deletions
|
@ -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;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue