Browse Source

- While we're at it, let's add particle rotations too.

Mr.doob 15 years ago
parent
commit
7d43f5394c

+ 1 - 0
README.md

@@ -129,6 +129,7 @@ Thanks to the power of the internets (and github <3) these people have kindly he
 * Added `ParticleCircleMaterial` and `ParticleBitmapMaterial`
 * `Particle` now use `ParticleCircleMaterial` instead of `ColorFillMaterial`
 * `Particle.size` > `Particle.scale.x` and `Particle.scale.y`
+* `Particle.rotation.z` for rotating the particle
 * `SVGRenderer` currently out of sync
 
 

File diff suppressed because it is too large
+ 0 - 0
build/three.js


+ 2 - 0
src/renderers/CanvasRenderer.js

@@ -186,6 +186,7 @@ THREE.CanvasRenderer = function () {
 
 					_context.save();
 					_context.translate( v1x, v1y );
+					_context.rotate( - element.rotation );
 					_context.scale( width, height );
 					_context.arc( 0, 0, 1, 0, pi2, true );
 					_context.restore();
@@ -212,6 +213,7 @@ THREE.CanvasRenderer = function () {
 
 					_context.save();
 					_context.translate( v1x - width, v1y + height );
+					_context.rotate( - element.rotation );
 					_context.scale( element.scale.x * _widthHalf, - ( element.scale.y * _heightHalf ) );
 					_context.drawImage( bitmap, 0, 0 );
 					_context.restore();

+ 2 - 0
src/renderers/Renderer.js

@@ -211,6 +211,8 @@ THREE.Renderer = function() {
 					particlePool[ particleCount ].y = object.screen.y;
 					particlePool[ particleCount ].z = object.screen.z;
 
+					particlePool[ particleCount ].rotation = object.rotation.z;
+
 					particlePool[ particleCount ].scale.x = object.scale.x * Math.abs( vector4.x / vector4.w - ( vector4.x + camera.projectionMatrix.n11 ) / ( vector4.w + camera.projectionMatrix.n14 ) );
 					particlePool[ particleCount ].scale.y = object.scale.y * Math.abs( vector4.y / vector4.w - ( vector4.y + camera.projectionMatrix.n22 ) / ( vector4.w + camera.projectionMatrix.n24 ) );
 					particlePool[ particleCount ].material = object.material;

+ 1 - 0
src/renderers/renderables/RenderableParticle.js

@@ -8,6 +8,7 @@ THREE.RenderableParticle = function () {
 	this.y = null;
 	this.z = null;
 
+	this.rotation = null;
 	this.scale = new THREE.Vector2();
 
 	this.color = null;

Some files were not shown because too many files changed in this diff