updateMatrices method
Update the matrices for the camera and shadow, used internally by the renderer.
light
- the light for which the shadow is being rendered.
Implementation
void updateMatrices(Light light, {int viewportIndex = 0}) {
final shadowCamera = camera;
final shadowMatrix = matrix;
final lightPositionWorld = this.lightPositionWorld;
lightPositionWorld.setFromMatrixPosition(light.matrixWorld);
shadowCamera!.position.setFrom(lightPositionWorld);
lookTarget.setFromMatrixPosition(light.target!.matrixWorld);
shadowCamera.lookAt(lookTarget);
shadowCamera.updateMatrixWorld(false);
projScreenMatrix.multiply2(shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse);
frustum.setFromMatrix(projScreenMatrix);
shadowMatrix.setValues(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5,0.0, 0.0, 0.0, 1.0);
shadowMatrix.multiply(shadowCamera.projectionMatrix);
shadowMatrix.multiply(shadowCamera.matrixWorldInverse);
}