Particle System new features

2 new Particle System Distribution types:

borderellipse - spawns new particles around the border of an elllipse shape defined by dx,dy
borderrectangle - spawns new particles around the border of a rectangle shape defined by dx, dy

New functions:

getAreaSpreadAngle()
getAreaSpreadIsRelativeDirection()
setAreaSpreadAngle(angle in radians)
setAreaSpreadIsRelativeDirection(boolean)

setAreaSpread(distribution, x, y, (optional)angle, (optional)isRelativeDirection)

- angle - defaults 0. In radians the angle to rotate the entire area spread distribution
- isRelativeDirection - defaults false. When false, particles will travel in the direction defined by setDirection(). When true, particles will travel away from the center of the area spread shape

Demo: http://i.imgur.com/sBQ9Xhr.png

The new angle parameter should address: https://bitbucket.org/rude/love/issues/1172

--HG--
branch : particle system new features
This commit is contained in:
lognz
2017-03-11 01:54:26 -06:00
parent 09b757f018
commit 0f99f261e0
3 changed files with 180 additions and 26 deletions
+63 -2
View File
@@ -197,15 +197,50 @@ public:
* Sets the emission area spread parameters and distribution type. The interpretation of
* the parameters depends on the distribution type:
*
* * None: Parameters are ignored. No area spread.
* * None: Parameters are ignored. No area spread.
* * Uniform: Parameters denote maximal (symmetric) displacement from emitter position.
* * Normal: Parameters denote the standard deviation in x and y direction. x and y are assumed to be uncorrelated.
* * Normal: Parameters denote the standard deviation in x and y direction. x and y are assumed to be uncorrelated.
* * borderellipse: Parameter causes particle distribution around outside of ellipse
* * borderrectangle: Parameter causes particle distribution around outside of rectangle
* @param x First parameter. Interpretation depends on distribution type.
* @param y Second parameter. Interpretation depends on distribution type.
* @param distribution Distribution type
**/
void setAreaSpread(AreaSpreadDistribution distribution, float x, float y);
/**
* Sets the emission area spread parameters and distribution type. The interpretation of
* the parameters depends on the distribution type:
*
* * None: Parameters are ignored. No area spread.
* * Uniform: Parameters denote maximal (symmetric) displacement from emitter position.
* * Normal: Parameters denote the standard deviation in x and y direction. x and y are assumed to be uncorrelated.
* * borderellipse: Parameter causes particle distribution around outside of ellipse
* * borderrectangle: Parameter causes particle distribution around outside of rectangle
* @param x First parameter. Interpretation depends on distribution type.
* @param y Second parameter. Interpretation depends on distribution type.
* @param distribution Distribution type
* @param angle Angle for the distribution to be rotated by
**/
void setAreaSpread(AreaSpreadDistribution distribution, float x, float y, float angle);
/**
* Sets the emission area spread parameters and distribution type. The interpretation of
* the parameters depends on the distribution type:
*
* * None: Parameters are ignored. No area spread.
* * Uniform: Parameters denote maximal (symmetric) displacement from emitter position.
* * Normal: Parameters denote the standard deviation in x and y direction. x and y are assumed to be uncorrelated.
* * borderellipse: Parameter causes particle distribution around outside of ellipse
* * borderrectangle: Parameter causes particle distribution around outside of rectangle
* @param x First parameter. Interpretation depends on distribution type.
* @param y Second parameter. Interpretation depends on distribution type.
* @param distribution Distribution type
* @param angle Angle for the distribution to be rotated by
* @param isRelativeDirection whether to set direction of each particle to away from center
**/
void setAreaSpread(AreaSpreadDistribution distribution, float x, float y, float angle, bool isRelativeDirection);
/**
* Returns area spread distribution type.
**/
@@ -216,6 +251,30 @@ public:
**/
const love::Vector &getAreaSpreadParameters() const;
/**
* Returns the angle of the area distribution (in radians).
**/
float getAreaSpreadAngle() const;
/**
* Sets the angle of the area distribution
* @param angle The angle (in radians).
**/
void setAreaSpreadAngle(float angle);
/**
* Returns true if particles spawn relative to the center of the
* shape area or false if they will use the setDirection parameter
**/
bool getAreaSpreadIsRelativeDirection() const;
/**
* Sets if particles starting direction is away from the center of the
* area spread or the setDirection parameter
* @param isRelativeDirection boolean use relative direction from center
**/
void setAreaSpreadIsRelativeDirection(bool isRelativeDirection);
/**
* Sets the direction of the particle emitter.
* @param direction The direction (in degrees).
@@ -595,6 +654,8 @@ protected:
// Emission area spread.
AreaSpreadDistribution areaSpreadDistribution;
love::Vector areaSpread;
float areaSpreadAngle;
bool areaSpreadIsRelativeDirection;
// The lifetime of the particle emitter (-1 means infinite) and the life it has left.
float lifetime;