Sprite.js 790 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * @author mikael emtinger / http://gomo.se/
  3. * @author alteredq / http://alteredqualia.com/
  4. */
  5. THREE.Sprite = function ( material ) {
  6. THREE.Object3D.call( this );
  7. this.material = ( material !== undefined ) ? material : new THREE.SpriteMaterial();
  8. };
  9. THREE.Sprite.prototype = Object.create( THREE.Object3D.prototype );
  10. /*
  11. * Custom update matrix
  12. */
  13. THREE.Sprite.prototype.updateMatrix = function () {
  14. this.matrix.compose( this.position, this.quaternion, this.scale );
  15. this.matrixWorldNeedsUpdate = true;
  16. };
  17. THREE.Sprite.prototype.clone = function ( object ) {
  18. if ( object === undefined ) object = new THREE.Sprite( this.material );
  19. THREE.Object3D.prototype.clone.call( this, object );
  20. return object;
  21. };
  22. // Backwards compatibility
  23. THREE.Particle = THREE.Sprite;