mirror of https://github.com/axmolengine/axmol.git
Fix indentations.
This commit is contained in:
parent
4ab0fbd62d
commit
c54b142e58
|
@ -126,27 +126,27 @@ bool ParticleData::init(int count)
|
||||||
{
|
{
|
||||||
maxCount = count;
|
maxCount = count;
|
||||||
|
|
||||||
posx = (float*)malloc(count * sizeof(float));
|
posx = (float*)malloc(count * sizeof(float));
|
||||||
posy = (float*)malloc(count * sizeof(float));
|
posy = (float*)malloc(count * sizeof(float));
|
||||||
startPosX = (float*)malloc(count * sizeof(float));
|
startPosX = (float*)malloc(count * sizeof(float));
|
||||||
startPosY = (float*)malloc(count * sizeof(float));
|
startPosY = (float*)malloc(count * sizeof(float));
|
||||||
colorR = (float*)malloc(count * sizeof(float));
|
colorR = (float*)malloc(count * sizeof(float));
|
||||||
colorG = (float*)malloc(count * sizeof(float));
|
colorG = (float*)malloc(count * sizeof(float));
|
||||||
colorB = (float*)malloc(count * sizeof(float));
|
colorB = (float*)malloc(count * sizeof(float));
|
||||||
colorA = (float*)malloc(count * sizeof(float));
|
colorA = (float*)malloc(count * sizeof(float));
|
||||||
deltaColorR = (float*)malloc(count * sizeof(float));
|
deltaColorR = (float*)malloc(count * sizeof(float));
|
||||||
deltaColorG = (float*)malloc(count * sizeof(float));
|
deltaColorG = (float*)malloc(count * sizeof(float));
|
||||||
deltaColorB = (float*)malloc(count * sizeof(float));
|
deltaColorB = (float*)malloc(count * sizeof(float));
|
||||||
deltaColorA = (float*)malloc(count * sizeof(float));
|
deltaColorA = (float*)malloc(count * sizeof(float));
|
||||||
|
|
||||||
size = (float*)malloc(count * sizeof(float));
|
size = (float*)malloc(count * sizeof(float));
|
||||||
deltaSize = (float*)malloc(count * sizeof(float));
|
deltaSize = (float*)malloc(count * sizeof(float));
|
||||||
rotation = (float*)malloc(count * sizeof(float));
|
rotation = (float*)malloc(count * sizeof(float));
|
||||||
staticRotation = (float*)malloc(count * sizeof(float));
|
staticRotation = (float*)malloc(count * sizeof(float));
|
||||||
deltaRotation = (float*)malloc(count * sizeof(float));
|
deltaRotation = (float*)malloc(count * sizeof(float));
|
||||||
totalTimeToLive = (float*)malloc(count * sizeof(float));
|
totalTimeToLive = (float*)malloc(count * sizeof(float));
|
||||||
timeToLive = (float*)malloc(count * sizeof(float));
|
timeToLive = (float*)malloc(count * sizeof(float));
|
||||||
atlasIndex = (unsigned int*)malloc(count * sizeof(unsigned int));
|
atlasIndex = (unsigned int*)malloc(count * sizeof(unsigned int));
|
||||||
|
|
||||||
modeA.dirX = (float*)malloc(count * sizeof(float));
|
modeA.dirX = (float*)malloc(count * sizeof(float));
|
||||||
modeA.dirY = (float*)malloc(count * sizeof(float));
|
modeA.dirY = (float*)malloc(count * sizeof(float));
|
||||||
|
@ -262,7 +262,7 @@ ParticleSystem::ParticleSystem()
|
||||||
, _isLoopAnimated(false)
|
, _isLoopAnimated(false)
|
||||||
, _animIndexCount(0)
|
, _animIndexCount(0)
|
||||||
, _isAnimationReversed(false)
|
, _isAnimationReversed(false)
|
||||||
, _undefinedIndexRect({0,0,0,0})
|
, _undefinedIndexRect({0, 0, 0, 0})
|
||||||
, _animationTimescaleInd(false)
|
, _animationTimescaleInd(false)
|
||||||
, _yCoordFlipped(1)
|
, _yCoordFlipped(1)
|
||||||
, _positionType(PositionType::FREE)
|
, _positionType(PositionType::FREE)
|
||||||
|
@ -325,11 +325,11 @@ bool ParticleSystem::allocAnimationMem()
|
||||||
if (!_isAnimAllocated)
|
if (!_isAnimAllocated)
|
||||||
{
|
{
|
||||||
_particleData.animTimeLength = (float*)malloc(_totalParticles * sizeof(float));
|
_particleData.animTimeLength = (float*)malloc(_totalParticles * sizeof(float));
|
||||||
_particleData.animTimeDelta = (float*)malloc(_totalParticles * sizeof(float));
|
_particleData.animTimeDelta = (float*)malloc(_totalParticles * sizeof(float));
|
||||||
_particleData.animIndex = (unsigned short*)malloc(_totalParticles * sizeof(unsigned short));
|
_particleData.animIndex = (unsigned short*)malloc(_totalParticles * sizeof(unsigned short));
|
||||||
_particleData.animCellIndex = (unsigned short*)malloc(_totalParticles * sizeof(unsigned short));
|
_particleData.animCellIndex = (unsigned short*)malloc(_totalParticles * sizeof(unsigned short));
|
||||||
if (_particleData.animTimeLength && _particleData.animTimeDelta &&
|
if (_particleData.animTimeLength && _particleData.animTimeDelta && _particleData.animIndex &&
|
||||||
_particleData.animIndex && _particleData.animCellIndex)
|
_particleData.animCellIndex)
|
||||||
return _isAnimAllocated = true;
|
return _isAnimAllocated = true;
|
||||||
else
|
else
|
||||||
// If any of the above allocations fail, then we safely deallocate the ones that succeeded.
|
// If any of the above allocations fail, then we safely deallocate the ones that succeeded.
|
||||||
|
@ -782,7 +782,7 @@ void ParticleSystem::addParticles(int count, int animationIndex, int animationCe
|
||||||
}
|
}
|
||||||
|
|
||||||
auto randElem = abs(RANDOM_KISS());
|
auto randElem = abs(RANDOM_KISS());
|
||||||
auto& shape = _emissionShapes[MIN(randElem * _emissionShapes.size(), _emissionShapes.size() - 1)];
|
auto& shape = _emissionShapes[MIN(randElem * _emissionShapes.size(), _emissionShapes.size() - 1)];
|
||||||
|
|
||||||
switch (shape.type)
|
switch (shape.type)
|
||||||
{
|
{
|
||||||
|
@ -802,11 +802,11 @@ void ParticleSystem::addParticles(int count, int animationIndex, int animationCe
|
||||||
}
|
}
|
||||||
case EmissionShapeType::RECTTORUS:
|
case EmissionShapeType::RECTTORUS:
|
||||||
{
|
{
|
||||||
float width = (shape.outerWidth - shape.innerWidth) * abs(RANDOM_KISS()) + shape.innerWidth;
|
float width = (shape.outerWidth - shape.innerWidth) * abs(RANDOM_KISS()) + shape.innerWidth;
|
||||||
float height = (shape.outerHeight - shape.innerHeight) * abs(RANDOM_KISS()) + shape.innerHeight;
|
float height = (shape.outerHeight - shape.innerHeight) * abs(RANDOM_KISS()) + shape.innerHeight;
|
||||||
width = RANDOM_KISS() < 0.0F ? width * -1 : width;
|
width = RANDOM_KISS() < 0.0F ? width * -1 : width;
|
||||||
height = RANDOM_KISS() < 0.0F ? height * -1 : height;
|
height = RANDOM_KISS() < 0.0F ? height * -1 : height;
|
||||||
float prob = RANDOM_KISS();
|
float prob = RANDOM_KISS();
|
||||||
_particleData.posx[i] = _sourcePosition.x + shape.x + width / 2 * (prob >= 0.0F ? 1.0F : RANDOM_KISS());
|
_particleData.posx[i] = _sourcePosition.x + shape.x + width / 2 * (prob >= 0.0F ? 1.0F : RANDOM_KISS());
|
||||||
_particleData.posy[i] = _sourcePosition.y + shape.y + height / 2 * (prob < 0.0F ? 1.0F : RANDOM_KISS());
|
_particleData.posy[i] = _sourcePosition.y + shape.y + height / 2 * (prob < 0.0F ? 1.0F : RANDOM_KISS());
|
||||||
|
|
||||||
|
@ -827,9 +827,10 @@ void ParticleSystem::addParticles(int count, int animationIndex, int animationCe
|
||||||
{
|
{
|
||||||
auto val = abs(RANDOM_KISS()) * shape.outerRadius / shape.outerRadius;
|
auto val = abs(RANDOM_KISS()) * shape.outerRadius / shape.outerRadius;
|
||||||
val = powf(val, 1 / shape.edgeElasticity);
|
val = powf(val, 1 / shape.edgeElasticity);
|
||||||
auto point = Vec2(((val * (shape.outerRadius - shape.innerRadius) + shape.outerRadius) -
|
auto point = Vec2(((val * (shape.outerRadius - shape.innerRadius) + shape.outerRadius) -
|
||||||
(shape.outerRadius - shape.innerRadius)) *
|
(shape.outerRadius - shape.innerRadius)) *
|
||||||
(RANDOM_KISS() < 0.0F ? 1.0F : -1.0F), 0.0F);
|
(RANDOM_KISS() < 0.0F ? 1.0F : -1.0F),
|
||||||
|
0.0F);
|
||||||
point = point.rotateByAngle(Vec2::ZERO, CC_DEGREES_TO_RADIANS(RANDOM_KISS() * 360));
|
point = point.rotateByAngle(Vec2::ZERO, CC_DEGREES_TO_RADIANS(RANDOM_KISS() * 360));
|
||||||
_particleData.posx[i] = _sourcePosition.x + shape.x + point.x / 2;
|
_particleData.posx[i] = _sourcePosition.x + shape.x + point.x / 2;
|
||||||
_particleData.posy[i] = _sourcePosition.y + shape.y + point.y / 2;
|
_particleData.posy[i] = _sourcePosition.y + shape.y + point.y / 2;
|
||||||
|
@ -907,9 +908,9 @@ void ParticleSystem::addParticles(int count, int animationIndex, int animationCe
|
||||||
}
|
}
|
||||||
|
|
||||||
// color
|
// color
|
||||||
#define SET_COLOR(c, b, v) \
|
#define SET_COLOR(c, b, v) \
|
||||||
for (int i = start; i < _particleCount; ++i) \
|
for (int i = start; i < _particleCount; ++i) \
|
||||||
{ \
|
{ \
|
||||||
c[i] = clampf(b + v * RANDOM_KISS(), 0, 1); \
|
c[i] = clampf(b + v * RANDOM_KISS(), 0, 1); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1035,8 +1036,7 @@ void ParticleSystem::addParticles(int count, int animationIndex, int animationCe
|
||||||
// tangential accel
|
// tangential accel
|
||||||
for (int i = start; i < _particleCount; ++i)
|
for (int i = start; i < _particleCount; ++i)
|
||||||
{
|
{
|
||||||
_particleData.modeA.tangentialAccel[i] =
|
_particleData.modeA.tangentialAccel[i] = modeA.tangentialAccel + modeA.tangentialAccelVar * RANDOM_KISS();
|
||||||
modeA.tangentialAccel + modeA.tangentialAccelVar * RANDOM_KISS();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// rotation is dir
|
// rotation is dir
|
||||||
|
@ -1105,7 +1105,7 @@ void ParticleSystem::addParticles(int count, int animationIndex, int animationCe
|
||||||
void ParticleSystem::setAnimationDescriptor(unsigned short indexOfDescriptor,
|
void ParticleSystem::setAnimationDescriptor(unsigned short indexOfDescriptor,
|
||||||
float time,
|
float time,
|
||||||
float timeVariance,
|
float timeVariance,
|
||||||
const std::vector<unsigned short> &indices,
|
const std::vector<unsigned short>& indices,
|
||||||
bool reverse)
|
bool reverse)
|
||||||
{
|
{
|
||||||
auto iter = _animations.find(indexOfDescriptor);
|
auto iter = _animations.find(indexOfDescriptor);
|
||||||
|
@ -1266,16 +1266,14 @@ void ParticleSystem::setAnimationIndicesAtlas()
|
||||||
// VERTICAL
|
// VERTICAL
|
||||||
if (_texture->getPixelsHigh() > _texture->getPixelsWide())
|
if (_texture->getPixelsHigh() > _texture->getPixelsWide())
|
||||||
{
|
{
|
||||||
setAnimationIndicesAtlas(_texture->getPixelsWide(),
|
setAnimationIndicesAtlas(_texture->getPixelsWide(), ParticleSystem::TexAnimDir::VERTICAL);
|
||||||
ParticleSystem::TexAnimDir::VERTICAL);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// HORIZONTAL
|
// HORIZONTAL
|
||||||
if (_texture->getPixelsWide() > _texture->getPixelsHigh())
|
if (_texture->getPixelsWide() > _texture->getPixelsHigh())
|
||||||
{
|
{
|
||||||
setAnimationIndicesAtlas(_texture->getPixelsHigh(),
|
setAnimationIndicesAtlas(_texture->getPixelsHigh(), ParticleSystem::TexAnimDir::HORIZONTAL);
|
||||||
ParticleSystem::TexAnimDir::HORIZONTAL);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1287,7 +1285,7 @@ void ParticleSystem::setAnimationIndicesAtlas(unsigned int unifiedCellSize, TexA
|
||||||
CCASSERT(unifiedCellSize > 0, "A cell cannot have a size of zero.");
|
CCASSERT(unifiedCellSize > 0, "A cell cannot have a size of zero.");
|
||||||
|
|
||||||
resetAnimationIndices();
|
resetAnimationIndices();
|
||||||
|
|
||||||
auto texWidth = _texture->getPixelsWide();
|
auto texWidth = _texture->getPixelsWide();
|
||||||
auto texHeight = _texture->getPixelsHigh();
|
auto texHeight = _texture->getPixelsHigh();
|
||||||
|
|
||||||
|
@ -1319,8 +1317,8 @@ void ParticleSystem::setAnimationIndicesAtlas(unsigned int unifiedCellSize, TexA
|
||||||
frame.origin.x = unifiedCellSize * i;
|
frame.origin.x = unifiedCellSize * i;
|
||||||
frame.origin.y = 0;
|
frame.origin.y = 0;
|
||||||
|
|
||||||
frame.size.x = unifiedCellSize;
|
frame.size.x = unifiedCellSize;
|
||||||
frame.size.y = texHeight;
|
frame.size.y = texHeight;
|
||||||
|
|
||||||
addAnimationIndex(_animIndexCount, frame);
|
addAnimationIndex(_animIndexCount, frame);
|
||||||
}
|
}
|
||||||
|
@ -1342,7 +1340,7 @@ bool ParticleSystem::addAnimationIndex(unsigned short index, std::string_view fr
|
||||||
if (frame)
|
if (frame)
|
||||||
return addAnimationIndex(index, frame);
|
return addAnimationIndex(index, frame);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParticleSystem::addAnimationIndex(cocos2d::SpriteFrame* frame)
|
bool ParticleSystem::addAnimationIndex(cocos2d::SpriteFrame* frame)
|
||||||
{
|
{
|
||||||
|
@ -1374,12 +1372,12 @@ bool ParticleSystem::addAnimationIndex(unsigned short index, cocos2d::Rect rect,
|
||||||
void ParticleSystem::simulate(float seconds, float frameRate)
|
void ParticleSystem::simulate(float seconds, float frameRate)
|
||||||
{
|
{
|
||||||
auto l_updatePaused = _updatePaused;
|
auto l_updatePaused = _updatePaused;
|
||||||
_updatePaused = false;
|
_updatePaused = false;
|
||||||
seconds = seconds == SIMULATION_USE_PARTICLE_LIFETIME ?
|
seconds = seconds == SIMULATION_USE_PARTICLE_LIFETIME ? getLife() + getLifeVar() : seconds;
|
||||||
getLife() + getLifeVar() : seconds;
|
frameRate = frameRate == SIMULATION_USE_GAME_ANIMATION_INTERVAL
|
||||||
frameRate = frameRate == SIMULATION_USE_GAME_ANIMATION_INTERVAL ?
|
? 1.0F / Director::getInstance()->getAnimationInterval()
|
||||||
1.0F / Director::getInstance()->getAnimationInterval() : frameRate;
|
: frameRate;
|
||||||
auto delta = 1.0F / frameRate;
|
auto delta = 1.0F / frameRate;
|
||||||
if (seconds > delta)
|
if (seconds > delta)
|
||||||
{
|
{
|
||||||
while (seconds > 0.0F)
|
while (seconds > 0.0F)
|
||||||
|
@ -1459,8 +1457,11 @@ void ParticleSystem::update(float dt)
|
||||||
{
|
{
|
||||||
_fixedFPSDelta += dt;
|
_fixedFPSDelta += dt;
|
||||||
if (_fixedFPSDelta < 1.0F / _fixedFPS)
|
if (_fixedFPSDelta < 1.0F / _fixedFPS)
|
||||||
|
{
|
||||||
|
CC_PROFILER_STOP_CATEGORY(kProfilerCategoryParticles, "CCParticleSystem - update");
|
||||||
return;
|
return;
|
||||||
dt = _fixedFPSDelta;
|
}
|
||||||
|
dt = _fixedFPSDelta;
|
||||||
_fixedFPSDelta = 0.0F;
|
_fixedFPSDelta = 0.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,8 @@ enum class EmissionShapeType
|
||||||
RECTTORUS,
|
RECTTORUS,
|
||||||
CIRCLE,
|
CIRCLE,
|
||||||
TORUS,
|
TORUS,
|
||||||
|
CONE,
|
||||||
|
CONETORUS,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,10 +97,10 @@ Structure that contains animation description
|
||||||
*/
|
*/
|
||||||
struct ParticleAnimationDescriptor
|
struct ParticleAnimationDescriptor
|
||||||
{
|
{
|
||||||
float animationSpeed;
|
float animationSpeed;
|
||||||
float animationSpeedVariance;
|
float animationSpeedVariance;
|
||||||
std::vector<unsigned short> animationIndices;
|
std::vector<unsigned short> animationIndices;
|
||||||
bool reverseIndices;
|
bool reverseIndices;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @struct ParticleFrameDescriptor
|
/** @struct ParticleFrameDescriptor
|
||||||
|
@ -107,7 +109,7 @@ Structure that contains frame description
|
||||||
struct ParticleFrameDescriptor
|
struct ParticleFrameDescriptor
|
||||||
{
|
{
|
||||||
cocos2d::Rect rect;
|
cocos2d::Rect rect;
|
||||||
bool isRotated;
|
bool isRotated;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CC_DLL ParticleData
|
class CC_DLL ParticleData
|
||||||
|
@ -228,7 +230,7 @@ public:
|
||||||
animCellIndex[p1] = animCellIndex[p2];
|
animCellIndex[p1] = animCellIndex[p2];
|
||||||
}
|
}
|
||||||
|
|
||||||
atlasIndex[p1] = atlasIndex[p2];
|
atlasIndex[p1] = atlasIndex[p2];
|
||||||
|
|
||||||
modeA.dirX[p1] = modeA.dirX[p2];
|
modeA.dirX[p1] = modeA.dirX[p2];
|
||||||
modeA.dirY[p1] = modeA.dirY[p2];
|
modeA.dirY[p1] = modeA.dirY[p2];
|
||||||
|
@ -318,9 +320,9 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** TexAnimDir
|
/** TexAnimDir
|
||||||
Texture animation direction for the particles.
|
Texture animation direction for the particles.
|
||||||
*/
|
*/
|
||||||
enum class TexAnimDir
|
enum class TexAnimDir
|
||||||
{
|
{
|
||||||
VERTICAL, /** texture coordinates are read top to bottom within the texture */
|
VERTICAL, /** texture coordinates are read top to bottom within the texture */
|
||||||
|
@ -913,53 +915,61 @@ public:
|
||||||
void setSpawnAngleVar(float angle) { _spawnAngleVar = angle; }
|
void setSpawnAngleVar(float angle) { _spawnAngleVar = angle; }
|
||||||
|
|
||||||
/** Gets the spawn opacity fade in time of each particle.
|
/** Gets the spawn opacity fade in time of each particle.
|
||||||
* Particles have the ability to spawn while having 0 opacity and gradually start going to 255 opacity with a specified time.
|
* Particles have the ability to spawn while having 0 opacity and gradually start going to 255 opacity with a
|
||||||
|
specified time.
|
||||||
|
|
||||||
* @return The spawn opacity fade in time in seconds.
|
* @return The spawn opacity fade in time in seconds.
|
||||||
*/
|
*/
|
||||||
float getSpawnFadeIn() { return _spawnFadeIn; }
|
float getSpawnFadeIn() { return _spawnFadeIn; }
|
||||||
/** Sets the spawn opacity fade in time of each particle when it's created.
|
/** Sets the spawn opacity fade in time of each particle when it's created.
|
||||||
* Particles have the ability to spawn while having 0 opacity and gradually start going to 255 opacity with a specified time.
|
* Particles have the ability to spawn while having 0 opacity and gradually start going to 255 opacity with a
|
||||||
*
|
* specified time.
|
||||||
|
*
|
||||||
* @param time The spawn opacity fade in time in seconds.
|
* @param time The spawn opacity fade in time in seconds.
|
||||||
*/
|
*/
|
||||||
void setSpawnFadeIn(float time);
|
void setSpawnFadeIn(float time);
|
||||||
|
|
||||||
/** Gets the spawn opacity fade in time variance of each particle.
|
/** Gets the spawn opacity fade in time variance of each particle.
|
||||||
* Particles have the ability to spawn while having 0 opacity and gradually start going to 255 opacity with a specified time.
|
* Particles have the ability to spawn while having 0 opacity and gradually start going to 255 opacity with a
|
||||||
*
|
* specified time.
|
||||||
|
*
|
||||||
* @return The spawn opacity fade in time variance in seconds.
|
* @return The spawn opacity fade in time variance in seconds.
|
||||||
*/
|
*/
|
||||||
float getSpawnFadeInVar() { return _spawnFadeInVar; }
|
float getSpawnFadeInVar() { return _spawnFadeInVar; }
|
||||||
/** Sets the spawn opacity fade in time variance of each particle when it's created.
|
/** Sets the spawn opacity fade in time variance of each particle when it's created.
|
||||||
* Particles have the ability to spawn while having 0 opacity and gradually start going to 255 opacity with a specified time.
|
* Particles have the ability to spawn while having 0 opacity and gradually start going to 255 opacity with a
|
||||||
*
|
* specified time.
|
||||||
|
*
|
||||||
* @param time The spawn opacity fade in time variance in seconds.
|
* @param time The spawn opacity fade in time variance in seconds.
|
||||||
*/
|
*/
|
||||||
void setSpawnFadeInVar(float time);
|
void setSpawnFadeInVar(float time);
|
||||||
|
|
||||||
/** Gets the spawn opacity fade in time of each particle.
|
/** Gets the spawn opacity fade in time of each particle.
|
||||||
* Particles have the ability to spawn while having 0.0 size and gradually start going to 1.0 size with a specified time.
|
* Particles have the ability to spawn while having 0.0 size and gradually start going to 1.0 size with a specified
|
||||||
*
|
* time.
|
||||||
|
*
|
||||||
* @return The spawn opacity fade in time in seconds.
|
* @return The spawn opacity fade in time in seconds.
|
||||||
*/
|
*/
|
||||||
float getSpawnScaleIn() { return _spawnScaleIn; }
|
float getSpawnScaleIn() { return _spawnScaleIn; }
|
||||||
/** Sets the spawn opacity fade in time of each particle when it's created.
|
/** Sets the spawn opacity fade in time of each particle when it's created.
|
||||||
* Particles have the ability to spawn while having 0.0 size and gradually start going to 1.0 size with a specified time.
|
* Particles have the ability to spawn while having 0.0 size and gradually start going to 1.0 size with a specified
|
||||||
*
|
* time.
|
||||||
|
*
|
||||||
* @param time The spawn opacity fade in time in seconds.
|
* @param time The spawn opacity fade in time in seconds.
|
||||||
*/
|
*/
|
||||||
void setSpawnScaleIn(float time);
|
void setSpawnScaleIn(float time);
|
||||||
|
|
||||||
/** Gets the spawn opacity fade in time variance of each particle.
|
/** Gets the spawn opacity fade in time variance of each particle.
|
||||||
* Particles have the ability to spawn while having 0.0 size and gradually start going to 1.0 size with a specified time.
|
* Particles have the ability to spawn while having 0.0 size and gradually start going to 1.0 size with a specified
|
||||||
*
|
* time.
|
||||||
|
*
|
||||||
* @return The spawn opacity fade in time variance in seconds.
|
* @return The spawn opacity fade in time variance in seconds.
|
||||||
*/
|
*/
|
||||||
float getSpawnScaleInVar() { return _spawnScaleInVar; }
|
float getSpawnScaleInVar() { return _spawnScaleInVar; }
|
||||||
/** Sets the spawn opacity fade in time variance of each particle when it's created.
|
/** Sets the spawn opacity fade in time variance of each particle when it's created.
|
||||||
* Particles have the ability to spawn while having 0.0 size and gradually start going to 1.0 size with a specified time.
|
* Particles have the ability to spawn while having 0.0 size and gradually start going to 1.0 size with a specified
|
||||||
*
|
* time.
|
||||||
|
*
|
||||||
* @param time The spawn opacity fade in time variance in seconds.
|
* @param time The spawn opacity fade in time variance in seconds.
|
||||||
*/
|
*/
|
||||||
void setSpawnScaleInVar(float time);
|
void setSpawnScaleInVar(float time);
|
||||||
|
@ -996,17 +1006,18 @@ public:
|
||||||
/** Enables or disables tex coord animations that are set by the emitter randomly when a particle is emitted. */
|
/** Enables or disables tex coord animations that are set by the emitter randomly when a particle is emitted. */
|
||||||
void setEmitterAnimation(bool enabled);
|
void setEmitterAnimation(bool enabled);
|
||||||
|
|
||||||
/** Enables or disables tex coord animations that are used to make particles play a sequence forever until they die */
|
/** Enables or disables tex coord animations that are used to make particles play a sequence forever until they die
|
||||||
|
*/
|
||||||
void setLoopAnimation(bool enabled);
|
void setLoopAnimation(bool enabled);
|
||||||
|
|
||||||
bool isLifeAnimated() { return _isLifeAnimated; }
|
bool isLifeAnimated() { return _isLifeAnimated; }
|
||||||
bool isEmitterAnimated() { return _isEmitterAnimated; }
|
bool isEmitterAnimated() { return _isEmitterAnimated; }
|
||||||
bool isLoopAnimated() { return _isLoopAnimated; }
|
bool isLoopAnimated() { return _isLoopAnimated; }
|
||||||
|
|
||||||
/** Gets the total number of indices.
|
/** Gets the total number of indices.
|
||||||
*
|
*
|
||||||
* @return The size of the list holding animation indices.
|
* @return The size of the list holding animation indices.
|
||||||
*/
|
*/
|
||||||
int getTotalAnimationIndices() { return _animIndexCount; }
|
int getTotalAnimationIndices() { return _animIndexCount; }
|
||||||
|
|
||||||
/** Sets wether to start from first cell and go forwards (normal) or last cell and go backwards (reversed) */
|
/** Sets wether to start from first cell and go forwards (normal) or last cell and go backwards (reversed) */
|
||||||
|
@ -1020,96 +1031,100 @@ public:
|
||||||
void resetAnimationDescriptors();
|
void resetAnimationDescriptors();
|
||||||
|
|
||||||
/** Choose what animation descriptors are to be selected at random for particles.
|
/** Choose what animation descriptors are to be selected at random for particles.
|
||||||
* This function should be called after you've inserted/overwritten any animation descriptors.
|
* This function should be called after you've inserted/overwritten any animation descriptors.
|
||||||
*
|
*
|
||||||
* @param animations Array of specific indices of animations to play at random
|
* @param animations Array of specific indices of animations to play at random
|
||||||
*/
|
*/
|
||||||
void setMultiAnimationRandomSpecific(const std::vector<unsigned short> &animations) { _randomAnimations = animations; };
|
void setMultiAnimationRandomSpecific(const std::vector<unsigned short>& animations)
|
||||||
|
{
|
||||||
|
_randomAnimations = animations;
|
||||||
|
};
|
||||||
|
|
||||||
/** Choose ALL animation descriptors to be selected at random for particles.
|
/** Choose ALL animation descriptors to be selected at random for particles.
|
||||||
* This function should be called after you've inserted/overwritten any animation descriptors.
|
* This function should be called after you've inserted/overwritten any animation descriptors.
|
||||||
*/
|
*/
|
||||||
void setMultiAnimationRandom();
|
void setMultiAnimationRandom();
|
||||||
|
|
||||||
/** Add all particle animation indices based on cells size and direction spicified using a texture atlas.
|
/** Add all particle animation indices based on cells size and direction spicified using a texture atlas.
|
||||||
* will erase the array and add new indices from the atlas.
|
* will erase the array and add new indices from the atlas.
|
||||||
* This function will automatically figure out your atlas cell size and direction for you! thank her later :) */
|
* This function will automatically figure out your atlas cell size and direction for you! thank her later :) */
|
||||||
void setAnimationIndicesAtlas();
|
void setAnimationIndicesAtlas();
|
||||||
|
|
||||||
/** Add all particle animation indices based on cell size and direction spicified if the method of rendering preferred is texture atlas.
|
/** Add all particle animation indices based on cell size and direction spicified if the method of rendering
|
||||||
* will erase the array and add new indices from the atlas.
|
* preferred is texture atlas. will erase the array and add new indices from the atlas.
|
||||||
*
|
*
|
||||||
* @param unifiedCellSize The size of cell unified.
|
* @param unifiedCellSize The size of cell unified.
|
||||||
* @param direction What direction is the atlas
|
* @param direction What direction is the atlas
|
||||||
*/
|
*/
|
||||||
void setAnimationIndicesAtlas(unsigned int unifiedCellSize, TexAnimDir direction = TexAnimDir::HORIZONTAL);
|
void setAnimationIndicesAtlas(unsigned int unifiedCellSize, TexAnimDir direction = TexAnimDir::HORIZONTAL);
|
||||||
|
|
||||||
/** Add a particle animation index based on tex coords spicified using a sprite frame.
|
/** Add a particle animation index based on tex coords spicified using a sprite frame.
|
||||||
* The index is automatically incremented on each addition.
|
* The index is automatically incremented on each addition.
|
||||||
*
|
*
|
||||||
* @param frameName SpriteFrame name to search for
|
* @param frameName SpriteFrame name to search for
|
||||||
*
|
*
|
||||||
* @return Returns true of the index was successfully found and added. Otherwise, false
|
* @return Returns true of the index was successfully found and added. Otherwise, false
|
||||||
*/
|
*/
|
||||||
bool addAnimationIndex(std::string_view frameName);
|
bool addAnimationIndex(std::string_view frameName);
|
||||||
|
|
||||||
/** Add a particle animation index based on tex coords spicified using a sprite frame.
|
/** Add a particle animation index based on tex coords spicified using a sprite frame.
|
||||||
*
|
*
|
||||||
* @param index Index id to add the frame to or override it with the new frame
|
* @param index Index id to add the frame to or override it with the new frame
|
||||||
* @param frameName SpriteFrame name to search for
|
* @param frameName SpriteFrame name to search for
|
||||||
*
|
*
|
||||||
* @return Returns true of the index was successfully found and added. Otherwise, false
|
* @return Returns true of the index was successfully found and added. Otherwise, false
|
||||||
*/
|
*/
|
||||||
bool addAnimationIndex(unsigned short index, std::string_view frameName);
|
bool addAnimationIndex(unsigned short index, std::string_view frameName);
|
||||||
|
|
||||||
/** Add a particle animation index based on tex coords spicified using a sprite frame.
|
/** Add a particle animation index based on tex coords spicified using a sprite frame.
|
||||||
* The index is automatically incremented on each addition.
|
* The index is automatically incremented on each addition.
|
||||||
*
|
*
|
||||||
* @param frame SpriteFrame containting data about tex coords
|
* @param frame SpriteFrame containting data about tex coords
|
||||||
*
|
*
|
||||||
* @return Returns true of the index was successfully found and added. Otherwise, false
|
* @return Returns true of the index was successfully found and added. Otherwise, false
|
||||||
*/
|
*/
|
||||||
bool addAnimationIndex(cocos2d::SpriteFrame* frame);
|
bool addAnimationIndex(cocos2d::SpriteFrame* frame);
|
||||||
|
|
||||||
/** Add a particle animation index based on tex coords spicified using a sprite frame.
|
/** Add a particle animation index based on tex coords spicified using a sprite frame.
|
||||||
* you can specify which index you want to override in this function
|
* you can specify which index you want to override in this function
|
||||||
*
|
*
|
||||||
* @param index Index id to add the frame to or override it with the new frame
|
* @param index Index id to add the frame to or override it with the new frame
|
||||||
* @param frame SpriteFrame containting data about tex coords
|
* @param frame SpriteFrame containting data about tex coords
|
||||||
*
|
*
|
||||||
* @return Returns true of the index was successfully found and added. Otherwise, false
|
* @return Returns true of the index was successfully found and added. Otherwise, false
|
||||||
*/
|
*/
|
||||||
bool addAnimationIndex(unsigned short index, cocos2d::SpriteFrame* frame);
|
bool addAnimationIndex(unsigned short index, cocos2d::SpriteFrame* frame);
|
||||||
|
|
||||||
/** Add a particle animation index based on tex coords spicified.
|
/** Add a particle animation index based on tex coords spicified.
|
||||||
* you can specify which index you want to override in this function
|
* you can specify which index you want to override in this function
|
||||||
*
|
*
|
||||||
* @param index Index id to add the frame to or override it with the new rect
|
* @param index Index id to add the frame to or override it with the new rect
|
||||||
* @param rect Rect containting data about tex coords in pixels
|
* @param rect Rect containting data about tex coords in pixels
|
||||||
* @param rotated Not implemented.
|
* @param rotated Not implemented.
|
||||||
*
|
*
|
||||||
* @return Returns true of the index was successfully found and added. Otherwise, false
|
* @return Returns true of the index was successfully found and added. Otherwise, false
|
||||||
*/
|
*/
|
||||||
bool addAnimationIndex(unsigned short index, cocos2d::Rect rect, bool rotated = false);
|
bool addAnimationIndex(unsigned short index, cocos2d::Rect rect, bool rotated = false);
|
||||||
|
|
||||||
/** You can specify what rect is used if an index in an animation descriptor wasn't found.
|
/** You can specify what rect is used if an index in an animation descriptor wasn't found.
|
||||||
*
|
*
|
||||||
* @param rect Rect containting data about tex coords in pixels
|
* @param rect Rect containting data about tex coords in pixels
|
||||||
*/
|
*/
|
||||||
void setRectForUndefinedIndices(cocos2d::Rect rect) { _undefinedIndexRect = rect; };
|
void setRectForUndefinedIndices(cocos2d::Rect rect) { _undefinedIndexRect = rect; };
|
||||||
|
|
||||||
/** Add a particle animation descriptor with an index.
|
/** Add a particle animation descriptor with an index.
|
||||||
*
|
*
|
||||||
* @param indexOfDescriptor Index of the animation to be added, adding to the same index will just override the pervious animation descriptor
|
* @param indexOfDescriptor Index of the animation to be added, adding to the same index will just override the
|
||||||
* @param time length of the animation in seconds
|
* pervious animation descriptor
|
||||||
* @param timeVariance Time randomly selected for each different particle added on the animation length
|
* @param time length of the animation in seconds
|
||||||
* @param indices An array of the indicies
|
* @param timeVariance Time randomly selected for each different particle added on the animation length
|
||||||
* @param reverse Should the animation indicies be played backwards? (default: false)
|
* @param indices An array of the indicies
|
||||||
*/
|
* @param reverse Should the animation indicies be played backwards? (default: false)
|
||||||
|
*/
|
||||||
void setAnimationDescriptor(unsigned short indexOfDescriptor,
|
void setAnimationDescriptor(unsigned short indexOfDescriptor,
|
||||||
float time,
|
float time,
|
||||||
float timeVariance,
|
float timeVariance,
|
||||||
const std::vector<unsigned short> &indices,
|
const std::vector<unsigned short>& indices,
|
||||||
bool reverse = false);
|
bool reverse = false);
|
||||||
|
|
||||||
/** Add a particle animation descriptor with the index 0.
|
/** Add a particle animation descriptor with the index 0.
|
||||||
|
@ -1117,7 +1132,7 @@ public:
|
||||||
* @param indices An array of the indicies
|
* @param indices An array of the indicies
|
||||||
* @param reverse Should the animation indicies be played backwards? (default: false)
|
* @param reverse Should the animation indicies be played backwards? (default: false)
|
||||||
*/
|
*/
|
||||||
void setAnimationDescriptor(const std::vector<unsigned short> &indices, bool reverse = false)
|
void setAnimationDescriptor(const std::vector<unsigned short>& indices, bool reverse = false)
|
||||||
{
|
{
|
||||||
setAnimationDescriptor(0, 0, 0, indices, reverse);
|
setAnimationDescriptor(0, 0, 0, indices, reverse);
|
||||||
};
|
};
|
||||||
|
@ -1146,13 +1161,19 @@ public:
|
||||||
void addEmissionShapeRectTorus(Vec2 pos, Size innerSize, Size outerSize);
|
void addEmissionShapeRectTorus(Vec2 pos, Size innerSize, Size outerSize);
|
||||||
|
|
||||||
/** Adds an emission shape of type Circle to the system.
|
/** Adds an emission shape of type Circle to the system.
|
||||||
* @param edgeElasticity If the value is greater than 1.0 then particles will bias towards the edge of the circle more often the greater the value is; If the value is lower than 1.0 then particles will bias towards the center of the circle more often the closer the value is to 0.0; If the value is exactly 1.0 then there will be no bias behaviour.
|
* @param edgeElasticity If the value is greater than 1.0 then particles will bias towards the edge of the circle
|
||||||
*/
|
* more often the greater the value is; If the value is lower than 1.0 then particles will bias towards the center
|
||||||
|
* of the circle more often the closer the value is to 0.0; If the value is exactly 1.0 then there will be no bias
|
||||||
|
* behaviour.
|
||||||
|
*/
|
||||||
void addEmissionShapeCircle(Vec2 pos, float radius, float edgeElasticity = 1.0F);
|
void addEmissionShapeCircle(Vec2 pos, float radius, float edgeElasticity = 1.0F);
|
||||||
|
|
||||||
/** Adds an emission shape of type Torus to the system.
|
/** Adds an emission shape of type Torus to the system.
|
||||||
* @param edgeElasticity If the value is greater than 1.0 then particles will bias towards the edge of the torus more often the greater the value is; If the value is lower than 1.0 then particles will bias towards the inner radius of the torus more often the closer the value is to 0.0; If the value is exactly 1.0 then there will be no bias behaviour.
|
* @param edgeElasticity If the value is greater than 1.0 then particles will bias towards the edge of the torus
|
||||||
*/
|
* more often the greater the value is; If the value is lower than 1.0 then particles will bias towards the inner
|
||||||
|
* radius of the torus more often the closer the value is to 0.0; If the value is exactly 1.0 then there will be no
|
||||||
|
* bias behaviour.
|
||||||
|
*/
|
||||||
void addEmissionShapeTorus(Vec2 pos, float innerRadius, float outerRadius, float edgeElasticity = 1.0F);
|
void addEmissionShapeTorus(Vec2 pos, float innerRadius, float outerRadius, float edgeElasticity = 1.0F);
|
||||||
|
|
||||||
/** Gets the particles movement type: Free or Grouped.
|
/** Gets the particles movement type: Free or Grouped.
|
||||||
|
@ -1171,16 +1192,20 @@ public:
|
||||||
/** Advance the particle system and make it seem like it ran for this many seconds.
|
/** Advance the particle system and make it seem like it ran for this many seconds.
|
||||||
*
|
*
|
||||||
* @param seconds Seconds to advance. value of -1 means (SIMULATION_USE_PARTICLE_LIFETIME)
|
* @param seconds Seconds to advance. value of -1 means (SIMULATION_USE_PARTICLE_LIFETIME)
|
||||||
* @param frameRate Frame rate to run the simulation with (preferred: 30.0) The higher this value is the more accurate the simulation will be at the cost of performance. value of -1 means (SIMULATION_USE_GAME_ANIMATION_INTERVAL)
|
* @param frameRate Frame rate to run the simulation with (preferred: 30.0) The higher this value is the more
|
||||||
|
* accurate the simulation will be at the cost of performance. value of -1 means
|
||||||
|
* (SIMULATION_USE_GAME_ANIMATION_INTERVAL)
|
||||||
*/
|
*/
|
||||||
void simulate(float seconds = SIMULATION_USE_PARTICLE_LIFETIME,
|
void simulate(float seconds = SIMULATION_USE_PARTICLE_LIFETIME,
|
||||||
float frameRate = SIMULATION_USE_GAME_ANIMATION_INTERVAL);
|
float frameRate = SIMULATION_USE_GAME_ANIMATION_INTERVAL);
|
||||||
|
|
||||||
/** Resets the particle system and then advances the particle system and make it seem like it ran for this many
|
/** Resets the particle system and then advances the particle system and make it seem like it ran for this many
|
||||||
* seconds. The frame rate used for simulation accuracy is the screens refresh rate.
|
* seconds. The frame rate used for simulation accuracy is the screens refresh rate.
|
||||||
*
|
*
|
||||||
* @param seconds Seconds to advance. value of -1 means (SIMULATION_USE_PARTICLE_LIFETIME)
|
* @param seconds Seconds to advance. value of -1 means (SIMULATION_USE_PARTICLE_LIFETIME)
|
||||||
* @param frameRate Frame rate to run the simulation with (preferred: 30.0) The higher this value is the more accurate the simulation will be at the cost of performance. value of -1 means (SIMULATION_USE_GAME_ANIMATION_INTERVAL)
|
* @param frameRate Frame rate to run the simulation with (preferred: 30.0) The higher this value is the more
|
||||||
|
* accurate the simulation will be at the cost of performance. value of -1 means
|
||||||
|
* (SIMULATION_USE_GAME_ANIMATION_INTERVAL)
|
||||||
*/
|
*/
|
||||||
void resimulate(float seconds = SIMULATION_USE_PARTICLE_LIFETIME,
|
void resimulate(float seconds = SIMULATION_USE_PARTICLE_LIFETIME,
|
||||||
float frameRate = SIMULATION_USE_GAME_ANIMATION_INTERVAL);
|
float frameRate = SIMULATION_USE_GAME_ANIMATION_INTERVAL);
|
||||||
|
@ -1279,6 +1304,9 @@ public:
|
||||||
virtual float getFixedFPS();
|
virtual float getFixedFPS();
|
||||||
|
|
||||||
/** Sets the fixed frame rate count of the particle system.
|
/** Sets the fixed frame rate count of the particle system.
|
||||||
|
* i.e. if the framerate is set to 30.0 while the refresh rate is greater than 30.0 then the particle system will
|
||||||
|
wait until it hits the 30.0 FPS mark.
|
||||||
|
* This is usefull for increasing performance or for creating old-school effects with it.
|
||||||
@param Fixed frame rate count of the particle system. (default: 0.0)
|
@param Fixed frame rate count of the particle system. (default: 0.0)
|
||||||
*/
|
*/
|
||||||
virtual void setFixedFPS(float frameRate = 0.0F);
|
virtual void setFixedFPS(float frameRate = 0.0F);
|
||||||
|
|
|
@ -106,7 +106,9 @@ ParticleSystemQuad* ParticleSystemQuad::create(std::string_view filename)
|
||||||
|
|
||||||
ParticleSystemQuad* ParticleSystemQuad::createWithTotalParticles(int numberOfParticles)
|
ParticleSystemQuad* ParticleSystemQuad::createWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
CCASSERT(numberOfParticles <= 10000, "Adding more than 10000 particles will crash the renderer, the mesh generated has an index format of U_SHORT (uint16_t)");
|
CCASSERT(numberOfParticles <= 10000,
|
||||||
|
"Adding more than 10000 particles will crash the renderer, the mesh generated has an index format of "
|
||||||
|
"U_SHORT (uint16_t)");
|
||||||
|
|
||||||
ParticleSystemQuad* ret = new ParticleSystemQuad();
|
ParticleSystemQuad* ret = new ParticleSystemQuad();
|
||||||
if (ret->initWithTotalParticles(numberOfParticles))
|
if (ret->initWithTotalParticles(numberOfParticles))
|
||||||
|
@ -293,7 +295,7 @@ inline void updatePosWithParticle(V3F_C4B_T2F_Quad* quad,
|
||||||
float x = newPosition.x;
|
float x = newPosition.x;
|
||||||
float y = newPosition.y;
|
float y = newPosition.y;
|
||||||
|
|
||||||
float r = (float)-CC_DEGREES_TO_RADIANS(rotation + staticRotation);
|
float r = (float)-CC_DEGREES_TO_RADIANS(rotation + staticRotation);
|
||||||
float cr = cosf(r);
|
float cr = cosf(r);
|
||||||
float sr = sinf(r);
|
float sr = sinf(r);
|
||||||
float ax = x1 * cr - y1 * sr + x;
|
float ax = x1 * cr - y1 * sr + x;
|
||||||
|
@ -359,19 +361,20 @@ void ParticleSystemQuad::updateParticleQuads()
|
||||||
worldToNodeTM.transformPoint(&p1);
|
worldToNodeTM.transformPoint(&p1);
|
||||||
Vec3 p2;
|
Vec3 p2;
|
||||||
Vec2 newPos;
|
Vec2 newPos;
|
||||||
float* startX = _particleData.startPosX;
|
float* startX = _particleData.startPosX;
|
||||||
float* startY = _particleData.startPosY;
|
float* startY = _particleData.startPosY;
|
||||||
float* x = _particleData.posx;
|
float* x = _particleData.posx;
|
||||||
float* y = _particleData.posy;
|
float* y = _particleData.posy;
|
||||||
float* s = _particleData.size;
|
float* s = _particleData.size;
|
||||||
float* r = _particleData.rotation;
|
float* r = _particleData.rotation;
|
||||||
float* sr = _particleData.staticRotation;
|
float* sr = _particleData.staticRotation;
|
||||||
float* sid = _particleData.scaleInDelta;
|
float* sid = _particleData.scaleInDelta;
|
||||||
float* sil = _particleData.scaleInLength;
|
float* sil = _particleData.scaleInLength;
|
||||||
V3F_C4B_T2F_Quad* quadStart = startQuad;
|
V3F_C4B_T2F_Quad* quadStart = startQuad;
|
||||||
if (_isScaleInAllocated)
|
if (_isScaleInAllocated)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _particleCount; ++i, ++startX, ++startY, ++x, ++y, ++quadStart, ++s, ++r, ++sr, ++sid, ++sil)
|
for (int i = 0; i < _particleCount;
|
||||||
|
++i, ++startX, ++startY, ++x, ++y, ++quadStart, ++s, ++r, ++sr, ++sid, ++sil)
|
||||||
{
|
{
|
||||||
p2.set(*startX, *startY, 0);
|
p2.set(*startX, *startY, 0);
|
||||||
worldToNodeTM.transformPoint(&p2);
|
worldToNodeTM.transformPoint(&p2);
|
||||||
|
@ -411,7 +414,8 @@ void ParticleSystemQuad::updateParticleQuads()
|
||||||
V3F_C4B_T2F_Quad* quadStart = startQuad;
|
V3F_C4B_T2F_Quad* quadStart = startQuad;
|
||||||
if (_isScaleInAllocated)
|
if (_isScaleInAllocated)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _particleCount; ++i, ++startX, ++startY, ++x, ++y, ++quadStart, ++s, ++r, ++sr, ++sid, ++sil)
|
for (int i = 0; i < _particleCount;
|
||||||
|
++i, ++startX, ++startY, ++x, ++y, ++quadStart, ++s, ++r, ++sr, ++sid, ++sil)
|
||||||
{
|
{
|
||||||
newPos.set(*x, *y);
|
newPos.set(*x, *y);
|
||||||
newPos.x = *x - (currentPosition.x - *startX);
|
newPos.x = *x - (currentPosition.x - *startX);
|
||||||
|
@ -447,7 +451,8 @@ void ParticleSystemQuad::updateParticleQuads()
|
||||||
V3F_C4B_T2F_Quad* quadStart = startQuad;
|
V3F_C4B_T2F_Quad* quadStart = startQuad;
|
||||||
if (_isScaleInAllocated)
|
if (_isScaleInAllocated)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _particleCount; ++i, ++startX, ++startY, ++x, ++y, ++quadStart, ++s, ++r, ++sr, ++sid, ++sil)
|
for (int i = 0; i < _particleCount;
|
||||||
|
++i, ++startX, ++startY, ++x, ++y, ++quadStart, ++s, ++r, ++sr, ++sid, ++sil)
|
||||||
{
|
{
|
||||||
newPos.set(*x + pos.x, *y + pos.y);
|
newPos.set(*x + pos.x, *y + pos.y);
|
||||||
updatePosWithParticle(quadStart, newPos, *s, tweenfunc::expoEaseOut(*sid / *sil), *r, *sr);
|
updatePosWithParticle(quadStart, newPos, *s, tweenfunc::expoEaseOut(*sid / *sil), *r, *sr);
|
||||||
|
@ -573,8 +578,7 @@ void ParticleSystemQuad::updateParticleQuads()
|
||||||
if (_opacityModifyRGB)
|
if (_opacityModifyRGB)
|
||||||
{
|
{
|
||||||
auto hsv = HSV();
|
auto hsv = HSV();
|
||||||
for (int i = 0; i < _particleCount;
|
for (int i = 0; i < _particleCount; ++i, ++quad, ++r, ++g, ++b, ++a, ++hue, ++sat, ++val)
|
||||||
++i, ++quad, ++r, ++g, ++b, ++a, ++hue, ++sat, ++val)
|
|
||||||
{
|
{
|
||||||
float colorR = *r;
|
float colorR = *r;
|
||||||
float colorG = *g;
|
float colorG = *g;
|
||||||
|
@ -582,8 +586,8 @@ void ParticleSystemQuad::updateParticleQuads()
|
||||||
float colorA = *a;
|
float colorA = *a;
|
||||||
hsv.set(colorR, colorG, colorB, colorA);
|
hsv.set(colorR, colorG, colorB, colorA);
|
||||||
hsv.h += *hue;
|
hsv.h += *hue;
|
||||||
hsv.s = abs(*sat);
|
hsv.s = abs(*sat);
|
||||||
hsv.v = abs(*val);
|
hsv.v = abs(*val);
|
||||||
auto colF = hsv.toColor4F();
|
auto colF = hsv.toColor4F();
|
||||||
quad->bl.colors.set(colF.r * colF.a * 255.0F, colF.g * colF.a * 255.0F, colF.b * colF.a * 255.0F,
|
quad->bl.colors.set(colF.r * colF.a * 255.0F, colF.g * colF.a * 255.0F, colF.b * colF.a * 255.0F,
|
||||||
colF.a * 255.0F);
|
colF.a * 255.0F);
|
||||||
|
@ -598,8 +602,7 @@ void ParticleSystemQuad::updateParticleQuads()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto hsv = HSV();
|
auto hsv = HSV();
|
||||||
for (int i = 0; i < _particleCount;
|
for (int i = 0; i < _particleCount; ++i, ++quad, ++r, ++g, ++b, ++a, ++hue, ++sat, ++val)
|
||||||
++i, ++quad, ++r, ++g, ++b, ++a, ++hue, ++sat, ++val)
|
|
||||||
{
|
{
|
||||||
float colorR = *r;
|
float colorR = *r;
|
||||||
float colorG = *g;
|
float colorG = *g;
|
||||||
|
|
Loading…
Reference in New Issue