Sfoglia il codice sorgente

Moved Sprite.rotation to SpriteMaterial.rotation.

Mr.doob 11 anni fa
parent
commit
35b2609f7a

+ 1 - 1
examples/webgl_sprites.html

@@ -178,7 +178,7 @@
 
 					}
 
-					sprite.rotation += 0.1 * ( c / group.children.length );
+					sprite.material.rotation += 0.1 * ( c / group.children.length );
 					sprite.scale.set( scale * imageWidth, scale * imageHeight, 1.0 );
 
 					if ( material.map !== mapC )

+ 1 - 1
src/extras/renderers/plugins/SpritePlugin.js

@@ -238,7 +238,7 @@ THREE.SpritePlugin = function () {
 				_gl.uniform1f( uniforms.opacity, material.opacity );
 				_gl.uniform3f( uniforms.color, material.color.r, material.color.g, material.color.b );
 
-				_gl.uniform1f( uniforms.rotation, sprite.rotation );
+				_gl.uniform1f( uniforms.rotation, material.rotation );
 				_gl.uniform2fv( uniforms.scale, scale );
 				_gl.uniform2f( uniforms.halfViewport, halfViewportWidth, halfViewportHeight );
 

+ 1 - 0
src/materials/SpriteMaterial.js

@@ -34,6 +34,7 @@ THREE.SpriteMaterial = function ( parameters ) {
 	this.depthTest = !this.useScreenCoordinates;
 	this.sizeAttenuation = !this.useScreenCoordinates;
 	this.alignment = THREE.SpriteAlignment.center.clone();
+	this.rotation = 0;
 
 	this.fog = false;
 

+ 0 - 2
src/objects/Sprite.js

@@ -9,8 +9,6 @@ THREE.Sprite = function ( material ) {
 
 	this.material = ( material !== undefined ) ? material : new THREE.SpriteMaterial();
 
-	this.rotation = 0;
-
 };
 
 THREE.Sprite.prototype = Object.create( THREE.Object3D.prototype );