| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import { LightShadow } from './LightShadow';
- import { _Math } from '../math/Math';
- import { PerspectiveCamera } from '../cameras/PerspectiveCamera';
- /**
- * @author mrdoob / http://mrdoob.com/
- */
- function SpotLightShadow() {
- LightShadow.call( this, new PerspectiveCamera( 50, 1, 0.5, 500 ) );
- }
- SpotLightShadow.prototype = Object.assign( Object.create( LightShadow.prototype ), {
- constructor: SpotLightShadow,
- isSpotLightShadow: true,
- update: function ( light ) {
- var camera = this.camera;
- var fov = _Math.RAD2DEG * 2 * light.angle;
- var aspect = this.mapSize.width / this.mapSize.height;
- var far = light.distance || camera.far;
- if ( fov !== camera.fov || aspect !== camera.aspect || far !== camera.far ) {
- camera.fov = fov;
- camera.aspect = aspect;
- camera.far = far;
- camera.updateProjectionMatrix();
- }
- }
- } );
- export { SpotLightShadow };
|