Skip to content

Commit 05ff84f

Browse files
committed
dirtyLocal test.
1 parent 69a9e59 commit 05ff84f

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

v3/src/checksum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
var CHECKSUM = {
2-
build: '186b6300-e7d5-11e6-9a5e-2ff3d2308a00'
2+
build: 'aa3d0db0-e7df-11e6-b8bf-6f3109a66e78'
33
};
44
module.exports = CHECKSUM;

v3/src/components/experimental-Transform-2.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ function Transform(gameObject, root)
6868
this.childCount = 0;
6969
this.renderCount = 0;
7070
this.dirty = false;
71+
this.dirtyLocal = true;
7172
this.root = root || this;
7273
this.gameObject = gameObject;
7374
}
@@ -159,6 +160,11 @@ Transform.prototype.updateRoot = function ()
159160
};
160161
Transform.prototype.update = function (parentTransformMatrix)
161162
{
163+
if (!this.dirtyLocal)
164+
{
165+
return;
166+
}
167+
162168
var parent = parentTransformMatrix.matrix;
163169
var world = this.worldMatrix.matrix;
164170
var rotation = this.rotation;
@@ -176,7 +182,10 @@ Transform.prototype.update = function (parentTransformMatrix)
176182
world[3] = parent[2] * local[1] + parent[3] * local[3];
177183
world[4] = parent[4] * local[0] + parent[5] * local[2] + local[4];
178184
world[5] = parent[4] * local[1] + parent[5] * local[3] + local[5];
185+
186+
this.dirtyLocal = false;
179187
};
188+
180189
Transform.prototype.updateLocal = function ()
181190
{
182191
var local = this.localMatrix.loadIdentity();

v3/src/gameobjects/GameObject.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ Object.defineProperties(GameObject.prototype, {
118118
set: function (value)
119119
{
120120
this.transform.positionX = value;
121+
this.transform.dirtyLocal = true;
121122
}
122123

123124
},
@@ -134,6 +135,7 @@ Object.defineProperties(GameObject.prototype, {
134135
set: function (value)
135136
{
136137
this.transform.positionY = value;
138+
this.transform.dirtyLocal = true;
137139
}
138140

139141
},
@@ -151,6 +153,7 @@ Object.defineProperties(GameObject.prototype, {
151153
{
152154
this.transform.scaleX = value;
153155
this.transform.scaleY = value;
156+
this.transform.dirtyLocal = true;
154157
}
155158

156159
},
@@ -167,6 +170,7 @@ Object.defineProperties(GameObject.prototype, {
167170
set: function (value)
168171
{
169172
this.transform.scaleX = value;
173+
this.transform.dirtyLocal = true;
170174
}
171175

172176
},
@@ -183,6 +187,7 @@ Object.defineProperties(GameObject.prototype, {
183187
set: function (value)
184188
{
185189
this.transform.scaleY = value;
190+
this.transform.dirtyLocal = true;
186191
}
187192

188193
},
@@ -199,6 +204,7 @@ Object.defineProperties(GameObject.prototype, {
199204
set: function (value)
200205
{
201206
this.transform.rotation = value;
207+
this.transform.dirtyLocal = true;
202208
}
203209

204210
},
@@ -216,6 +222,7 @@ Object.defineProperties(GameObject.prototype, {
216222
{
217223
// value is in degrees
218224
this.transform.rotation = WrapAngle(value * MATH_CONST.DEG_TO_RAD);
225+
this.transform.dirtyLocal = true;
219226
}
220227

221228
},

0 commit comments

Comments
 (0)