Skip to content

Commit 63b1811

Browse files
authored
CSM: Reuse origin vector. (#32331)
1 parent de23dac commit 63b1811

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/jsm/csm/CSM.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { CSMShader } from './CSMShader.js';
1313
const _cameraToLightMatrix = new Matrix4();
1414
const _lightSpaceFrustum = new CSMFrustum( { webGL: true } );
1515
const _center = new Vector3();
16+
const _origin = new Vector3();
1617
const _bbox = new Box3();
1718
const _uniformArray = [];
1819
const _logArray = [];
@@ -367,7 +368,7 @@ export class CSM {
367368

368369
// for each frustum we need to find its min-max box aligned with the light orientation
369370
// the position in _lightOrientationMatrix does not matter, as we transform there and back
370-
_lightOrientationMatrix.lookAt( new Vector3(), this.lightDirection, _up );
371+
_lightOrientationMatrix.lookAt( _origin, this.lightDirection, _up );
371372
_lightOrientationMatrixInverse.copy( _lightOrientationMatrix ).invert();
372373

373374
for ( let i = 0; i < frustums.length; i ++ ) {

0 commit comments

Comments
 (0)