From 6f9f593713050ec2534e1e25ce75bfa6a4c04c75 Mon Sep 17 00:00:00 2001 From: positlabs Date: Fri, 7 May 2021 15:50:50 -0400 Subject: [PATCH] setting camera aspect on canvas resize --- .../custom-pipeline-module/customThreejsPipelineModule.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/threejs/custom-pipeline-module/customThreejsPipelineModule.js b/examples/threejs/custom-pipeline-module/customThreejsPipelineModule.js index ec533cb8..b37f9610 100644 --- a/examples/threejs/custom-pipeline-module/customThreejsPipelineModule.js +++ b/examples/threejs/custom-pipeline-module/customThreejsPipelineModule.js @@ -47,8 +47,10 @@ const customThreejsPipelineModule = () => { } }, onCanvasSizeChange: ({canvasWidth, canvasHeight}) => { - const {renderer} = scene3 + const {renderer, camera} = scene3 renderer.setSize(canvasWidth, canvasHeight) + camera.aspect = canvasWidth / canvasHeight + camera.updateProjectionMatrix() }, onRender: () => { const {scene, renderer, camera} = scene3