1
0

SpriteMaterial.js 982 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. * 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.isSpriteMaterial = true;
  28. SpriteMaterial.prototype.copy = function ( source ) {
  29. Material.prototype.copy.call( this, source );
  30. this.color.copy( source.color );
  31. this.map = source.map;
  32. this.rotation = source.rotation;
  33. return this;
  34. };
  35. export { SpriteMaterial };
粤ICP备19079148号