static void LaunchPoisonExplosion(const Vec3f & aePos) { // système de partoches pour l'explosion ParticleSystem * pPS = new ParticleSystem(); ParticleParams cp = ParticleParams(); cp.m_nbMax = 80; cp.m_life = 1500; cp.m_lifeRandom = 500; cp.m_pos = Vec3f(5); cp.m_direction = Vec3f(0.f, 1.f, 0.f); cp.m_angle = glm::radians(360.f); cp.m_speed = 200; cp.m_speedRandom = 0; cp.m_gravity = Vec3f(0, 17, 0); cp.m_flash = 0; cp.m_rotation = 1.0f / (101 - 80); cp.m_rotationRandomDirection = true; cp.m_rotationRandomStart = true; cp.m_startSegment.m_size = 5; cp.m_startSegment.m_sizeRandom = 3; cp.m_startSegment.m_color = Color(0, 76, 0, 0).to<float>(); cp.m_startSegment.m_colorRandom = Color(0, 0, 0, 150).to<float>(); cp.m_endSegment.m_size = 30; cp.m_endSegment.m_sizeRandom = 5; cp.m_endSegment.m_color = Color(0, 0, 0, 0).to<float>(); cp.m_endSegment.m_colorRandom = Color(0, 25, 0, 20).to<float>(); cp.m_blendMode = RenderMaterial::AlphaAdditive; cp.m_freq = -1; cp.m_texture.set("graph/particles/big_greypouf", 0, 200); cp.m_spawnFlags = 0; cp.m_looping = false; pPS->SetParams(cp); pPS->SetPos(aePos); pPS->Update(0); std::list<Particle *>::iterator i; for(i = pPS->listParticle.begin(); i != pPS->listParticle.end(); ++i) { Particle * pP = *i; if(pP->isAlive()) { pP->p3Velocity = glm::clamp(pP->p3Velocity, Vec3f(0, -100, 0), Vec3f(0, 100, 0)); } } arx_assert(pParticleManager); pParticleManager->AddSystem(pPS); }
LUALIB_FUNCTION(_G, ParticleEmitter) { auto mat = Matrix34(); mat.Set(my->ToVec3(1, Vec3(0,0,0)), my->ToQuat(2, Quat(Ang3(0,0,0))), my->ToVec3(3, Vec3(1,1,1))); auto params = ParticleParams(); auto self = gEnv->p3DEngine->GetParticleManager()->CreateEmitter(mat, params); my->Push(self); return 1; }
void CHeal::Create() { pPS->m_lightHandle = GetFreeDynLight(); if(lightHandleIsValid(pPS->m_lightHandle)) { EERIE_LIGHT * light = lightHandleGet(pPS->m_lightHandle); light->intensity = 2.3f; light->fallstart = 200.f; light->fallend = 350.f; light->rgb = Color3f(0.4f, 0.4f, 1.0f); light->pos = eSrc + Vec3f(0.f, -50.f, 0.f); light->duration = 200; light->extras = 0; } pPS->SetPos(eSrc); ParticleParams cp = ParticleParams(); cp.m_nbMax = 350; cp.m_life = 800; cp.m_lifeRandom = 2000; cp.m_pos = Vec3f(100, 200, 100); cp.m_direction = Vec3f(0, -10, 0) * 0.1f; cp.m_angle = glm::radians(5.f); cp.m_speed = 120; cp.m_speedRandom = 84; cp.m_gravity = Vec3f(0, -10, 0); cp.m_flash = 0; cp.m_rotation = 1.0f / (101 - 80); cp.m_startSegment.m_size = 8; cp.m_startSegment.m_sizeRandom = 8; cp.m_startSegment.m_color = Color(205, 205, 255, 245).to<float>(); cp.m_startSegment.m_colorRandom = Color(50, 50, 0, 10).to<float>(); cp.m_endSegment.m_size = 6; cp.m_endSegment.m_sizeRandom = 4; cp.m_endSegment.m_color = Color(20, 20, 30, 0).to<float>(); cp.m_endSegment.m_colorRandom = Color(0, 0, 40, 0).to<float>(); cp.m_blendMode = RenderMaterial::Additive; cp.m_texture.set("graph/particles/heal_0005", 0, 100); cp.m_spawnFlags = PARTICLE_CIRCULAR | PARTICLE_BORDER; pPS->SetParams(cp); }
void FireFieldSpell::Launch() { spells.endByCaster(m_caster, SPELL_FIRE_FIELD); ARX_SOUND_PlaySFX(SND_SPELL_FIRE_FIELD_START); m_duration = (m_launchDuration > -1) ? m_launchDuration : 100000; m_hasDuration = true; m_fManaCostPerSecond = 2.8f; m_light = LightHandle::Invalid; Vec3f target; float beta = 0.f; bool displace = false; if(m_caster == PlayerEntityHandle) { target = player.basePosition(); beta = player.angle.getPitch(); displace = true; } else { if(ValidIONum(m_caster)) { Entity * io = entities[m_caster]; target = io->pos; beta = io->angle.getPitch(); displace = (io->ioflags & IO_NPC) == IO_NPC; } else { ARX_DEAD_CODE(); } } if(displace) { target += angleToVectorXZ(beta) * 250.f; } m_pos = target + Vec3f(0, -10, 0); DamageParameters damage; damage.radius = 150.f; damage.damages = 10.f; damage.area = DAMAGE_FULL; damage.duration = 100000000; damage.source = m_caster; damage.flags = 0; damage.type = DAMAGE_TYPE_MAGICAL | DAMAGE_TYPE_FIRE | DAMAGE_TYPE_FIELD; damage.pos = target; m_damage = DamageCreate(damage); m_snd_loop = ARX_SOUND_PlaySFX(SND_SPELL_FIRE_FIELD_LOOP, &target, 1.f, ARX_SOUND_PLAY_LOOPED); { ParticleParams cp = ParticleParams(); cp.m_nbMax = 100; cp.m_life = 2000; cp.m_lifeRandom = 1000; cp.m_pos = Vec3f(80, 10, 80); cp.m_direction = Vec3f(0.f, 1.f, 0.f); cp.m_angle = 0; cp.m_speed = 0; cp.m_speedRandom = 0; cp.m_gravity = Vec3f_ZERO; cp.m_flash = 0; cp.m_rotation = 0; cp.m_rotationRandomDirection = false; cp.m_rotationRandomStart = false; cp.m_startSegment.m_size = 10; cp.m_startSegment.m_sizeRandom = 3; cp.m_startSegment.m_color = Color(25, 25, 25, 50).to<float>(); cp.m_startSegment.m_colorRandom = Color(51, 51, 51, 101).to<float>(); cp.m_endSegment.m_size = 10; cp.m_endSegment.m_sizeRandom = 3; cp.m_endSegment.m_color = Color(25, 25, 25, 50).to<float>(); cp.m_endSegment.m_colorRandom = Color(0, 0, 0, 100).to<float>(); cp.m_texture.m_texLoop = true; cp.m_blendMode = RenderMaterial::AlphaAdditive; cp.m_freq = 150.0f; cp.m_texture.set("graph/particles/firebase", 4, 100); cp.m_spawnFlags = 0; pPSStream.SetParams(cp); } pPSStream.SetPos(m_pos); pPSStream.Update(0); //------------------------------------------------------------------------- { ParticleParams cp = ParticleParams(); cp.m_nbMax = 50; cp.m_life = 1000; cp.m_lifeRandom = 500; cp.m_pos = Vec3f(100, 10, 100); cp.m_direction = Vec3f(0.f, -1.f, 0.f); cp.m_angle = glm::radians(10.f); cp.m_speed = 0; cp.m_speedRandom = 0; cp.m_gravity = Vec3f_ZERO; cp.m_flash = 0; cp.m_rotation = 0; cp.m_rotationRandomDirection = false; cp.m_rotationRandomStart = false; cp.m_startSegment.m_size = 10; cp.m_startSegment.m_sizeRandom = 10; cp.m_startSegment.m_color = Color(40, 40, 40, 50).to<float>(); cp.m_startSegment.m_colorRandom = Color(51, 51, 51, 100).to<float>(); cp.m_endSegment.m_size = 10; cp.m_endSegment.m_sizeRandom = 10; cp.m_endSegment.m_color = Color(0, 0, 0, 50).to<float>(); cp.m_endSegment.m_colorRandom = Color(0, 0, 0, 100).to<float>(); cp.m_texture.m_texLoop = false; cp.m_blendMode = RenderMaterial::Additive; cp.m_freq = 150.0f; cp.m_texture.set("graph/particles/fire", 0, 500); cp.m_spawnFlags = 0; pPSStream1.SetParams(cp); } pPSStream1.SetPos(m_pos + Vec3f(0, 10, 0)); pPSStream1.Update(0); }
void CPoisonProjectile::Update(float timeDelta) { if(ulCurrentTime <= 2000) { ulCurrentTime += timeDelta; } // on passe de 5 à 100 partoches en 1.5secs if(ulCurrentTime < 750) { pPS.m_parameters.m_nbMax = 2; pPS.Update(timeDelta); } else { if(!bOk) { bOk = true; // go ParticleParams cp = ParticleParams(); cp.m_nbMax = 100; cp.m_life = 500; cp.m_lifeRandom = 300; cp.m_pos = Vec3f(fBetaRadSin * 20, 0.f, fBetaRadCos * 20); cp.m_direction = -eMove * 0.1f; cp.m_angle = glm::radians(4.f); cp.m_speed = 150; cp.m_speedRandom = 50;//15; cp.m_gravity = Vec3f(0, 10, 0); cp.m_flash = 0; cp.m_rotation = 1.0f / (101 - 80); cp.m_rotationRandomDirection = true; cp.m_rotationRandomStart = true; cp.m_startSegment.m_size = 2; cp.m_startSegment.m_sizeRandom = 2; cp.m_startSegment.m_color = Color(0, 39, 0, 100).to<float>(); cp.m_startSegment.m_colorRandom = Color(50, 21, 0, 0).to<float>(); cp.m_endSegment.m_size = 7; cp.m_endSegment.m_sizeRandom = 5; cp.m_endSegment.m_color = Color(0, 25, 0, 100).to<float>(); cp.m_endSegment.m_colorRandom = Color(50, 20, 0, 0).to<float>(); cp.m_blendMode = RenderMaterial::Screen; cp.m_freq = 80; cp.m_texture.set("graph/particles/big_greypouf", 0, 200); cp.m_spawnFlags = 0; pPSStream.SetParams(cp); } pPSStream.Update(timeDelta); pPSStream.SetPos(eCurPos); pPS.Update(timeDelta); pPS.SetPos(eCurPos); fTrail = ((ulCurrentTime - 750) * (1.0f / (ulDuration - 750.0f))) * 9 * (BEZIERPrecision + 2); } if(ulCurrentTime >= ulDuration) lightIntensityFactor = 0.f; else lightIntensityFactor = 1.f; }
void CPoisonProjectile::Create(Vec3f _eSrc, float _fBeta) { SetDuration(ulDuration); float fBetaRad = glm::radians(_fBeta); fBetaRadCos = glm::cos(fBetaRad); fBetaRadSin = glm::sin(fBetaRad); eSrc = _eSrc; bOk = false; eMove = Vec3f(-fBetaRadSin * 2, 0.f, fBetaRadCos * 2); Vec3f tempHit; Vec3f dest = eSrc; int i = 0; while(Visible(eSrc, dest, &tempHit) && i < 20) { dest.x -= fBetaRadSin * 50; dest.z += fBetaRadCos * 50; i++; } dest.y += 0.f; pathways[0] = eSrc; pathways[9] = dest; Split(pathways, 0, 9, Vec3f(10 * fBetaRadCos, 10, 10 * fBetaRadSin)); fTrail = -1; //------------------------------------------------------------------------- // système de partoches ParticleParams cp = ParticleParams(); cp.m_nbMax = 5; cp.m_life = 2000; cp.m_lifeRandom = 1000; cp.m_pos = Vec3f_ZERO; cp.m_direction = -eMove * 0.1f; cp.m_angle = 0; cp.m_speed = 10; cp.m_speedRandom = 10; cp.m_gravity = Vec3f_ZERO; cp.m_flash = 21 * (1.f/100); cp.m_rotation = 1.0f / (101 - 80); cp.m_rotationRandomDirection = true; cp.m_rotationRandomStart = true; cp.m_startSegment.m_size = 5; cp.m_startSegment.m_sizeRandom = 3; cp.m_startSegment.m_color = Color(0, 50, 0, 40).to<float>(); cp.m_startSegment.m_colorRandom = Color(0, 100, 0, 50).to<float>(); cp.m_endSegment.m_size = 8; cp.m_endSegment.m_sizeRandom = 13; cp.m_endSegment.m_color = Color(0, 60, 0, 40).to<float>(); cp.m_endSegment.m_colorRandom = Color(0, 100, 0, 50).to<float>(); cp.m_blendMode = RenderMaterial::Screen; cp.m_freq = -1; cp.m_texture.set("graph/particles/big_greypouf", 0, 200); cp.m_spawnFlags = 0; pPS.SetParams(cp); pPS.SetPos(eSrc); pPS.Update(0); }
void particleParametersInit() { g_particleParameters[ParticleParam_MagicMissileExplosion] = MagicMissileExplosionParticle(); g_particleParameters[ParticleParam_MagicMissileExplosionMar] = MagicMissileExplosionMrCheatParticle(); { ParticleParams cp; cp.m_nbMax = 350; cp.m_life = 800; cp.m_lifeRandom = 2000; cp.m_pos = Vec3f(100, 200, 100); cp.m_direction = Vec3f(0.f, -1.f, 0.f); cp.m_angle = glm::radians(5.f); cp.m_speed = 120; cp.m_speedRandom = 84; cp.m_gravity = Vec3f(0, -10, 0); cp.m_flash = 0; cp.m_rotation = 1.0f / (101 - 80); cp.m_startSegment.m_size = 8; cp.m_startSegment.m_sizeRandom = 8; cp.m_startSegment.m_color = Color(205, 205, 255, 245).to<float>(); cp.m_startSegment.m_colorRandom = Color(50, 50, 0, 10).to<float>(); cp.m_endSegment.m_size = 6; cp.m_endSegment.m_sizeRandom = 4; cp.m_endSegment.m_color = Color(20, 20, 30, 0).to<float>(); cp.m_endSegment.m_colorRandom = Color(0, 0, 40, 0).to<float>(); cp.m_blendMode = RenderMaterial::Additive; cp.m_texture.set("graph/particles/heal_0005", 0, 100); cp.m_spawnFlags = PARTICLE_CIRCULAR | PARTICLE_BORDER; g_particleParameters[ParticleParam_Heal] = cp; } { ParticleParams cp; cp.m_nbMax = 350; cp.m_life = 800; cp.m_lifeRandom = 2000; cp.m_pos = Vec3f(100, 200, 100); cp.m_direction = Vec3f(0.f, -1.f, 0.f); cp.m_angle = glm::radians(5.f); cp.m_speed = 120; cp.m_speedRandom = 84; cp.m_gravity = Vec3f(0, -10, 0); cp.m_flash = 0; cp.m_rotation = 1.0f / (101 - 80); cp.m_startSegment.m_size = 8; cp.m_startSegment.m_sizeRandom = 8; cp.m_startSegment.m_color = Color(105, 105, 20, 145).to<float>(); cp.m_startSegment.m_colorRandom = Color(50, 50, 0, 10).to<float>(); cp.m_endSegment.m_size = 6; cp.m_endSegment.m_sizeRandom = 4; cp.m_endSegment.m_color = Color(20, 20, 5, 0).to<float>(); cp.m_endSegment.m_colorRandom = Color(40, 40, 0, 0).to<float>(); cp.m_blendMode = RenderMaterial::Additive; cp.m_texture.set("graph/particles/create_food", 0, 100); //5 cp.m_spawnFlags = PARTICLE_CIRCULAR | PARTICLE_BORDER; g_particleParameters[ParticleParam_CreateFood] = cp; } { ParticleParams cp; cp.m_nbMax = 350; cp.m_life = 800; cp.m_lifeRandom = 2000; cp.m_pos = Vec3f(100, 0, 100); cp.m_direction = Vec3f(0.f, -1.f, 0.f); cp.m_angle = glm::radians(5.f); cp.m_speed = 120; cp.m_speedRandom = 84; cp.m_gravity = Vec3f(0, -10, 0); cp.m_flash = 0; cp.m_rotation = 1.0f / (101 - 80); cp.m_startSegment.m_size = 8;//6; cp.m_startSegment.m_sizeRandom = 8; cp.m_startSegment.m_color = Color(20, 205, 20, 245).to<float>(); cp.m_startSegment.m_colorRandom = Color(50, 50, 50, 10).to<float>(); cp.m_endSegment.m_size = 6; cp.m_endSegment.m_sizeRandom = 4; cp.m_endSegment.m_color = Color(5, 20, 5, 0).to<float>(); cp.m_endSegment.m_colorRandom = Color(0, 40, 0, 0).to<float>(); cp.m_blendMode = RenderMaterial::Additive; cp.m_texture.set("graph/particles/cure_poison", 0, 100); //5 cp.m_spawnFlags = PARTICLE_CIRCULAR | PARTICLE_BORDER; g_particleParameters[ParticleParam_CurePoison] = cp; } { ParticleParams cp = ParticleParams(); cp.m_nbMax = 100; cp.m_life = 2000; cp.m_lifeRandom = 1000; cp.m_pos = Vec3f(80, 10, 80); cp.m_direction = Vec3f(0.f, 1.f, 0.f); cp.m_angle = 0; cp.m_speed = 0; cp.m_speedRandom = 0; cp.m_gravity = Vec3f_ZERO; cp.m_flash = 0; cp.m_rotation = 0; cp.m_rotationRandomDirection = false; cp.m_rotationRandomStart = false; cp.m_startSegment.m_size = 10; cp.m_startSegment.m_sizeRandom = 3; cp.m_startSegment.m_color = Color(25, 25, 25, 50).to<float>(); cp.m_startSegment.m_colorRandom = Color(51, 51, 51, 101).to<float>(); cp.m_endSegment.m_size = 10; cp.m_endSegment.m_sizeRandom = 3; cp.m_endSegment.m_color = Color(25, 25, 25, 50).to<float>(); cp.m_endSegment.m_colorRandom = Color(0, 0, 0, 100).to<float>(); cp.m_texture.m_texLoop = true; cp.m_blendMode = RenderMaterial::AlphaAdditive; cp.m_freq = 150.0f; cp.m_texture.set("graph/particles/firebase", 4, 100); cp.m_spawnFlags = 0; g_particleParameters[ParticleParam_FireFieldBase] = cp; } { ParticleParams cp = ParticleParams(); cp.m_nbMax = 50; cp.m_life = 1000; cp.m_lifeRandom = 500; cp.m_pos = Vec3f(100, 10, 100); cp.m_direction = Vec3f(0.f, -1.f, 0.f); cp.m_angle = glm::radians(10.f); cp.m_speed = 0; cp.m_speedRandom = 0; cp.m_gravity = Vec3f_ZERO; cp.m_flash = 0; cp.m_rotation = 0; cp.m_rotationRandomDirection = false; cp.m_rotationRandomStart = false; cp.m_startSegment.m_size = 10; cp.m_startSegment.m_sizeRandom = 10; cp.m_startSegment.m_color = Color(40, 40, 40, 50).to<float>(); cp.m_startSegment.m_colorRandom = Color(51, 51, 51, 100).to<float>(); cp.m_endSegment.m_size = 10; cp.m_endSegment.m_sizeRandom = 10; cp.m_endSegment.m_color = Color(0, 0, 0, 50).to<float>(); cp.m_endSegment.m_colorRandom = Color(0, 0, 0, 100).to<float>(); cp.m_texture.m_texLoop = false; cp.m_blendMode = RenderMaterial::Additive; cp.m_freq = 150.0f; cp.m_texture.set("graph/particles/fire", 0, 500); cp.m_spawnFlags = 0; g_particleParameters[ParticleParam_FireFieldFlame] = cp; } { ParticleParams cp = ParticleParams(); cp.m_nbMax = 80; cp.m_life = 1500; cp.m_lifeRandom = 500; cp.m_pos = Vec3f(5); cp.m_direction = Vec3f(0.f, 1.f, 0.f); cp.m_angle = glm::radians(360.f); cp.m_speed = 200; cp.m_speedRandom = 0; cp.m_gravity = Vec3f(0, 17, 0); cp.m_flash = 0; cp.m_rotation = 1.0f / (101 - 80); cp.m_rotationRandomDirection = true; cp.m_rotationRandomStart = true; cp.m_startSegment.m_size = 5; cp.m_startSegment.m_sizeRandom = 3; cp.m_startSegment.m_color = Color(0, 76, 0, 0).to<float>(); cp.m_startSegment.m_colorRandom = Color(0, 0, 0, 150).to<float>(); cp.m_endSegment.m_size = 30; cp.m_endSegment.m_sizeRandom = 5; cp.m_endSegment.m_color = Color(0, 0, 0, 0).to<float>(); cp.m_endSegment.m_colorRandom = Color(0, 25, 0, 20).to<float>(); cp.m_blendMode = RenderMaterial::AlphaAdditive; cp.m_freq = -1; cp.m_texture.set("graph/particles/big_greypouf", 0, 200); cp.m_spawnFlags = 0; cp.m_looping = false; g_particleParameters[ParticleParam_Poison1] = cp; } { ParticleParams cp = ParticleParams(); cp.m_nbMax = 5; cp.m_life = 2000; cp.m_lifeRandom = 1000; cp.m_pos = Vec3f_ZERO; cp.m_direction = Vec3f(0.1f); cp.m_angle = 0; cp.m_speed = 10; cp.m_speedRandom = 10; cp.m_gravity = Vec3f_ZERO; cp.m_flash = 21 * (1.f/100); cp.m_rotation = 1.0f / (101 - 80); cp.m_rotationRandomDirection = true; cp.m_rotationRandomStart = true; cp.m_startSegment.m_size = 5; cp.m_startSegment.m_sizeRandom = 3; cp.m_startSegment.m_color = Color(0, 50, 0, 40).to<float>(); cp.m_startSegment.m_colorRandom = Color(0, 100, 0, 50).to<float>(); cp.m_endSegment.m_size = 8; cp.m_endSegment.m_sizeRandom = 13; cp.m_endSegment.m_color = Color(0, 60, 0, 40).to<float>(); cp.m_endSegment.m_colorRandom = Color(0, 100, 0, 50).to<float>(); cp.m_blendMode = RenderMaterial::Screen; cp.m_freq = -1; cp.m_texture.set("graph/particles/big_greypouf", 0, 200); cp.m_spawnFlags = 0; g_particleParameters[ParticleParam_Poison2] = cp; } { ParticleParams cp = ParticleParams(); cp.m_nbMax = 100; cp.m_life = 500; cp.m_lifeRandom = 300; cp.m_pos = Vec3f(20, 0.f, 20); cp.m_direction = Vec3f(0.1f); cp.m_angle = glm::radians(4.f); cp.m_speed = 150; cp.m_speedRandom = 50;//15; cp.m_gravity = Vec3f(0, 10, 0); cp.m_flash = 0; cp.m_rotation = 1.0f / (101 - 80); cp.m_rotationRandomDirection = true; cp.m_rotationRandomStart = true; cp.m_startSegment.m_size = 2; cp.m_startSegment.m_sizeRandom = 2; cp.m_startSegment.m_color = Color(0, 39, 0, 100).to<float>(); cp.m_startSegment.m_colorRandom = Color(50, 21, 0, 0).to<float>(); cp.m_endSegment.m_size = 7; cp.m_endSegment.m_sizeRandom = 5; cp.m_endSegment.m_color = Color(0, 25, 0, 100).to<float>(); cp.m_endSegment.m_colorRandom = Color(50, 20, 0, 0).to<float>(); cp.m_blendMode = RenderMaterial::Screen; cp.m_freq = 80; cp.m_texture.set("graph/particles/big_greypouf", 0, 200); cp.m_spawnFlags = 0; g_particleParameters[ParticleParam_Poison3] = cp; } }