SpriteMaterial.js 917 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { Material } from './Material.js';
  2. import { Color } from '../math/Color.js';
  3. /**
  4. * parameters = {
  5. * color: <hex>,
  6. * map: new THREE.Texture( <Image> ),
  7. * alphaMap: new THREE.Texture( <Image> ),
  8. * rotation: <float>,
  9. * sizeAttenuation: <bool>
  10. * }
  11. */
  12. class SpriteMaterial extends Material {
  13. constructor( parameters ) {
  14. super();
  15. this.type = 'SpriteMaterial';
  16. this.color = new Color( 0xffffff );
  17. this.map = null;
  18. this.alphaMap = null;
  19. this.rotation = 0;
  20. this.sizeAttenuation = true;
  21. this.transparent = true;
  22. this.setValues( parameters );
  23. }
  24. copy( source ) {
  25. super.copy( source );
  26. this.color.copy( source.color );
  27. this.map = source.map;
  28. this.alphaMap = source.alphaMap;
  29. this.rotation = source.rotation;
  30. this.sizeAttenuation = source.sizeAttenuation;
  31. return this;
  32. }
  33. }
  34. SpriteMaterial.prototype.isSpriteMaterial = true;
  35. export { SpriteMaterial };