Sprite.js 905 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. this.rotation3d = this.rotation;
  9. this.rotation = 0;
  10. };
  11. THREE.Sprite.prototype = Object.create( THREE.Object3D.prototype );
  12. /*
  13. * Custom update matrix
  14. */
  15. THREE.Sprite.prototype.updateMatrix = function () {
  16. this.rotation3d.set( 0, 0, this.rotation, this.rotation3d.order );
  17. this.quaternion.setFromEuler( this.rotation3d );
  18. this.matrix.compose( this.position, this.quaternion, this.scale );
  19. this.matrixWorldNeedsUpdate = true;
  20. };
  21. THREE.Sprite.prototype.clone = function ( object ) {
  22. if ( object === undefined ) object = new THREE.Sprite( this.material );
  23. THREE.Object3D.prototype.clone.call( this, object );
  24. return object;
  25. };