1 | /**
|
---|
2 | * @author mrdoob / http://mrdoob.com/
|
---|
3 | * @author alteredq / http://alteredqualia.com/
|
---|
4 | */
|
---|
5 |
|
---|
6 | THREE.DirectionalLight = function ( hex, intensity ) {
|
---|
7 |
|
---|
8 | THREE.Light.call( this, hex );
|
---|
9 |
|
---|
10 | this.position.set( 0, 1, 0 );
|
---|
11 | this.target = new THREE.Object3D();
|
---|
12 |
|
---|
13 | this.intensity = ( intensity !== undefined ) ? intensity : 1;
|
---|
14 |
|
---|
15 | this.castShadow = false;
|
---|
16 | this.onlyShadow = false;
|
---|
17 |
|
---|
18 | //
|
---|
19 |
|
---|
20 | this.shadowCameraNear = 50;
|
---|
21 | this.shadowCameraFar = 5000;
|
---|
22 |
|
---|
23 | this.shadowCameraLeft = -500;
|
---|
24 | this.shadowCameraRight = 500;
|
---|
25 | this.shadowCameraTop = 500;
|
---|
26 | this.shadowCameraBottom = -500;
|
---|
27 |
|
---|
28 | this.shadowCameraVisible = false;
|
---|
29 |
|
---|
30 | this.shadowBias = 0;
|
---|
31 | this.shadowDarkness = 0.5;
|
---|
32 |
|
---|
33 | this.shadowMapWidth = 512;
|
---|
34 | this.shadowMapHeight = 512;
|
---|
35 |
|
---|
36 | //
|
---|
37 |
|
---|
38 | this.shadowCascade = false;
|
---|
39 |
|
---|
40 | this.shadowCascadeOffset = new THREE.Vector3( 0, 0, -1000 );
|
---|
41 | this.shadowCascadeCount = 2;
|
---|
42 |
|
---|
43 | this.shadowCascadeBias = [ 0, 0, 0 ];
|
---|
44 | this.shadowCascadeWidth = [ 512, 512, 512 ];
|
---|
45 | this.shadowCascadeHeight = [ 512, 512, 512 ];
|
---|
46 |
|
---|
47 | this.shadowCascadeNearZ = [ -1.000, 0.990, 0.998 ];
|
---|
48 | this.shadowCascadeFarZ = [ 0.990, 0.998, 1.000 ];
|
---|
49 |
|
---|
50 | this.shadowCascadeArray = [];
|
---|
51 |
|
---|
52 | //
|
---|
53 |
|
---|
54 | this.shadowMap = null;
|
---|
55 | this.shadowMapSize = null;
|
---|
56 | this.shadowCamera = null;
|
---|
57 | this.shadowMatrix = null;
|
---|
58 |
|
---|
59 | };
|
---|
60 |
|
---|
61 | THREE.DirectionalLight.prototype = Object.create( THREE.Light.prototype );
|
---|
62 |
|
---|
63 | THREE.DirectionalLight.prototype.clone = function () {
|
---|
64 |
|
---|
65 | var light = new THREE.DirectionalLight();
|
---|
66 |
|
---|
67 | THREE.Light.prototype.clone.call( this, light );
|
---|
68 |
|
---|
69 | light.target = this.target.clone();
|
---|
70 |
|
---|
71 | light.intensity = this.intensity;
|
---|
72 |
|
---|
73 | light.castShadow = this.castShadow;
|
---|
74 | light.onlyShadow = this.onlyShadow;
|
---|
75 |
|
---|
76 | return light;
|
---|
77 |
|
---|
78 | };
|
---|