mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 21:24:09 +00:00
dirtyLocal test.
This commit is contained in:
parent
69a9e59f8f
commit
05ff84f282
3 changed files with 17 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
var CHECKSUM = {
|
var CHECKSUM = {
|
||||||
build: '186b6300-e7d5-11e6-9a5e-2ff3d2308a00'
|
build: 'aa3d0db0-e7df-11e6-b8bf-6f3109a66e78'
|
||||||
};
|
};
|
||||||
module.exports = CHECKSUM;
|
module.exports = CHECKSUM;
|
|
@ -68,6 +68,7 @@ function Transform(gameObject, root)
|
||||||
this.childCount = 0;
|
this.childCount = 0;
|
||||||
this.renderCount = 0;
|
this.renderCount = 0;
|
||||||
this.dirty = false;
|
this.dirty = false;
|
||||||
|
this.dirtyLocal = true;
|
||||||
this.root = root || this;
|
this.root = root || this;
|
||||||
this.gameObject = gameObject;
|
this.gameObject = gameObject;
|
||||||
}
|
}
|
||||||
|
@ -159,6 +160,11 @@ Transform.prototype.updateRoot = function ()
|
||||||
};
|
};
|
||||||
Transform.prototype.update = function (parentTransformMatrix)
|
Transform.prototype.update = function (parentTransformMatrix)
|
||||||
{
|
{
|
||||||
|
if (!this.dirtyLocal)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var parent = parentTransformMatrix.matrix;
|
var parent = parentTransformMatrix.matrix;
|
||||||
var world = this.worldMatrix.matrix;
|
var world = this.worldMatrix.matrix;
|
||||||
var rotation = this.rotation;
|
var rotation = this.rotation;
|
||||||
|
@ -176,7 +182,10 @@ Transform.prototype.update = function (parentTransformMatrix)
|
||||||
world[3] = parent[2] * local[1] + parent[3] * local[3];
|
world[3] = parent[2] * local[1] + parent[3] * local[3];
|
||||||
world[4] = parent[4] * local[0] + parent[5] * local[2] + local[4];
|
world[4] = parent[4] * local[0] + parent[5] * local[2] + local[4];
|
||||||
world[5] = parent[4] * local[1] + parent[5] * local[3] + local[5];
|
world[5] = parent[4] * local[1] + parent[5] * local[3] + local[5];
|
||||||
|
|
||||||
|
this.dirtyLocal = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
Transform.prototype.updateLocal = function ()
|
Transform.prototype.updateLocal = function ()
|
||||||
{
|
{
|
||||||
var local = this.localMatrix.loadIdentity();
|
var local = this.localMatrix.loadIdentity();
|
||||||
|
|
|
@ -118,6 +118,7 @@ Object.defineProperties(GameObject.prototype, {
|
||||||
set: function (value)
|
set: function (value)
|
||||||
{
|
{
|
||||||
this.transform.positionX = value;
|
this.transform.positionX = value;
|
||||||
|
this.transform.dirtyLocal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -134,6 +135,7 @@ Object.defineProperties(GameObject.prototype, {
|
||||||
set: function (value)
|
set: function (value)
|
||||||
{
|
{
|
||||||
this.transform.positionY = value;
|
this.transform.positionY = value;
|
||||||
|
this.transform.dirtyLocal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -151,6 +153,7 @@ Object.defineProperties(GameObject.prototype, {
|
||||||
{
|
{
|
||||||
this.transform.scaleX = value;
|
this.transform.scaleX = value;
|
||||||
this.transform.scaleY = value;
|
this.transform.scaleY = value;
|
||||||
|
this.transform.dirtyLocal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -167,6 +170,7 @@ Object.defineProperties(GameObject.prototype, {
|
||||||
set: function (value)
|
set: function (value)
|
||||||
{
|
{
|
||||||
this.transform.scaleX = value;
|
this.transform.scaleX = value;
|
||||||
|
this.transform.dirtyLocal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -183,6 +187,7 @@ Object.defineProperties(GameObject.prototype, {
|
||||||
set: function (value)
|
set: function (value)
|
||||||
{
|
{
|
||||||
this.transform.scaleY = value;
|
this.transform.scaleY = value;
|
||||||
|
this.transform.dirtyLocal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -199,6 +204,7 @@ Object.defineProperties(GameObject.prototype, {
|
||||||
set: function (value)
|
set: function (value)
|
||||||
{
|
{
|
||||||
this.transform.rotation = value;
|
this.transform.rotation = value;
|
||||||
|
this.transform.dirtyLocal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -216,6 +222,7 @@ Object.defineProperties(GameObject.prototype, {
|
||||||
{
|
{
|
||||||
// value is in degrees
|
// value is in degrees
|
||||||
this.transform.rotation = WrapAngle(value * MATH_CONST.DEG_TO_RAD);
|
this.transform.rotation = WrapAngle(value * MATH_CONST.DEG_TO_RAD);
|
||||||
|
this.transform.dirtyLocal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue