DirectionalLight.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. * @author alteredq / http://alteredqualia.com/
  4. */
  5. THREE.DirectionalLight = function ( hex, intensity, distance ) {
  6. THREE.Light.call( this, hex );
  7. this.position = new THREE.Vector3( 0, 1, 0 );
  8. this.target = new THREE.Object3D();
  9. this.intensity = ( intensity !== undefined ) ? intensity : 1;
  10. this.distance = ( distance !== undefined ) ? distance : 0;
  11. this.castShadow = false;
  12. this.onlyShadow = false;
  13. //
  14. this.shadowCameraNear = 50;
  15. this.shadowCameraFar = 5000;
  16. this.shadowCameraLeft = -500;
  17. this.shadowCameraRight = 500;
  18. this.shadowCameraTop = 500;
  19. this.shadowCameraBottom = -500;
  20. this.shadowCameraVisible = false;
  21. this.shadowBias = 0;
  22. this.shadowDarkness = 0.5;
  23. this.shadowMapWidth = 512;
  24. this.shadowMapHeight = 512;
  25. //
  26. this.shadowCascade = false;
  27. this.shadowCascadeOffset = new THREE.Vector3( 0, 0, -1000 );
  28. this.shadowCascadeCount = 2;
  29. this.shadowCascadeBias = [ 0, 0, 0 ];
  30. this.shadowCascadeWidth = [ 512, 512, 512 ];
  31. this.shadowCascadeHeight = [ 512, 512, 512 ];
  32. this.shadowCascadeNearZ = [ -1.000, 0.990, 0.998 ];
  33. this.shadowCascadeFarZ = [ 0.990, 0.998, 1.000 ];
  34. this.shadowCascadeArray = [];
  35. //
  36. this.shadowMap = null;
  37. this.shadowMapSize = null;
  38. this.shadowCamera = null;
  39. this.shadowMatrix = null;
  40. };
  41. THREE.DirectionalLight.prototype = Object.create( THREE.Light.prototype );