Fix setWorldDirty and Camera update

This commit is contained in:
pandamicro
2018-04-12 12:04:12 +08:00
parent a0091761da
commit 277707d892
2 changed files with 6 additions and 7 deletions
+2 -5
View File
@@ -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);
}
}
},
+4 -2
View File
@@ -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)