diff --git a/examples/jsm/csm/CSMShadowNode.js b/examples/jsm/csm/CSMShadowNode.js index 4129a29f1493e7..55506cb8847137 100644 --- a/examples/jsm/csm/CSMShadowNode.js +++ b/examples/jsm/csm/CSMShadowNode.js @@ -4,7 +4,8 @@ import { MathUtils, Matrix4, Box3, - Object3D + Object3D, + WebGLCoordinateSystem } from 'three'; import { CSMFrustum } from './CSMFrustum.js'; @@ -52,7 +53,7 @@ class CSMShadowNode extends Node { this.breaks = []; this._cascades = []; - this.mainFrustum = new CSMFrustum(); + this.mainFrustum = null; this.frustums = []; this.updateBeforeType = NodeUpdateType.FRAME; @@ -62,10 +63,13 @@ class CSMShadowNode extends Node { } - init( { camera } ) { + init( { camera, renderer } ) { this.camera = camera; + const data = { webGL: renderer.coordinateSystem === WebGLCoordinateSystem }; + this.mainFrustum = new CSMFrustum( data ); + const light = this.light; const parent = light.parent;