PointLight.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. THREE.PointLight = function ( color, intensity, distance, decay ) {
  5. THREE.Light.call( this, color );
  6. this.type = 'PointLight';
  7. this.intensity = ( intensity !== undefined ) ? intensity : 1;
  8. this.distance = ( distance !== undefined ) ? distance : 0;
  9. this.decay = ( decay !== undefined ) ? decay : 1; // for physically correct lights, should be 2.
  10. this.castShadow = false;
  11. this.onlyShadow = false;
  12. //
  13. this.shadowCameraNear = 1;
  14. this.shadowCameraFar = 500;
  15. this.shadowCameraFov = 90;
  16. this.shadowCameraVisible = false;
  17. this.shadowBias = 0;
  18. this.shadowDarkness = 0.5;
  19. this.shadowMapWidth = 512;
  20. this.shadowMapHeight = 512;
  21. //
  22. this.shadowMap = null;
  23. this.shadowMapSize = null;
  24. this.shadowCamera = null;
  25. this.shadowMatrix = null;
  26. };
  27. THREE.PointLight.prototype = Object.create( THREE.Light.prototype );
  28. THREE.PointLight.prototype.constructor = THREE.PointLight;
  29. THREE.PointLight.prototype.copy = function ( source ) {
  30. THREE.Light.prototype.copy.call( this, source );
  31. this.intensity = source.intensity;
  32. this.distance = source.distance;
  33. this.decay = source.decay;
  34. this.castShadow = source.castShadow;
  35. this.onlyShadow = source.onlyShadow;
  36. this.shadowCameraNear = source.shadowCameraNear;
  37. this.shadowCameraFar = source.shadowCameraFar;
  38. this.shadowCameraFov = source.shadowCameraFov;
  39. this.shadowCameraVisible = source.shadowCameraVisible;
  40. this.shadowBias = source.shadowBias;
  41. this.shadowDarkness = source.shadowDarkness;
  42. this.shadowMapWidth = source.shadowMapWidth;
  43. this.shadowMapHeight = source.shadowMapHeight;
  44. return this;
  45. };
粤ICP备19079148号