| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- /**
- * @author mrdoob / http://mrdoob.com/
- * @author alteredq / http://alteredqualia.com/
- */
- THREE.DirectionalLight = function ( color, intensity ) {
- THREE.Light.call( this, color );
- this.type = 'DirectionalLight';
- this.position.set( 0, 1, 0 );
- this.target = new THREE.Object3D();
- this.intensity = ( intensity !== undefined ) ? intensity : 1;
- this.castShadow = false;
- this.onlyShadow = false;
- //
- this.shadowCameraNear = 50;
- this.shadowCameraFar = 5000;
- this.shadowCameraLeft = - 500;
- this.shadowCameraRight = 500;
- this.shadowCameraTop = 500;
- this.shadowCameraBottom = - 500;
- this.shadowCameraVisible = false;
- this.shadowBias = 0;
- this.shadowDarkness = 0.5;
- this.shadowMapWidth = 512;
- this.shadowMapHeight = 512;
- //
- this.shadowCascade = false;
- this.shadowCascadeOffset = new THREE.Vector3( 0, 0, - 1000 );
- this.shadowCascadeCount = 2;
- this.shadowCascadeBias = [ 0, 0, 0 ];
- this.shadowCascadeWidth = [ 512, 512, 512 ];
- this.shadowCascadeHeight = [ 512, 512, 512 ];
- this.shadowCascadeNearZ = [ - 1.000, 0.990, 0.998 ];
- this.shadowCascadeFarZ = [ 0.990, 0.998, 1.000 ];
- this.shadowCascadeArray = [];
- //
- this.shadowMap = null;
- this.shadowMapSize = null;
- this.shadowCamera = null;
- this.shadowMatrix = null;
- };
- THREE.DirectionalLight.prototype = Object.create( THREE.Light.prototype );
- THREE.DirectionalLight.prototype.constructor = THREE.DirectionalLight;
- THREE.DirectionalLight.prototype.clone = function () {
- var light = new THREE.DirectionalLight();
- THREE.Light.prototype.clone.call( this, light );
- light.target = this.target.clone();
- light.intensity = this.intensity;
- light.castShadow = this.castShadow;
- light.onlyShadow = this.onlyShadow;
- //
- light.shadowCameraNear = this.shadowCameraNear;
- light.shadowCameraFar = this.shadowCameraFar;
- light.shadowCameraLeft = this.shadowCameraLeft;
- light.shadowCameraRight = this.shadowCameraRight;
- light.shadowCameraTop = this.shadowCameraTop;
- light.shadowCameraBottom = this.shadowCameraBottom;
- light.shadowCameraVisible = this.shadowCameraVisible;
- light.shadowBias = this.shadowBias;
- light.shadowDarkness = this.shadowDarkness;
- light.shadowMapWidth = this.shadowMapWidth;
- light.shadowMapHeight = this.shadowMapHeight;
- //
- light.shadowCascade = this.shadowCascade;
- light.shadowCascadeOffset.copy( this.shadowCascadeOffset );
- light.shadowCascadeCount = this.shadowCascadeCount;
- light.shadowCascadeBias = this.shadowCascadeBias.slice( 0 );
- light.shadowCascadeWidth = this.shadowCascadeWidth.slice( 0 );
- light.shadowCascadeHeight = this.shadowCascadeHeight.slice( 0 );
- light.shadowCascadeNearZ = this.shadowCascadeNearZ.slice( 0 );
- light.shadowCascadeFarZ = this.shadowCascadeFarZ.slice( 0 );
- return light;
- };
- THREE.DirectionalLight.prototype.toJSON = function ( meta ) {
- var data = THREE.Object3D.prototype.toJSON.call( this, meta );
- data.object.color = this.color.getHex();
- data.object.intensity = this.intensity;
- return data;
- };
|