|
@@ -10,61 +10,58 @@ import { SpriteMaterial } from '../materials/SpriteMaterial.js';
|
|
|
|
|
|
let _geometry;
|
|
|
|
|
|
-const _intersectPoint = new Vector3();
|
|
|
-const _worldScale = new Vector3();
|
|
|
-const _mvPosition = new Vector3();
|
|
|
+const _intersectPoint = /*@__PURE__*/ new Vector3();
|
|
|
+const _worldScale = /*@__PURE__*/ new Vector3();
|
|
|
+const _mvPosition = /*@__PURE__*/ new Vector3();
|
|
|
|
|
|
-const _alignedPosition = new Vector2();
|
|
|
-const _rotatedPosition = new Vector2();
|
|
|
-const _viewWorldMatrix = new Matrix4();
|
|
|
+const _alignedPosition = /*@__PURE__*/ new Vector2();
|
|
|
+const _rotatedPosition = /*@__PURE__*/ new Vector2();
|
|
|
+const _viewWorldMatrix = /*@__PURE__*/ new Matrix4();
|
|
|
|
|
|
-const _vA = new Vector3();
|
|
|
-const _vB = new Vector3();
|
|
|
-const _vC = new Vector3();
|
|
|
+const _vA = /*@__PURE__*/ new Vector3();
|
|
|
+const _vB = /*@__PURE__*/ new Vector3();
|
|
|
+const _vC = /*@__PURE__*/ new Vector3();
|
|
|
|
|
|
-const _uvA = new Vector2();
|
|
|
-const _uvB = new Vector2();
|
|
|
-const _uvC = new Vector2();
|
|
|
+const _uvA = /*@__PURE__*/ new Vector2();
|
|
|
+const _uvB = /*@__PURE__*/ new Vector2();
|
|
|
+const _uvC = /*@__PURE__*/ new Vector2();
|
|
|
|
|
|
-function Sprite( material ) {
|
|
|
+class Sprite extends Object3D {
|
|
|
|
|
|
- Object3D.call( this );
|
|
|
+ constructor( material ) {
|
|
|
|
|
|
- this.type = 'Sprite';
|
|
|
+ super();
|
|
|
+ this.type = 'Sprite';
|
|
|
|
|
|
- if ( _geometry === undefined ) {
|
|
|
+ if ( _geometry === undefined ) {
|
|
|
|
|
|
- _geometry = new BufferGeometry();
|
|
|
+ _geometry = new BufferGeometry();
|
|
|
|
|
|
- const float32Array = new Float32Array( [
|
|
|
- - 0.5, - 0.5, 0, 0, 0,
|
|
|
- 0.5, - 0.5, 0, 1, 0,
|
|
|
- 0.5, 0.5, 0, 1, 1,
|
|
|
- - 0.5, 0.5, 0, 0, 1
|
|
|
- ] );
|
|
|
+ const float32Array = new Float32Array( [
|
|
|
+ - 0.5, - 0.5, 0, 0, 0,
|
|
|
+ 0.5, - 0.5, 0, 1, 0,
|
|
|
+ 0.5, 0.5, 0, 1, 1,
|
|
|
+ - 0.5, 0.5, 0, 0, 1
|
|
|
+ ] );
|
|
|
|
|
|
- const interleavedBuffer = new InterleavedBuffer( float32Array, 5 );
|
|
|
+ const interleavedBuffer = new InterleavedBuffer( float32Array, 5 );
|
|
|
|
|
|
- _geometry.setIndex( [ 0, 1, 2, 0, 2, 3 ] );
|
|
|
- _geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );
|
|
|
- _geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );
|
|
|
+ _geometry.setIndex( [ 0, 1, 2, 0, 2, 3 ] );
|
|
|
+ _geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );
|
|
|
+ _geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
- this.geometry = _geometry;
|
|
|
- this.material = ( material !== undefined ) ? material : new SpriteMaterial();
|
|
|
-
|
|
|
- this.center = new Vector2( 0.5, 0.5 );
|
|
|
+ }
|
|
|
|
|
|
-}
|
|
|
+ this.geometry = _geometry;
|
|
|
+ this.material = ( material !== undefined ) ? material : new SpriteMaterial();
|
|
|
|
|
|
-Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
+ this.center = new Vector2( 0.5, 0.5 );
|
|
|
|
|
|
- constructor: Sprite,
|
|
|
+ Object.defineProperty( this, 'isSprite', { value: true } );
|
|
|
|
|
|
- isSprite: true,
|
|
|
+ }
|
|
|
|
|
|
- raycast: function ( raycaster, intersects ) {
|
|
|
+ raycast( raycaster, intersects ) {
|
|
|
|
|
|
if ( raycaster.camera === null ) {
|
|
|
|
|
@@ -137,9 +134,9 @@ Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
|
|
|
} );
|
|
|
|
|
|
- },
|
|
|
+ }
|
|
|
|
|
|
- copy: function ( source ) {
|
|
|
+ copy( source ) {
|
|
|
|
|
|
Object3D.prototype.copy.call( this, source );
|
|
|
|
|
@@ -151,7 +148,7 @@ Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
|
|
|
}
|
|
|
|
|
|
-} );
|
|
|
+}
|
|
|
|
|
|
function transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) {
|
|
|
|