本文整理汇总了C++中ParticleEmitter::setRotationPerParticle方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleEmitter::setRotationPerParticle方法的具体用法?C++ ParticleEmitter::setRotationPerParticle怎么用?C++ ParticleEmitter::setRotationPerParticle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleEmitter
的用法示例。
在下文中一共展示了ParticleEmitter::setRotationPerParticle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
//.........这里部分代码省略.........
const char* texturePath = sprite->getString("path");
if (!texturePath || strlen(texturePath) == 0)
{
GP_ERROR("Failed to load particle emitter: required image file path ('path') is missing.");
return NULL;
}
const char* blendingString = sprite->getString("blending");
TextureBlending textureBlending = getTextureBlendingFromString(blendingString);
int spriteWidth = sprite->getInt("width");
int spriteHeight = sprite->getInt("height");
bool spriteAnimated = sprite->getBool("animated");
bool spriteLooped = sprite->getBool("looped");
int spriteFrameCount = sprite->getInt("frameCount");
int spriteFrameRandomOffset = sprite->getInt("frameRandomOffset");
float spriteFrameDuration = sprite->getFloat("frameDuration");
// Emitter properties.
unsigned int particleCountMax = (unsigned int)properties->getInt("particleCountMax");
if (particleCountMax == 0)
{
// Set sensible default.
particleCountMax = PARTICLE_COUNT_MAX;
}
unsigned int emissionRate = (unsigned int)properties->getInt("emissionRate");
if (emissionRate == 0)
{
emissionRate = PARTICLE_EMISSION_RATE;
}
bool ellipsoid = properties->getBool("ellipsoid");
float sizeStartMin = properties->getFloat("sizeStartMin");
float sizeStartMax = properties->getFloat("sizeStartMax");
float sizeEndMin = properties->getFloat("sizeEndMin");
float sizeEndMax = properties->getFloat("sizeEndMax");
long energyMin = properties->getLong("energyMin");
long energyMax = properties->getLong("energyMax");
Vector4 colorStart;
Vector4 colorStartVar;
Vector4 colorEnd;
Vector4 colorEndVar;
properties->getVector4("colorStart", &colorStart);
properties->getVector4("colorStartVar", &colorStartVar);
properties->getVector4("colorEnd", &colorEnd);
properties->getVector4("colorEndVar", &colorEndVar);
Vector3 position;
Vector3 positionVar;
Vector3 velocity;
Vector3 velocityVar;
Vector3 acceleration;
Vector3 accelerationVar;
Vector3 rotationAxis;
Vector3 rotationAxisVar;
properties->getVector3("position", &position);
properties->getVector3("positionVar", &positionVar);
properties->getVector3("velocity", &velocity);
properties->getVector3("velocityVar", &velocityVar);
properties->getVector3("acceleration", &acceleration);
properties->getVector3("accelerationVar", &accelerationVar);
float rotationPerParticleSpeedMin = properties->getFloat("rotationPerParticleSpeedMin");
float rotationPerParticleSpeedMax = properties->getFloat("rotationPerParticleSpeedMax");
float rotationSpeedMin = properties->getFloat("rotationSpeedMin");
float rotationSpeedMax = properties->getFloat("rotationSpeedMax");
properties->getVector3("rotationAxis", &rotationAxis);
properties->getVector3("rotationAxisVar", &rotationAxisVar);
bool orbitPosition = properties->getBool("orbitPosition");
bool orbitVelocity = properties->getBool("orbitVelocity");
bool orbitAcceleration = properties->getBool("orbitAcceleration");
// Apply all properties to a newly created ParticleEmitter.
ParticleEmitter* emitter = ParticleEmitter::create(texturePath, textureBlending, particleCountMax);
if (!emitter)
{
GP_ERROR("Failed to create particle emitter.");
return NULL;
}
emitter->setEmissionRate(emissionRate);
emitter->setEllipsoid(ellipsoid);
emitter->setSize(sizeStartMin, sizeStartMax, sizeEndMin, sizeEndMax);
emitter->setEnergy(energyMin, energyMax);
emitter->setColor(colorStart, colorStartVar, colorEnd, colorEndVar);
emitter->setPosition(position, positionVar);
emitter->setVelocity(velocity, velocityVar);
emitter->setAcceleration(acceleration, accelerationVar);
emitter->setRotationPerParticle(rotationPerParticleSpeedMin, rotationPerParticleSpeedMax);
emitter->setRotation(rotationSpeedMin, rotationSpeedMax, rotationAxis, rotationAxisVar);
emitter->setSpriteAnimated(spriteAnimated);
emitter->setSpriteLooped(spriteLooped);
emitter->setSpriteFrameRandomOffset(spriteFrameRandomOffset);
emitter->setSpriteFrameDuration(spriteFrameDuration);
emitter->setSpriteFrameCoords(spriteFrameCount, spriteWidth, spriteHeight);
emitter->setOrbit(orbitPosition, orbitVelocity, orbitAcceleration);
return emitter;
}
示例2: controlEvent
//.........这里部分代码省略.........
}
else if (control == _accelY)
{
Vector3 accel = emitter->getAcceleration();
accel.y = _accelY->getValue();
emitter->setAcceleration(accel, emitter->getAccelerationVariance());
}
else if (control == _accelZ)
{
Vector3 accel = emitter->getAcceleration();
accel.z = _accelZ->getValue();
emitter->setAcceleration(accel, emitter->getAccelerationVariance());
}
else if (control == _accelVarX)
{
Vector3 accelVar = emitter->getAccelerationVariance();
accelVar.x = _accelVarX->getValue();
emitter->setAcceleration(emitter->getAcceleration(), accelVar);
}
else if (control == _accelVarY)
{
Vector3 accelVar = emitter->getAccelerationVariance();
accelVar.y = _accelVarY->getValue();
emitter->setAcceleration(emitter->getAcceleration(), accelVar);
}
else if (control == _accelVarZ)
{
Vector3 accelVar = emitter->getAccelerationVariance();
accelVar.z = _accelVarZ->getValue();
emitter->setAcceleration(emitter->getAcceleration(), accelVar);
}
else if (control == _spinSpeedMin)
{
emitter->setRotationPerParticle(_spinSpeedMin->getValue(), emitter->getRotationPerParticleSpeedMax());
}
else if (control == _spinSpeedMax)
{
emitter->setRotationPerParticle(emitter->getRotationPerParticleSpeedMin(), _spinSpeedMax->getValue());
}
else if (control == _axisX)
{
Vector3 axis = emitter->getRotationAxis();
axis.x = _axisX->getValue();
emitter->setRotation(emitter->getRotationSpeedMin(), emitter->getRotationSpeedMax(), axis, emitter->getRotationAxisVariance());
}
else if (control == _axisY)
{
Vector3 axis = emitter->getRotationAxis();
axis.y = _axisY->getValue();
emitter->setRotation(emitter->getRotationSpeedMin(), emitter->getRotationSpeedMax(), axis, emitter->getRotationAxisVariance());
}
else if (control == _axisZ)
{
Vector3 axis = emitter->getRotationAxis();
axis.z = _axisZ->getValue();
emitter->setRotation(emitter->getRotationSpeedMin(), emitter->getRotationSpeedMax(), axis, emitter->getRotationAxisVariance());
}
else if (control == _axisVarX)
{
Vector3 axisVar = emitter->getRotationAxisVariance();
axisVar.x = _axisVarX->getValue();
emitter->setRotation(emitter->getRotationSpeedMin(), emitter->getRotationSpeedMax(), emitter->getRotationAxis(), axisVar);
}
else if (control == _axisVarY)
{
Vector3 axisVar = emitter->getRotationAxisVariance();