本文整理汇总了C++中ParticleEmitter::setParticleType方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleEmitter::setParticleType方法的具体用法?C++ ParticleEmitter::setParticleType怎么用?C++ ParticleEmitter::setParticleType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleEmitter
的用法示例。
在下文中一共展示了ParticleEmitter::setParticleType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateTerrain
/** If necessary defines a new particle type for the terrain emitter. Then
* adjusts the location of the terrain emitter to be in synch with the
* current wheel position, and defines the emission rate depending on speed,
* steering, and skidding.
* \param pk Particle type to use.
*/
void KartGFX::updateTerrain(const ParticleKind *pk)
{
ParticleEmitter *pe = m_all_emitters[KGFX_TERRAIN];
if(!pe) return;
pe->setParticleType(pk);
const btWheelInfo &wi = m_kart->getVehicle()
->getWheelInfo(2+m_wheel_toggle);
Vec3 xyz = wi.m_raycastInfo.m_contactPointWS;
// FIXME: the X and Z position is not always accurate.
xyz.setX(xyz.getX()+ 0.06f * (m_wheel_toggle ? +1 : -1));
xyz.setZ(xyz.getZ()+0.06f);
pe->setPosition(xyz);
// Now compute the particle creation rate:
float rate = 0;
const float speed = fabsf(m_kart->getSpeed());
const float skidding = m_kart->getSkidding()->getSkidFactor();
// Only create particles when the kart is actually on ground
bool on_ground = m_kart->isOnGround() &&
m_kart->getSkidding()->getGraphicalJumpOffset()==0;
if (skidding > 1.0f && on_ground)
rate = fabsf(m_kart->getControls().m_steer) > 0.8 ? skidding - 1 : 0;
else if (speed >= 0.5f && on_ground)
rate = speed/m_kart->getKartProperties()->getMaxSpeed();
else
{
pe->setCreationRateAbsolute(0);
return;
}
// m_skidding can be > 2, and speed > maxSpeed (if powerups are used).
if(rate>1.0f) rate = 1.0f;
pe->setCreationRateRelative(rate);
} // updateTerrain
示例2: setParticleKind
/** Sets a new particle type to be used. Note that the memory of this
* kind must be managed by the caller.
* \param type The emitter type for which to set the new particle type.
* \param pk The particle kind to use.
*/
void KartGFX::setParticleKind(const KartGFXType type, const ParticleKind *pk)
{
ParticleEmitter *pe = m_all_emitters[KGFX_TERRAIN];
if(!pe) return;
pe->setParticleType(pk);
} // setParticleKind
示例3: setParticleKind
/** Sets a new particle type to be used. Note that the memory of this
* kind must be managed by the caller.
* \param type The emitter type for which to set the new particle type.
* \param pk The particle kind to use.
*/
void KartGFX::setParticleKind(const KartGFXType type, const ParticleKind *pk)
{
#ifndef SERVER_ONLY
ParticleEmitter *pe = m_all_emitters[KGFX_TERRAIN];
if(!pe) return;
pe->setParticleType(pk);
#endif
} // setParticleKind