diff --git a/cocos/renderer/scene/camera.ts b/cocos/renderer/scene/camera.ts index 558302ded5..e78ffbe902 100644 --- a/cocos/renderer/scene/camera.ts +++ b/cocos/renderer/scene/camera.ts @@ -174,8 +174,7 @@ export class Camera { if (this._node) { // view matrix if (this._node.hasChanged) { - this.node.getWorldRT(this._matView); - mat4.invert(this._matView, this._matView); + mat4.invert(this._matView, this.node.worldMatrix); this._forward.x = -this._matView.m02; this._forward.y = -this._matView.m06; @@ -214,8 +213,7 @@ export class Camera { farClip = Math.min(farClip, this._farClip); // view matrix - this.node.getWorldRT(this._matView); - mat4.invert(this._matView, this._matView); + mat4.invert(this._matView, this.node.worldMatrix); // projection matrix if (this._proj === CameraProjection.PERSPECTIVE) { diff --git a/cocos/renderer/scene/render-scene.ts b/cocos/renderer/scene/render-scene.ts index 94e8e91e05..d4601bf62e 100644 --- a/cocos/renderer/scene/render-scene.ts +++ b/cocos/renderer/scene/render-scene.ts @@ -100,7 +100,7 @@ export class RenderScene { this._defaultMainLightNode = new Node('Main Light'); this._mainLight = new DirectionalLight(this, 'Main Light', this._defaultMainLightNode); this._mainLight.illuminance = Ambient.SUN_ILLUM; - this._mainLight.enabled = false; // disabled by default + this._mainLight.enabled = true; // enabled by default this._ambient = new Ambient(this); this._skybox = new Skybox(this); this._planarShadow = new PlanarShadow(this); diff --git a/cocos/scene-graph/node.ts b/cocos/scene-graph/node.ts index fc947fd894..eefcc3563c 100644 --- a/cocos/scene-graph/node.ts +++ b/cocos/scene-graph/node.ts @@ -745,6 +745,11 @@ class Node extends BaseNode { } } + public get worldMatrix (): Readonly { + this.updateWorldTransformFull(); + return this._mat; + } + /** * get world transform matrix (with only rotation and scale) * @param out - the receiving matrix