本文整理汇总了C++中ParticleEmitter::getAcceleration方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleEmitter::getAcceleration方法的具体用法?C++ ParticleEmitter::getAcceleration怎么用?C++ ParticleEmitter::getAcceleration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleEmitter
的用法示例。
在下文中一共展示了ParticleEmitter::getAcceleration方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveFile
void ParticlesGame::saveFile()
{
std::string filename;
filename = FileSystem::displayFileDialog(FileSystem::SAVE, "Save Particle File", "Particle Files", "particle", "res");
if (filename.length() == 0)
return;
ParticleEmitter* e = _particleEmitter;
// Extract just the particle name from the filename
std::string dir = FileSystem::getDirectoryName(filename.c_str());
std::string ext = FileSystem::getExtension(filename.c_str());
std::string name = filename.substr(dir.length(), filename.length() - dir.length() - ext.length());
Texture* texture = e->getTexture();
std::string texturePath = texture->getPath();
std::string textureDir = FileSystem::getDirectoryName(texturePath.c_str());
texturePath = texturePath.substr(textureDir.length());
// Get camera rotation as axis-angle
Vector3 cameraAxis;
float cameraAngle = MATH_RAD_TO_DEG(_cameraParent->getRotation().toAxisAngle(&cameraAxis));
// Write out a properties file
std::ostringstream s;
s <<
"particle " << name << "\n" <<
"{\n" <<
" sprite\n" <<
" {\n" <<
" path = " << texturePath << "\n" <<
" width = " << e->getSpriteWidth() << "\n" <<
" height = " << e->getSpriteHeight() << "\n" <<
" blending = " << toString(e->getTextureBlending()) << "\n" <<
" animated = " << toString(e->isSpriteAnimated()) << "\n" <<
" looped = " << toString(e->isSpriteLooped()) << "\n" <<
" frameCount = " << e->getSpriteFrameCount() << "\n" <<
" frameRandomOffset = " << e->getSpriteFrameRandomOffset() << "\n" <<
" frameDuration = " << e->getSpriteFrameDuration() << "\n" <<
" }\n" <<
"\n" <<
" particleCountMax = " << e->getParticleCountMax() << "\n" <<
" emissionRate = " << e->getEmissionRate() << "\n" <<
" ellipsoid = " << toString(e->isEllipsoid()) << "\n" <<
" orbitPosition = " << toString(e->getOrbitPosition()) << "\n" <<
" orbitVelocity = " << toString(e->getOrbitVelocity()) << "\n" <<
" orbitAcceleration = " << toString(e->getOrbitAcceleration()) << "\n" <<
" sizeStartMin = " << e->getSizeStartMin() << "\n" <<
" sizeStartMax = " << e->getSizeStartMax() << "\n" <<
" sizeEndMin = " << e->getSizeEndMin() << "\n" <<
" sizeEndMax = " << e->getSizeEndMax() << "\n" <<
" energyMin = " << e->getEnergyMin() << "\n" <<
" energyMax = " << e->getEnergyMax() << "\n" <<
" colorStart = " << toString(e->getColorStart()) << "\n" <<
" colorStartVar = " << toString(e->getColorStartVariance()) << "\n" <<
" colorEnd = " << toString(e->getColorEnd()) << "\n" <<
" colorEndVar = " << toString(e->getColorEndVariance()) << "\n" <<
" position = " << toString(e->getPosition()) << "\n" <<
" positionVar = " << toString(e->getPositionVariance()) << "\n" <<
" velocity = " << toString(e->getVelocity()) << "\n" <<
" velocityVar = " << toString(e->getVelocityVariance()) << "\n" <<
" acceleration = " << toString(e->getAcceleration()) << "\n" <<
" accelerationVar = " << toString(e->getAccelerationVariance()) << "\n" <<
" rotationPerParticleSpeedMin = " << e->getRotationPerParticleSpeedMin() << "\n" <<
" rotationPerParticleSpeedMax = " << e->getRotationPerParticleSpeedMax() << "\n" <<
"\n" <<
" editor\n" <<
" {\n" <<
" cameraTranslation = " << toString(_cameraParent->getTranslation()) << "\n" <<
" cameraZoom = " << toString(_scene->getActiveCamera()->getNode()->getTranslation()) << "\n" <<
" cameraRotation = " << toString(cameraAxis) << ", " << cameraAngle << "\n" <<
" sizeMax = " << _startMax->getMax() << "\n" <<
" energyMax = " << _energyMax->getMax() << "\n" <<
" }\n"
"}\n";
std::string text = s.str();
Stream* stream = FileSystem::open(filename.c_str(), FileSystem::WRITE);
stream->write(text.c_str(), 1, text.length());
stream->close();
SAFE_DELETE(stream);
}
示例2: controlEvent
//.........这里部分代码省略.........
}
else if (control == _velY)
{
Vector3 vel = emitter->getVelocity();
vel.y = _velY->getValue();
emitter->setVelocity(vel, emitter->getVelocityVariance());
}
else if (control == _velZ)
{
Vector3 vel = emitter->getVelocity();
vel.z = _velZ->getValue();
emitter->setVelocity(vel, emitter->getVelocityVariance());
}
else if (control == _velVarX)
{
Vector3 velVar = emitter->getVelocityVariance();
velVar.x = _velVarX->getValue();
emitter->setVelocity(emitter->getVelocity(), velVar);
}
else if (control == _velVarY)
{
Vector3 velVar = emitter->getVelocityVariance();
velVar.y = _velVarY->getValue();
emitter->setVelocity(emitter->getVelocity(), velVar);
}
else if (control == _velVarZ)
{
Vector3 velVar = emitter->getVelocityVariance();
velVar.z = _velVarZ->getValue();
emitter->setVelocity(emitter->getVelocity(), velVar);
}
else if (control == _accelX)
{
Vector3 accel = emitter->getAcceleration();
accel.x = _accelX->getValue();
emitter->setAcceleration(accel, emitter->getAccelerationVariance());
}
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);
示例3: emitterChanged
void ParticlesGame::emitterChanged()
{
ParticleEmitter* emitter = _particleEmitter;
// Set the new emitter on the node.
_particleEmitterNode->setParticleEmitter(_particleEmitter);
_particleEmitter->release();
// Reset camera view and zoom.
_scene->getActiveCamera()->getNode()->setTranslation(0.0f, 0.0f, 40.0f);
_cameraParent->setIdentity();
_particleEmitterNode->setIdentity();
// Parse editor section of particle properties
Properties* p = Properties::create(_url.c_str());
Properties* ns = p->getNamespace("editor", true);
if (ns)
{
Vector3 v3;
if (ns->getVector3("cameraTranslation", &v3))
{
_cameraParent->setTranslation(v3);
}
if (ns->getVector3("cameraZoom", &v3))
{
_scene->getActiveCamera()->getNode()->setTranslation(v3);
}
Quaternion q;
if (ns->getQuaternionFromAxisAngle("cameraRotation", &q))
{
_cameraParent->setRotation(q);
}
float f;
if ((f = ns->getFloat("sizeMax")) != 0.0f)
{
_startMin->setMax(f);
_startMax->setMax(f);
_endMin->setMax(f);
_endMax->setMax(f);
}
if ((f = ns->getFloat("energyMax")) != 0.0f)
{
_energyMin->setMax(f);
_energyMax->setMax(f);
}
}
SAFE_DELETE(p);
// Set the values of UI controls to display the new emitter's settings.
_startRed->setValue(emitter->getColorStart().x);
_startGreen->setValue(emitter->getColorStart().y);
_startBlue->setValue(emitter->getColorStart().z);
_startAlpha->setValue(emitter->getColorStart().w);
_endRed->setValue(emitter->getColorEnd().x);
_endGreen->setValue(emitter->getColorEnd().y);
_endBlue->setValue(emitter->getColorEnd().z);
_endAlpha->setValue(emitter->getColorEnd().w);
_startMin->setValue(emitter->getSizeStartMin());
_startMax->setValue(emitter->getSizeStartMax());
_endMin->setValue(emitter->getSizeEndMin());
_endMax->setValue(emitter->getSizeEndMax());
_energyMin->setValue(emitter->getEnergyMin());
_energyMax->setValue(emitter->getEnergyMax());
_emissionRate->setValue(emitter->getEmissionRate());
const Vector3& posVar = emitter->getPositionVariance();
_posVarX->setValue(posVar.x);
_posVarY->setValue(posVar.y);
_posVarZ->setValue(posVar.z);
const Vector3& vel = emitter->getVelocity();
_velX->setValue(vel.x);
_velY->setValue(vel.y);
_velZ->setValue(vel.z);
const Vector3& velVar = emitter->getVelocityVariance();
_velVarX->setValue(velVar.x);
_velVarY->setValue(velVar.y);
_velVarZ->setValue(velVar.z);
const Vector3& accel = emitter->getAcceleration();
_accelX->setValue(accel.x);
_accelY->setValue(accel.y);
_accelZ->setValue(accel.z);
const Vector3& accelVar = emitter->getAccelerationVariance();
_accelVarX->setValue(accelVar.x);
_accelVarY->setValue(accelVar.y);
_accelVarZ->setValue(accelVar.z);
_spinSpeedMin->setValue(emitter->getRotationPerParticleSpeedMin());
_spinSpeedMax->setValue(emitter->getRotationPerParticleSpeedMax());
const Vector3& axis = emitter->getRotationAxis();
_axisX->setValue(axis.x);
_axisY->setValue(axis.y);
//.........这里部分代码省略.........