未验证 提交 b197c7f8 编写于 作者: M Michael Herzog 提交者: GitHub

PointLightShadow: Use PointLight.distance for far value if set. (#21526)

上级 ad0a4b16
......@@ -41,8 +41,6 @@
const light = new THREE.PointLight( color, intensity, 20 );
light.castShadow = true;
light.shadow.camera.near = 1;
light.shadow.camera.far = 60;
light.shadow.bias = - 0.005; // reduces self-shadowing on double-sided objects
let geometry = new THREE.SphereGeometry( 0.3, 12, 6 );
......
......@@ -64,6 +64,15 @@ class PointLightShadow extends LightShadow {
const camera = this.camera;
const shadowMatrix = this.matrix;
const far = light.distance || camera.far;
if ( far !== camera.far ) {
camera.far = far;
camera.updateProjectionMatrix();
}
_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );
camera.position.copy( _lightPositionWorld );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册