void CPointEmitter::InitParticle(ParticlePtr &particle) { math::vec2f ws_pos = mPos + mPositionOffset; math::vec2f dir = this->mDirection.Rotate(util::Rand::Get()->Randomf(-this->mEmisionAngle, this->mEmisionAngle)); dir.Normalize(); math::float32 speed = util::Rand::Get()->Randomf(mParticleSpeed-mParticleSpeedVariation, mParticleSpeed+mParticleSpeedVariation); math::CColorRGBA clr = RandomiseColor(); particle->Init(ws_pos, dir, speed, util::Rand::Get()->Randomf(this->mLiveTime-mLiveTimeVariation, this->mLiveTime+mLiveTimeVariation), clr, 0, mScale); }
void CLineEmitter::InitParticle(ParticlePtr &particle) { math::vec2f ws_pos = mPos + mPositionOffset; math::vec2f dir = this->mDirection.Rotate(util::Rand::Get()->Randomf(-this->mEmisionAngle, this->mEmisionAngle)); dir.Normalize(); math::vec2f ws_end_pos = ws_pos + this->mPosEnd; math::vec2f normalVec(ws_pos - ws_end_pos); math::float32 len = normalVec.Length(); normalVec.Normalize(); //len = static_cast<math::float32>(rand()%static_cast<math::int32>(len)); len = util::Rand::Get()->Randomf(len); math::float32 speed = util::Rand::Get()->Randomf(mParticleSpeed-mParticleSpeedVariation, mParticleSpeed+mParticleSpeedVariation); math::CColorRGBA clr = RandomiseColor(); particle->Init(ws_pos + (normalVec * len), dir, speed, util::Rand::Get()->Randomf(this->mLiveTime-mLiveTimeVariation, this->mLiveTime+mLiveTimeVariation), clr, 0, mScale); }
void CCircleEmitter::InitParticle(ParticlePtr &particle) { math::vec2f ws_pos = mPos + mPositionOffset; math::vec2f dir = this->mDirection.Rotate(util::Rand::Get()->Randomf(-this->mEmisionAngle, this->mEmisionAngle)); dir.Normalize(); math::vec2f spawnPos; math::float32 randomNr = util::Rand::Get()->Randomf(0.f, math::TWO_PI); spawnPos.x = mRadius * math::mathf::Sin(randomNr); spawnPos.y = mRadius * math::mathf::Cos(randomNr); spawnPos += ws_pos; math::float32 speed = util::Rand::Get()->Randomf(mParticleSpeed-mParticleSpeedVariation, mParticleSpeed+mParticleSpeedVariation); math::CColorRGBA clr = RandomiseColor(); particle->Init(spawnPos, dir, speed, util::Rand::Get()->Randomf(this->mLiveTime-mLiveTimeVariation, this->mLiveTime+mLiveTimeVariation), clr, 0, mScale); }