SpriteMaterial.js 973 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * @author alteredq / http://alteredqualia.com/
  3. *
  4. * parameters = {
  5. * color: <hex>,
  6. * opacity: <float>,
  7. * map: new THREE.Texture( <Image> ),
  8. *
  9. * blending: THREE.NormalBlending,
  10. * depthTest: <bool>,
  11. * depthWrite: <bool>,
  12. *
  13. * uvOffset: new THREE.Vector2(),
  14. * uvScale: new THREE.Vector2(),
  15. *
  16. * fog: <bool>
  17. * }
  18. */
  19. THREE.SpriteMaterial = function ( parameters ) {
  20. THREE.Material.call( this );
  21. // defaults
  22. this.color = new THREE.Color( 0xffffff );
  23. this.map = null;
  24. this.rotation = 0;
  25. this.fog = false;
  26. // set parameters
  27. this.setValues( parameters );
  28. };
  29. THREE.SpriteMaterial.prototype = Object.create( THREE.Material.prototype );
  30. THREE.SpriteMaterial.prototype.clone = function () {
  31. var material = new THREE.SpriteMaterial();
  32. THREE.Material.prototype.clone.call( this, material );
  33. material.color.copy( this.color );
  34. material.map = this.map;
  35. material.rotation = this.rotation;
  36. material.fog = this.fog;
  37. return material;
  38. };