Axiom.ParticleFX.HollowEllipsoidEmitter.InitParticle C# (CSharp) Méthode

InitParticle() public méthode

public InitParticle ( Particle particle ) : void
particle Axiom.ParticleSystems.Particle
Résultat void
		public override void InitParticle( Particle particle )
		{
			float alpha, beta, a, b, c, x, y, z;

			particle.ResetDimensions();

			// create two random angles alpha and beta
			// with these two angles, we are able to select any point on an
			// ellipsoid's surface
			Utility.RangeRandom( durationMin, durationMax );

			alpha = Utility.RangeRandom( 0, Utility.TWO_PI );
			beta = Utility.RangeRandom( 0, Utility.PI );

			// create three random radius values that are bigger than the inner
			// size, but smaller/equal than/to the outer size 1.0 (inner size is
			// between 0 and 1)
			a = Utility.RangeRandom( InnerX, 1.0f );
			b = Utility.RangeRandom( InnerY, 1.0f );
			c = Utility.RangeRandom( InnerZ, 1.0f );

			// with a,b,c we have defined a random ellipsoid between the inner
			// ellipsoid and the outer sphere (radius 1.0)
			// with alpha and beta we select on point on this random ellipsoid
			// and calculate the 3D coordinates of this point
			x = a * Utility.Cos( alpha ) * Utility.Sin( beta );
			y = b * Utility.Sin( alpha ) * Utility.Sin( beta );
			z = c * Utility.Cos( beta );

			// scale the found point to the ellipsoid's size and move it
			// relatively to the center of the emitter point

			particle.Position = position + x * xRange + y * yRange * z * zRange;

			// Generate complex data by reference
			GenerateEmissionColor( ref particle.Color );
			GenerateEmissionDirection( ref particle.Direction );
			GenerateEmissionVelocity( ref particle.Direction );

			// Generate simpler data
			particle.timeToLive = GenerateEmissionTTL();
		}