Fix scene mat dirty not updated issue and improve logic

This commit is contained in:
pandamicro
2018-04-24 11:21:42 +08:00
parent 7997b2c6a8
commit ef5b172506
2 changed files with 6 additions and 6 deletions
+1 -6
View File
@@ -1993,14 +1993,10 @@ var Node = cc.Class({
},
_updateWorldMatrix () {
let dirty = false;
if (this.parent) {
dirty = this.parent._updateWorldMatrix();
this.parent._updateWorldMatrix();
}
if (this._worldMatDirty) {
dirty = true;
}
if (dirty) {
this._calculWorldMatrix();
// Sync dirty to children
let children = this._children;
@@ -2008,7 +2004,6 @@ var Node = cc.Class({
children[i]._worldMatDirty = true;
}
}
return dirty;
},
setLocalDirty (flag) {
@@ -372,6 +372,11 @@ RenderComponentWalker.prototype = {
visit (scene) {
this.reset();
// Transform scene
if (scene._worldMatDirty) {
scene._updateWorldMatrix();
this._batchData.worldMatUpdated = true;
}
for (let i = 0, l = scene._children.length; i < l; i++) {
this._visitNode(scene._children[i]);
}