Fog.js 621 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. * @author alteredq / http://alteredqualia.com/
  4. */
  5. import { Color } from '../math/Color.js';
  6. function Fog( color, near, far ) {
  7. this.name = '';
  8. this.color = new Color( color );
  9. this.near = ( near !== undefined ) ? near : 1;
  10. this.far = ( far !== undefined ) ? far : 1000;
  11. }
  12. Object.assign( Fog.prototype, {
  13. isFog: true,
  14. clone: function () {
  15. return new Fog( this.color, this.near, this.far );
  16. },
  17. toJSON: function ( /* meta */ ) {
  18. return {
  19. type: 'Fog',
  20. color: this.color.getHex(),
  21. near: this.near,
  22. far: this.far
  23. };
  24. }
  25. } );
  26. export { Fog };
粤ICP备19079148号