updateMatrices method
void
updateMatrices(
- Light light, {
- int viewportIndex = 0,
})
override
Implementation
@override
updateMatrices(light, {viewportIndex = 0}) {
var camera = this.camera;
var shadowMatrix = matrix;
var far = light.distance ?? camera!.far;
if (far != camera!.far) {
camera.far = far;
camera.updateProjectionMatrix();
}
_lightPositionWorld.setFromMatrixPosition(light.matrixWorld);
camera.position.copy(_lightPositionWorld);
_lookTarget.copy(camera.position);
_lookTarget.add(_cubeDirections[viewportIndex]);
camera.up.copy(_cubeUps[viewportIndex]);
camera.lookAt(_lookTarget);
camera.updateMatrixWorld(false);
shadowMatrix.makeTranslation(
-_lightPositionWorld.x, -_lightPositionWorld.y, -_lightPositionWorld.z);
_projScreenMatrix.multiplyMatrices(
camera.projectionMatrix, camera.matrixWorldInverse);
_frustum.setFromProjectionMatrix(_projScreenMatrix);
}