mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
Fix setWorldDirty and Camera update
This commit is contained in:
@@ -1976,11 +1976,8 @@ var Node = cc.Class({
|
||||
if (!this._worldMatDirty) {
|
||||
this._worldMatDirty = true;
|
||||
// Sync world mat dirty to sub tree
|
||||
if (!this._worldMatDirty) {
|
||||
this._worldMatDirty = true;
|
||||
if (this._children.length > 0) {
|
||||
_syncWorldDirty(this._children);
|
||||
}
|
||||
if (this._children.length > 0) {
|
||||
_syncWorldDirty(this._children);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -292,6 +292,7 @@ let Camera = cc.Class({
|
||||
|
||||
onEnable () {
|
||||
this._matrixDirty = true;
|
||||
cc.director.on(cc.Director.EVENT_BEFORE_DRAW, this.beforeDraw, this);
|
||||
if (game.renderType === game.RENDER_TYPE_WEBGL) {
|
||||
renderer.scene.addCamera(this._camera);
|
||||
}
|
||||
@@ -299,6 +300,7 @@ let Camera = cc.Class({
|
||||
},
|
||||
|
||||
onDisable () {
|
||||
cc.director.off(cc.Director.EVENT_BEFORE_DRAW, this.beforeDraw, this);
|
||||
if (game.renderType === game.RENDER_TYPE_WEBGL) {
|
||||
renderer.scene.removeCamera(this._camera);
|
||||
}
|
||||
@@ -430,12 +432,12 @@ let Camera = cc.Class({
|
||||
|
||||
// force update node world matrix
|
||||
this.node.getWorldMatrix(_mat4_temp_1);
|
||||
this.lateUpdate();
|
||||
this.beforeDraw();
|
||||
renderer._walker.visit(root);
|
||||
renderer._forward.renderCamera(this._camera, renderer.scene);
|
||||
},
|
||||
|
||||
lateUpdate: !CC_EDITOR && function () {
|
||||
beforeDraw: !CC_EDITOR && function () {
|
||||
let node = this.node;
|
||||
|
||||
if (!this._matrixDirty && !node._worldMatDirty)
|
||||
|
||||
Reference in New Issue
Block a user