mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 20:53:39 +00:00
Optimized applyITRS for testing
This commit is contained in:
parent
8d89c421b3
commit
3206e1bf5e
1 changed files with 29 additions and 1 deletions
|
@ -204,7 +204,7 @@ var TransformMatrix = new Class({
|
|||
},
|
||||
|
||||
/* identity + translate + rotate + scale */
|
||||
applyITRS: function (x, y, rotation, scaleX, scaleY)
|
||||
applyITRSold: function (x, y, rotation, scaleX, scaleY)
|
||||
{
|
||||
var matrix = this.matrix;
|
||||
|
||||
|
@ -222,6 +222,13 @@ var TransformMatrix = new Class({
|
|||
matrix[4] = a * x + c * y + tx;
|
||||
matrix[5] = b * x + d * y + ty;
|
||||
|
||||
matrix[4] = 1 * x + 0 * y + 0;
|
||||
matrix[5] = 0 * x + 1 * y + 0;
|
||||
|
||||
matrix[4] = x;
|
||||
matrix[5] = y;
|
||||
|
||||
|
||||
// Rotate
|
||||
matrix[0] = cr * a + -sr * c;
|
||||
matrix[1] = cr * b + -sr * d;
|
||||
|
@ -234,6 +241,27 @@ var TransformMatrix = new Class({
|
|||
matrix[2] = matrix[2] * scaleY;
|
||||
matrix[3] = matrix[3] * scaleY;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/* identity + translate + rotate + scale */
|
||||
applyITRS: function (x, y, rotation, scaleX, scaleY)
|
||||
{
|
||||
var matrix = this.matrix;
|
||||
|
||||
var sr = Math.sin(rotation);
|
||||
var cr = Math.cos(rotation);
|
||||
|
||||
// Translate
|
||||
matrix[4] = x;
|
||||
matrix[5] = y;
|
||||
|
||||
// Rotate and Scale
|
||||
matrix[0] = cr * scaleX;
|
||||
matrix[1] = -sr * scaleX;
|
||||
matrix[2] = sr * scaleY;
|
||||
matrix[3] = cr * scaleY;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue