Sprite.js 753 字节
Newer Older
A
alteredq 已提交
1 2
/**
 * @author mikael emtinger / http://gomo.se/
A
alteredq 已提交
3
 * @author alteredq / http://alteredqualia.com/
4 5
 */

6
THREE.Sprite = function ( material ) {
M
Mr.doob 已提交
7

8 9
	THREE.Object3D.call( this );

10
	this.material = ( material !== undefined ) ? material : new THREE.SpriteMaterial();
A
alteredq 已提交
11

12
	this.rotation = 0;
A
alteredq 已提交
13

A
alteredq 已提交
14
};
15

16
THREE.Sprite.prototype = Object.create( THREE.Object3D.prototype );
17 18 19 20 21 22 23

/*
 * Custom update matrix
 */

THREE.Sprite.prototype.updateMatrix = function () {

W
WestLangley 已提交
24
	this.matrix.compose( this.position, this.quaternion, this.scale );
25 26 27 28 29

	this.matrixWorldNeedsUpdate = true;

};

30 31
THREE.Sprite.prototype.clone = function ( object ) {

32
	if ( object === undefined ) object = new THREE.Sprite( this.material );
33 34 35 36 37 38 39

	THREE.Object3D.prototype.clone.call( this, object );

	return object;

};