SpriteMaterial.js 926 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { Material } from './Material';
  2. import { Color } from '../math/Color';
  3. /**
  4. * @author alteredq / http://alteredqualia.com/
  5. *
  6. * parameters = {
  7. * color: <hex>,
  8. * opacity: <float>,
  9. * map: new THREE.Texture( <Image> ),
  10. *
  11. * uvOffset: new THREE.Vector2(),
  12. * uvScale: new THREE.Vector2()
  13. * }
  14. */
  15. function SpriteMaterial( parameters ) {
  16. Material.call( this );
  17. this.type = 'SpriteMaterial';
  18. this.color = new Color( 0xffffff );
  19. this.map = null;
  20. this.rotation = 0;
  21. this.fog = false;
  22. this.lights = false;
  23. this.setValues( parameters );
  24. }
  25. SpriteMaterial.prototype = Object.create( Material.prototype );
  26. SpriteMaterial.prototype.constructor = SpriteMaterial;
  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. return this;
  33. };
  34. export { SpriteMaterial };
粤ICP备19079148号