SpriteMaterial.js 1.0 KB

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