LightProbe.js 849 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. * @author WestLangley / http://github.com/WestLangley
  3. *
  4. * A LightProbe is a source of indirect-diffuse light
  5. */
  6. import { SphericalHarmonics3 } from '../math/SphericalHarmonics3.js';
  7. import { Light } from './Light.js';
  8. function LightProbe( sh, intensity ) {
  9. Light.call( this, undefined, intensity );
  10. this.sh = ( sh !== undefined ) ? sh : new SphericalHarmonics3();
  11. }
  12. LightProbe.prototype = Object.assign( Object.create( Light.prototype ), {
  13. constructor: LightProbe,
  14. isLightProbe: true,
  15. copy: function ( source ) {
  16. Light.prototype.copy.call( this, source );
  17. this.sh.copy( source.sh );
  18. this.intensity = source.intensity;
  19. return this;
  20. },
  21. toJSON: function ( meta ) {
  22. var data = Light.prototype.toJSON.call( this, meta );
  23. // data.sh = this.sh.toArray(); // todo
  24. return data;
  25. }
  26. } );
  27. export { LightProbe };
粤ICP备19079148号