mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
reset hasChanged at the end of every frame
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ class Component extends CCObject {
|
||||
visible: false
|
||||
})
|
||||
get enabledInHierarchy () {
|
||||
return (this._objFlags & IsOnEnableCalled) > 0;
|
||||
return this._enabled && this.node._activeInHierarchy;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user