reset hasChanged at the end of every frame

This commit is contained in:
Yun Hsiao Wu
2019-01-23 16:35:58 +08:00
parent 3650b0a3a6
commit fcdadf40b6
5 changed files with 8 additions and 15 deletions
+2 -2
View File
@@ -170,10 +170,11 @@ export class ModelComponent extends RenderableComponent {
this._updateModels();
this._updateCastShadow();
this._updateReceiveShadow();
if (this._model) { this._model.enabled = true; }
}
onDisable() {
if (this._model) { this._model.enabled = this.enabled; }
if (this._model) { this._model.enabled = false; }
}
onDestroy() {
@@ -190,7 +191,6 @@ export class ModelComponent extends RenderableComponent {
} else {
this._model = this._createModel();
}
this._model.enable = this.enabled;
this._model.createBoundingShape(this._mesh.minPosition, this._mesh.maxPosition);
+1 -1
View File
@@ -178,7 +178,7 @@ class Component extends CCObject {
visible: false
})
get enabledInHierarchy () {
return (this._objFlags & IsOnEnableCalled) > 0;
return this._enabled && this.node._activeInHierarchy;
}
/**
+3 -7
View File
@@ -918,18 +918,14 @@ class Director extends EventTarget {
CCObject._deferredDestroy();
}
// Render
this._physicsSystem.update(this._deltaTime);
this.emit(cc.Director.EVENT_BEFORE_DRAW);
//this._renderSystem.update(this._deltaTime);
this._root.frameMove(this._deltaTime);
// After draw
this._root.frameMove(this._deltaTime); // Render
this.emit(cc.Director.EVENT_AFTER_DRAW);
eventManager.frameUpdateListeners();
this._scene.resetHasChanged();
this._totalFrames++;
}
}
+1 -3
View File
@@ -349,9 +349,7 @@ export abstract class RenderPipeline {
for (const model of scene.models) {
// filter model by view visibility
if (view.visibility > 0 && model.viewID !== view.visibility ||
!model.enabled ||
!model.node.activeInHierarchy) {
if (view.visibility > 0 && model.viewID !== view.visibility || !model.enabled) {
continue;
}
+1 -2
View File
@@ -31,7 +31,7 @@ export class Model {
private _scene: RenderScene;
private _node: Node;
private _id: number;
private _isEnable: boolean = true;
private _isEnable: boolean = false;
private _viewID: number = -1;
private _cameraID: number = -1;
private _userKey: number = -1;
@@ -99,7 +99,6 @@ export class Model {
if (this._node.hasChanged) {
this._node.updateWorldTransformFull();
if (this._modelBounds) {
this._modelBounds.transform(
// @ts-ignore
this._node._mat, this._node._pos, this._node._rot, this._node._scale,