diff --git a/cocos/pipeline/render-pipeline.ts b/cocos/pipeline/render-pipeline.ts index 38236e63f7..89dd1e1055 100644 --- a/cocos/pipeline/render-pipeline.ts +++ b/cocos/pipeline/render-pipeline.ts @@ -290,8 +290,6 @@ export abstract class RenderPipeline { } protected updateUBOs (view: RenderView) { - const camera = view.camera as Camera; - camera.update(); // update UBOGlobal _vec4Array[0] = this._root.frameTime; @@ -312,27 +310,27 @@ export abstract class RenderPipeline { _vec4Array[3] = 1.0; this._uboGlobal.view.set(_vec4Array, UBOGlobal.SCREEN_SCALE_OFFSET); - mat4.array(_mat4Array, camera.matView); + mat4.array(_mat4Array, view.camera.matView); this._uboGlobal.view.set(_mat4Array, UBOGlobal.MAT_VIEW_OFFSET); - mat4.invert(_outMat, camera.matView); + mat4.invert(_outMat, view.camera.matView); mat4.array(_mat4Array, _outMat); this._uboGlobal.view.set(_mat4Array, UBOGlobal.MAT_VIEW_INV_OFFSET); - mat4.array(_mat4Array, camera.matProj); + mat4.array(_mat4Array, view.camera.matProj); this._uboGlobal.view.set(_mat4Array, UBOGlobal.MAT_PROJ_OFFSET); - mat4.invert(_outMat, camera.matProj); + mat4.invert(_outMat, view.camera.matProj); mat4.array(_mat4Array, _outMat); this._uboGlobal.view.set(_mat4Array, UBOGlobal.MAT_PROJ_INV_OFFSET); - mat4.array(_mat4Array, camera.matViewProj); + mat4.array(_mat4Array, view.camera.matViewProj); this._uboGlobal.view.set(_mat4Array, UBOGlobal.MAT_VIEW_PROJ_OFFSET); - mat4.array(_mat4Array, camera.matViewProjInv); + mat4.array(_mat4Array, view.camera.matViewProjInv); this._uboGlobal.view.set(_mat4Array, UBOGlobal.MAT_VIEW_PROJ_INV_OFFSET); - vec3.array(_vec4Array, camera.node && camera.node.getPosition()); + vec3.array(_vec4Array, view.camera.node && view.camera.node.getPosition()); _vec4Array[3] = 1.0; this._uboGlobal.view.set(_vec4Array, UBOGlobal.CAMERA_POS_OFFSET); @@ -352,7 +350,7 @@ export abstract class RenderPipeline { // filter model by view visibility if (view.visibility > 0 && model.viewID !== view.visibility || !model.isEnable() || - !model.node.active) { + !model.node.activeInHierarchy) { continue; } diff --git a/cocos/renderer/scene/camera.ts b/cocos/renderer/scene/camera.ts index b1b725491a..b156a383ba 100644 --- a/cocos/renderer/scene/camera.ts +++ b/cocos/renderer/scene/camera.ts @@ -99,7 +99,10 @@ export class Camera { } public update () { - if (!this._node) { return; } + if (!this._node) { + return; + } + // view matrix this.node.getWorldRT(this._matView); mat4.invert(this._matView, this._matView); diff --git a/cocos/scene-graph/base-node.ts b/cocos/scene-graph/base-node.ts index f3e4d2e613..f6d5fa4aca 100644 --- a/cocos/scene-graph/base-node.ts +++ b/cocos/scene-graph/base-node.ts @@ -184,15 +184,14 @@ export class BaseNode extends CCObject { get active () { return this._active; } - set active (value) { - value = !!value; - if (this._active !== value) { - this._active = value; + set active (isActive: boolean) { + if (this._active !== isActive) { + this._active = isActive; const parent = this._parent; if (parent) { const couldActiveInScene = parent._activeInHierarchy; if (couldActiveInScene) { - cc.director._nodeActivator.activateNode(this, value); + cc.director._nodeActivator.activateNode(this, isActive); } } }