mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-05 11:02:40 +08:00
Fix scene mat dirty not updated issue and improve logic
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user