void spawnFireHitParticle(const Vec3f & poss, long type) { PARTICLE_DEF * pd = createParticle(true); if(pd) { static TextureContainer * tc1 = TextureContainer::Load("graph/particles/fire_hit"); pd->ov = poss; pd->move = Vec3f(3.f, 4.f, 3.f) - Vec3f(6.f, 12.f, 6.f) * randomVec3f(); pd->tolive = Random::getu(600, 700); pd->tc = tc1; pd->siz = Random::getf(100.f, 110.f) * ((type == 1) ? 2.f : 1.f); pd->zdec = true; if(type == 1) { pd->rgb = Color3f(.4f, .4f, 1.f); } pd = createParticle(true); if(pd) { pd->ov = poss; pd->move = Vec3f(3.f , 4.f, 3.f) - Vec3f(6.f, 12.f, 6.f) * randomVec3f(); pd->tolive = Random::getu(600, 700); pd->tc = tc1; pd->siz = Random::getf(40.f, 70.f) * ((type == 1) ? 2.f : 1.f); pd->zdec = true; if(type == 1) { pd->rgb = Color3f(.4f, .4f, 1.f); } } } }
void FireFieldSpell::Update(float timeDelta) { pPSStream.Update(timeDelta); pPSStream1.Update(timeDelta); if(!lightHandleIsValid(m_light)) m_light = GetFreeDynLight(); if(lightHandleIsValid(m_light)) { EERIE_LIGHT * el = lightHandleGet(m_light); el->pos = m_pos + Vec3f(0.f, -120.f, 0.f); el->intensity = 4.6f; el->fallstart = 150.f+rnd()*30.f; el->fallend = 290.f+rnd()*30.f; el->rgb = Color3f(1.f, 0.8f, 0.6f) - Color3f(rnd()*(1.0f/10), 0.f, 0.f); el->duration = 600; el->extras=0; } if(VisibleSphere(Sphere(m_pos - Vec3f(0.f, 120.f, 0.f), 350.f))) { pPSStream.Render(); pPSStream1.Render(); float fDiff = timeDelta / 8.f; int nTime = checked_range_cast<int>(fDiff); for(long nn=0;nn<=nTime+1;nn++) { PARTICLE_DEF * pd = createParticle(); if(!pd) { break; } float t = rnd() * (PI * 2.f) - PI; float ts = std::sin(t); float tc = std::cos(t); pd->ov = m_pos + Vec3f(120.f * ts, 15.f * ts, 120.f * tc) * randomVec(); pd->move = Vec3f(2.f, 1.f, 2.f) + Vec3f(-4.f, -8.f, -4.f) * Vec3f(rnd(), rnd(), rnd()); pd->siz = 7.f; pd->tolive = Random::get(500, 1500); pd->tc = fire2; pd->special = ROTATING | MODULATE_ROTATION | FIRE_TO_SMOKE; pd->fparam = 0.1f - rnd() * 0.2f; pd->scale = Vec3f(-8.f); PARTICLE_DEF * pd2 = createParticle(); if(!pd2) { break; } *pd2 = *pd; pd2->delay = Random::get(60, 210); } } }
void FireFieldSpell::Update() { pPSStream.Update(g_framedelay); pPSStream1.Update(g_framedelay); EERIE_LIGHT * el = dynLightCreate(m_light); if(el) { el->pos = m_pos + Vec3f(0.f, -120.f, 0.f); el->intensity = 4.6f; el->fallstart = Random::getf(150.f, 180.f); el->fallend = Random::getf(290.f, 320.f); el->rgb = Color3f(1.f, 0.8f, 0.6f) + Color3f(Random::getf(-0.1f, 0.f), 0.f, 0.f); el->duration = ArxDurationMs(600); el->extras=0; } if(VisibleSphere(Sphere(m_pos - Vec3f(0.f, 120.f, 0.f), 350.f))) { pPSStream.Render(); pPSStream1.Render(); float fDiff = g_framedelay / 8.f; int nTime = checked_range_cast<int>(fDiff); for(long nn=0;nn<=nTime+1;nn++) { PARTICLE_DEF * pd = createParticle(); if(!pd) { break; } float t = Random::getf() * (glm::pi<float>() * 2.f) - glm::pi<float>(); float ts = std::sin(t); float tc = std::cos(t); pd->ov = m_pos + Vec3f(120.f * ts, 15.f * ts, 120.f * tc) * randomVec(); pd->move = Vec3f(2.f, 1.f, 2.f) + Vec3f(-4.f, -8.f, -4.f) * randomVec3f(); pd->siz = 7.f; pd->tolive = Random::getu(500, 1500); pd->tc = fire2; pd->m_flags = ROTATING | FIRE_TO_SMOKE; pd->m_rotation = Random::getf(-0.1f, 0.1f); pd->scale = Vec3f(-8.f); PARTICLE_DEF * pd2 = createParticle(); if(!pd2) { break; } *pd2 = *pd; pd2->delay = Random::getu(60, 210); } } }
void BookIconGui::MakeBookFX() { static const float z = 0.00001f; for(long i = 0; i < 12; i++) { MagFX(Vec3f(m_rect.topLeft(), z), m_scale); } for(int i = 0; i < 5; i++) { PARTICLE_DEF * pd = createParticle(); if(!pd) { break; } float s = i * m_scale; pd->ov = Vec3f(m_rect.topLeft() - Vec2f(s * 2, s * 2), z); pd->move = Vec3f(s * -0.5f, s * -0.5f, 0.f); pd->scale = Vec3f(s * 10, s * 10, 0.f); pd->tolive = Random::getu(1200, 1600); pd->tc = m_tex; pd->rgb = Color3f(1.f - i * 0.1f, i * 0.1f, 0.5f - i * 0.1f); pd->siz = m_rect.width() + s * 4.f; pd->is2D = true; } NewSpell = 1; }
void PoisonProjectileSpell::AddPoisonFog(const Vec3f & pos, float power) { int iDiv = 4 - config.video.levelOfDetail; float flDiv = static_cast<float>(1 << iDiv); long count = std::max(1l, checked_range_cast<long>(g_framedelay / flDiv)); while(count--) { if(Random::getf(0.f, 2000.f) >= power) { continue; } PARTICLE_DEF * pd = createParticle(); if(!pd) { return; } float speed = 1.f; float fval = speed * 0.2f; pd->m_flags = FADE_IN_AND_OUT | ROTATING | DISSIPATING; pd->ov = pos + arx::randomVec(-100.f, 100.f); pd->scale = Vec3f(8.f, 8.f, 10.f); pd->move = Vec3f((speed - Random::getf()) * fval, (speed - speed * Random::getf()) * (1.f / 15), (speed - Random::getf()) * fval); pd->tolive = Random::getu(4500, 9000); pd->tc = TC_smoke; pd->siz = (80.f + Random::getf(0.f, 160.f)) * (1.f / 3); pd->rgb = Color3f(Random::getf(0.f, 1.f / 3), 1.f, Random::getf(0.f, 0.1f)); pd->m_rotation = 0.001f; } }
void CCurse::Render() { RenderMaterial mat; mat.setCulling(Renderer::CullCW); mat.setDepthTest(true); mat.setBlendType(RenderMaterial::Opaque); Anglef stiteangle = Anglef(0, fRot, 0); Vec3f stitepos = eTarget; Vec3f stitescale = Vec3f_ONE; Color3f stitecolor = Color3f::white; Draw3DObject(svoodoo, stiteangle, stitepos, stitescale, stitecolor, mat); for(int i = 0; i < 4; i++) { PARTICLE_DEF * pd = createParticle(); if(!pd) { break; } pd->ov = eTarget; pd->move = Vec3f(2.f * frand2(), rnd() * -10.f - 10.f, 2.f * frand2()); pd->siz = 0.015f; pd->tolive = Random::get(1000, 1600); pd->tc = tex_p1; pd->special = ROTATING | MODULATE_ROTATION | DISSIPATING | SUBSTRACT | GRAVITY; pd->fparam = 0.0000001f; } }
bool LiquidScene::init() { if ( !Layer::init() ) { return false; } srand((unsigned) time(NULL)); createPhysWorld(); createGround(); createParticle(); // デバック表示用 initDebugDraw(); initTouchEventListener(); Size window = Director::getInstance()->getWinSize(); drawBox2dSpriteAt(createBox2DSpriteData(SpriteType::Box), Point(window.width/2.0 + 33, 33)); drawBox2dSpriteAt(createBox2DSpriteData(SpriteType::Box), Point(window.width/2.0 - 33, 33)); drawBox2dSpriteAt(createBox2DSpriteData(SpriteType::Box), Point(window.width/2.0 + 33 + 66, 33)); drawBox2dSpriteAt(createBox2DSpriteData(SpriteType::Box), Point(window.width/2.0 - 33 - 66, 33)); drawBox2dSpriteAt(createBox2DSpriteData(SpriteType::Box), Point(window.width/2.0 + 33 + 66, 33 + 66)); drawBox2dSpriteAt(createBox2DSpriteData(SpriteType::Box), Point(window.width/2.0 - 33 - 66, 33 + 66)); drawBox2dSpriteAt(createBox2DSpriteData(SpriteType::Box), Point(window.width/2.0 + 33 + 66, 33 + 66 + 66)); drawBox2dSpriteAt(createBox2DSpriteData(SpriteType::Box), Point(window.width/2.0 - 33 - 66, 33 + 66 + 66)); scheduleUpdate(); return true; }
void ParticleEmitter::create(ParticleSystem *system, float time) { int numParticles = createConstantEmissionCount(time); Particle *p; for(int i = 0; (i < numParticles) && (system->findEmptySlot(p)); i++) { createParticle(p); } }
void FlyingEyeSpell::End() { Entity * caster = entities.get(m_caster); if(caster) { ARX_SOUND_PlaySFX(g_snd.MAGIC_FIZZLE, &caster->pos); } static TextureContainer * tc4 = TextureContainer::Load("graph/particles/smoke"); ARX_SOUND_PlaySFX(g_snd.SPELL_EYEBALL_OUT); eyeball.exist = -100; for(long n = 0; n < 12; n++) { PARTICLE_DEF * pd = createParticle(); if(!pd) { break; } pd->ov = eyeball.pos + arx::randomVec(-5.f, 5.f); pd->move = arx::randomVec(-2.f, 2.f); pd->siz = 28.f; pd->tolive = Random::getu(2000, 6000); pd->scale = Vec3f(12.f); pd->tc = tc4; pd->m_flags = FADE_IN_AND_OUT | ROTATING | DISSIPATING; pd->m_rotation = 0.0000001f; pd->rgb = Color3f(0.7f, 0.7f, 1.f); } config.input.mouseLookToggle = bOldLookToggle; lightHandleDestroy(m_light1); lightHandleDestroy(m_light2); }
void PoisonProjectileSpell::AddPoisonFog(const Vec3f & pos, float power) { int iDiv = 4 - config.video.levelOfDetail; float flDiv = static_cast<float>(1 << iDiv); arxtime.update(); long count = std::max(1l, checked_range_cast<long>(framedelay / flDiv)); while(count--) { if(rnd() * 2000.f >= power) { continue; } PARTICLE_DEF * pd = createParticle(); if(!pd) { return; } float speed = 1.f; float fval = speed * 0.2f; pd->special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING; pd->ov = pos + randomVec(-100.f, 100.f); pd->scale = Vec3f(8.f, 8.f, 10.f); pd->move = Vec3f((speed - rnd()) * fval, (speed - speed * rnd()) * (1.f / 15), (speed - rnd()) * fval); pd->tolive = Random::get(4500, 9000); pd->tc = TC_smoke; pd->siz = (80.f + rnd() * 160.f) * (1.f / 3); pd->rgb = Color3f(rnd() * (1.f / 3), 1.f, rnd() * 0.1f); pd->fparam = 0.001f; } }
void SplashManager::update(void) { for(int i = 0; i<400 ;i++) { particles[i].timer++; if( particles[i].timer < particles[i].limit) { float perc = particles[i].timer / particles[i].limit; particles[i].x += particles[i].direction[0]; particles[i].y += particles[i].direction[1]; particles[i].z += particles[i].direction[2]; particles[i].scale += 0.001f; particles[i].color[0] = (1.0 -perc); particles[i].color[1] = (1.0 -perc); particles[i].color[2] = (1.0 -perc); particles[i].color[3] = (1.0 -perc); } else { createParticle(i); } } }
void LaunchFireballBoom(const Vec3f & poss, float level, Vec3f * direction, Color3f * rgb) { level *= 1.6f; if(explo[0] == NULL) { return; } PARTICLE_DEF * pd = createParticle(true); if(!pd) { return; } pd->m_flags = FIRE_TO_SMOKE | FADE_IN_AND_OUT | PARTICLE_ANIMATED; pd->ov = poss; pd->move = (direction) ? *direction : Vec3f(0.f, Random::getf(-5.f, 0.f), 0.f); pd->tolive = Random::getu(1600, 2200); pd->tc = explo[0]; pd->siz = level * 3.f + Random::getf(0.f, 2.f); pd->scale = Vec3f(level * 3.f); pd->zdec = true; pd->cval1 = 0; pd->cval2 = MAX_EXPLO - 1; if(rgb) { pd->rgb = *rgb; } }
void FlyingEyeSpell::End() { ARX_SOUND_PlaySFX(SND_MAGIC_FIZZLE, &entities[m_caster]->pos); static TextureContainer * tc4=TextureContainer::Load("graph/particles/smoke"); ARX_SOUND_PlaySFX(SND_SPELL_EYEBALL_OUT); eyeball.exist = -100; for(long n = 0; n < 12; n++) { PARTICLE_DEF * pd = createParticle(); if(!pd) { break; } pd->ov = eyeball.pos + randomVec(-5.f, 5.f); pd->move = randomVec(-2.f, 2.f); pd->siz = 28.f; pd->tolive = Random::get(2000, 6000); pd->scale = Vec3f(12.f); pd->tc = tc4; pd->special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING; pd->fparam = 0.0000001f; pd->rgb = Color3f(0.7f, 0.7f, 1.f); } config.input.mouseLookToggle = bOldLookToggle; lightHandleDestroy(special[2]); lightHandleDestroy(special[1]); }
void Bomb::bomb() { //CCLog("==============Bomb::bomb======================="); stopAllActions(); setVisible(true); RecordSprite* pBomb = new RecordSprite; pBomb->initWithTexture(this->getTexture()); pBomb->autorelease(); pBomb->setPosition(ccp(this->getContentSize().width/2, this->getContentSize().height/2)); this->addChild(pBomb); pBomb->runAction(CCSequence::create( AnimatePacker::getInstance()->getAnimate("fullbomb"), CCCallFuncN::create(this, callfuncN_selector(Bomb::bombEnd)), NULL)); // if (bombAction != NULL) // { // runAction(bombAction); // }else // { // CCLog("========>waring: current season have increct bomb pic !"); // } par = NULL; //安卓平台不需要这个粒子系统 if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) { par = createParticle(); getParent()->addChild(par, 10); par->setPosition(getPosition()); } }
// flag 1 = randomize pos void ARX_PARTICLES_Add_Smoke(const Vec3f & pos, long flags, long amount, const Color3f & rgb) { Vec3f mod = (flags & 1) ? randomVec(-50.f, 50.f) : Vec3f_ZERO; while(amount--) { PARTICLE_DEF * pd = createParticle(); if(!pd) { return; } pd->ov = pos + mod; if(flags & 2) { pd->siz = Random::getf(15.f, 35.f); pd->scale = randomVec(40.f, 55.f); } else { pd->siz = Random::getf(5.f, 13.f); pd->scale = randomVec(10.f, 15.f); } pd->m_flags = ROTATING | FADE_IN_AND_OUT; pd->tolive = Random::getu(1100, 1500); pd->delay = amount * 120 + Random::getu(0, 100); pd->move = Vec3f(Random::getf(-0.25f, 0.25f), Random::getf(-0.7f, 0.3f), Random::getf(-0.25f, 0.25f)); pd->rgb = rgb; pd->tc = smokeparticle; pd->m_rotation = 0.01f; } }
Viewer::Viewer(const QGLFormat& format, QWidget *parent) : QGLWidget(format, parent), MaxParticles(2000), ParticlesCount(900) #if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)) , vbo(QOpenGLBuffer::VertexBuffer) , matbo(QOpenGLBuffer::VertexBuffer) , mVertexArrayObject(this) #else , vbo(QGLBuffer::VertexBuffer) #endif { mTimer = new QTimer(this); connect(mTimer, SIGNAL(timeout()), this, SLOT(update())); mTimer->start(1000/30); // Nothing to do here right now. mStepTimer = new QTimer(this); connect(mTimer, SIGNAL(timeout()), this, SLOT(step())); mTimer->start(1000/500); createTimer = new QTimer(this); connect(createTimer, SIGNAL(timeout()), this, SLOT(createParticle())); createTimer->start(1000/10); }
void ARX_PARTICLES_Spawn_Lava_Burn(Vec3f pos, Entity * io) { if(io && io->obj && !io->obj->facelist.empty()) { size_t num = 0; long notok = 10; while(notok-- > 0) { num = Random::getu(0, io->obj->facelist.size() - 1); if(io->obj->facelist[num].facetype & POLY_HIDE) { continue; } if(glm::abs(pos.y-io->obj->vertexlist3[io->obj->facelist[num].vid[0]].v.y) > 50.f) { continue; } notok = -1; } pos = io->obj->vertexlist3[io->obj->facelist[num].vid[0]].v; } PARTICLE_DEF * pd = createParticle(); if(!pd) { return; } pd->ov = pos; pd->move = randomVec3f() * Vec3f(2.f, -12.f, 2.f) - Vec3f(4.f, 15.f, 4.f); pd->tolive = 800; pd->tc = smokeparticle; pd->siz = 15.f; pd->scale = randomVec(15.f, 20.f); pd->m_flags = FIRE_TO_SMOKE; if(Random::getf() > 0.5f) { pd->m_flags |= SUBSTRACT; } }
static void FlyingEyeSpellUpdateHand(const Vec3f & pos, LightHandle & light) { EERIE_LIGHT * el = dynLightCreate(light); if(el) { el->intensity = 1.3f; el->fallend = 180.f; el->fallstart = 50.f; el->rgb = Color3f(0.7f, 0.3f, 1.f); el->pos = pos; } for(long kk = 0; kk < 2; kk++) { PARTICLE_DEF * pd = createParticle(); if(!pd) { break; } pd->ov = pos + randomVec(-1.f, 1.f); pd->move = Vec3f(0.1f, 0.f, 0.1f) + Vec3f(-0.2f, -2.2f, -0.2f) * randomVec3f(); pd->siz = 5.f; pd->tolive = Random::getu(1500, 3500); pd->scale = Vec3f(0.2f); pd->tc = TC_smoke; pd->m_flags = FADE_IN_AND_OUT | ROTATING | DISSIPATING; pd->sourceionum = EntityHandle_Player; pd->m_rotation = 0.0000001f; pd->rgb = Color3f(.7f, .3f, 1.f) + Color3f(-.1f, -.1f, -.1f) * randomColor3f(); } }
Particle *ParticleSystemNode::emit(int count) { nodeDirection = normalize(origin * vec3(0, 0, 1) - origin.getPos()); if (count == 1) { Particle *p = createParticle(); particles.append(p); return p; } for (int i=0; i<count; i++) { Particle *p = createParticle(); particles.append(p); } return NULL; }
void StarParticleController::initialize() { Starparticles.clear(); createParticle(); isEnd = false; timer.initialize(); }
void PlayerLogicComponent::hatchBird(bool respawn){ if (isEgg){ if (respawn && gameObjectRef->isLocal){ AudioManager* audioMan = AudioManager::getAudioInstance(); audioMan->playByName("roostersfx.ogg"); } PlayerRenderComponent* renderComp = dynamic_cast<PlayerRenderComponent*>(gameObjectRef->GetComponent(COMPONENT_RENDER)); //reset sprites //for (auto obj : renderComp->allObjs)obj.second->visible = true; createParticle(renderComp->allObjs["egg"], 10, gameObjectRef->posX, gameObjectRef->posY); renderComp->allObjs["body"]->visible = true; renderComp->allObjs["egg"]->visible = false; //reset positions renderComp->allObjs["base"]->posX = gameObjectRef->posX; renderComp->allObjs["base"]->posY = gameObjectRef->posY; //reset rotation PlayerPhysicsComponent* physicsComp = dynamic_cast<PlayerPhysicsComponent*>(gameObjectRef->GetComponent(COMPONENT_PHYSICS)); b2Vec2 pos; physicsComp->mBody->SetFixedRotation(true); pos = physicsComp->mBody->GetPosition(); gameObjectRef->rotation = 0; physicsComp->mBody->SetTransform(pos, 0); renderComp->allObjs["base"]->rotation = 0; isEgg = false; } }
float CCurse::Render() { GRenderer->SetCulling(Renderer::CullCW); GRenderer->SetRenderState(Renderer::DepthWrite, true); GRenderer->SetRenderState(Renderer::AlphaBlending, false); if(svoodoo) { Anglef stiteangle = Anglef(fRot, 0, 0); Vec3f stitepos = eTarget; Vec3f stitescale = Vec3f::ONE; Color3f stitecolor = Color3f::white; DrawEERIEObjEx(svoodoo , &stiteangle, &stitepos, &stitescale, &stitecolor); } for(int i = 0; i < 4; i++) { PARTICLE_DEF * pd = createParticle(); if(!pd) { break; } pd->ov = eTarget; pd->move = Vec3f(2.f * frand2(), rnd() * -10.f - 10.f, 2.f * frand2()); pd->siz = 0.015f; pd->tolive = Random::get(1000, 1600); pd->tc = tex_p1; pd->special = ROTATING | MODULATE_ROTATION | DISSIPATING | SUBSTRACT | GRAVITY; pd->fparam = 0.0000001f; } return 1; }
void AddRandomSmoke(Entity * io, long amount) { if(!io) { return; } for(long i = 0; i < amount; i++) { PARTICLE_DEF * pd = createParticle(); if(!pd) { return; } long vertex = Random::get(0, io->obj->vertexlist.size() - 1); pd->ov = io->obj->vertexlist3[vertex].v + randomVec(-5.f, 5.f); pd->siz = Random::getf(0.f, 8.f); if(pd->siz < 4.f) { pd->siz = 4.f; } pd->scale = Vec3f(10.f); pd->m_flags = ROTATING | FADE_IN_AND_OUT; pd->tolive = Random::getu(900, 1300); pd->move = Vec3f(Random::getf(-0.25f, 0.25f), Random::getf(-0.7f, 0.3f), Random::getf(-0.25f, 0.25f)); pd->rgb = Color3f(0.3f, 0.3f, 0.34f); pd->tc = smokeparticle; pd->m_rotation = 0.001f; } }
ParticleSystem::ParticleSystem(const ParticleSystem ©, const osg::CopyOp ©op) : osgParticle::ParticleSystem(copy, copyop) , mQuota(copy.mQuota) { // For some reason the osgParticle constructor doesn't copy the particles for (int i=0;i<copy.numParticles()-copy.numDeadParticles();++i) createParticle(copy.getParticle(i)); }
static void spawnEffect(GameObject trap, GameObject target) { EntityManager &em = EntityManager::instance(); TrapComponent *tc = em.getComponentForEntity<TrapComponent>(trap); SpellEffects::apply(trap, target, tc->spell); SpaceComponent *sc = em.getComponentForEntity<SpaceComponent>(trap); createParticle(sc->pos); }
void ParticleSystemNode::update(float dt) { if (particles.count() > 0) { particleBox.min = particles[0].pos; particleBox.max = particles[0].pos; for (int i=0; i<particles.count(); i++) { if (!particles[i].update(dt)) { particles.remove(i--); continue; } particleBox.include(particles[i].pos, particles[i].size); } } Origin new_transform = getOrigin(true); if (first_update == true) { old_transform = new_transform; } if (enabled && spawnRate > EPSILON && dt > EPSILON) { nodeDirection = normalize(origin * vec3(0, 0, 1) - origin * vec3(0, 0, 0)); float iSpawn = 1.0f / spawnRate; float time = dt - timeToSpawn; float count = math::floor(time / timeToSpawn) * timeToSpawn; float k = timeToSpawn / dt; float delta_k = iSpawn / dt; timeToSpawn -= dt; while (timeToSpawn < 0) { Origin cur_transform = lerp(old_transform, new_transform, k); mat4 matrix = cur_transform.getMatrix(); Particle *p = createParticle(&matrix); //Particle *p = createParticle(); if (!p->update(-timeToSpawn)) { delete p; } else { particles.append(p); } timeToSpawn += iSpawn; k += delta_k; } } old_transform = new_transform; first_update = false; }
void CRepelUndead::Render() { if(ulCurrentTime >= ulDuration) return; RenderMaterial mat; mat.setDepthTest(true); mat.setBlendType(RenderMaterial::Additive); Anglef eObjAngle; eObjAngle.setPitch(m_yaw); eObjAngle.setYaw(0); eObjAngle.setRoll(0); float vv = 1.f + (std::sin(arxtime.get_updated() * ( 1.0f / 1000 ))); vv *= ( 1.0f / 2 ); vv += 1.1f; Draw3DObject(ssol, eObjAngle, eSrc + Vec3f(0.f, -5.f, 0.f), Vec3f(vv), Color3f(0.6f, 0.6f, 0.8f), mat); vv *= 100.f; for(int n = 0; n < 4; n++) { PARTICLE_DEF * pd = createParticle(); if(!pd) { break; } float dx = -std::sin(frand2() * 360.f) * vv; float dz = std::cos(frand2() * 360.f) * vv; pd->ov = eSrc + Vec3f(dx, 0.f, dz); pd->move = Vec3f(0.8f * frand2(), -4.f * rnd(), 0.8f * frand2()); pd->scale = Vec3f(-0.1f); pd->tolive = Random::get(2600, 3200); pd->tc = tex_p2; pd->siz = 0.3f; pd->rgb = Color3f(.4f, .4f, .6f); } if(!lightHandleIsValid(lLightId)) { lLightId = GetFreeDynLight(); } if(lightHandleIsValid(lLightId)) { EERIE_LIGHT * light = lightHandleGet(lLightId); light->intensity = 2.3f; light->fallend = 350.f; light->fallstart = 150.f; light->rgb = Color3f(0.8f, 0.8f, 1.f); light->pos = eSrc + Vec3f(0.f, -50.f, 0.f); light->duration = 200; light->time_creation = (unsigned long)(arxtime); } }
void NegateMagicSpell::Update() { LaunchAntiMagicField(); if(m_target == EntityHandle_Player) { m_pos = player.basePosition(); } else { Entity * target = entities.get(m_target); if(target) { m_pos = target->pos; } } Vec3f stitepos = m_pos - Vec3f(0.f, 10.f, 0.f); RenderMaterial mat; mat.setLayer(RenderMaterial::Decal); mat.setDepthTest(true); mat.setTexture(tex_sol); mat.setBlendType(RenderMaterial::Additive); for(int i = 0; i < 360; i++) { float t = Random::getf(); if(t < 0.04f) { PARTICLE_DEF * pd = createParticle(); if(!pd) { break; } pd->ov = stitepos + arx::randomOffsetXZ(150.f); pd->move = Vec3f(0.f, Random::getf(-3.f, 0.f), 0.f); pd->siz = 0.3f; pd->tolive = Random::getu(2000, 4000); pd->tc = tex_p2; pd->m_flags = FADE_IN_AND_OUT | ROTATING | DISSIPATING | SUBSTRACT; pd->m_rotation = 0.0000001f; } } float rot = timeWaveSaw(g_gameTime.now(), GameDurationMs(18000)) * 360.f; Anglef stiteangle(0.f, -rot, 0.f); float scalediff = timeWaveSin(g_gameTime.now(), GameDurationMsf(1570.79632f)); { Color3f stitecolor = Color3f::gray(.4f); Vec3f stitescale = Vec3f(3.f + 0.5f * scalediff); Draw3DObject(ssol, stiteangle, stitepos, stitescale, stitecolor, mat); } { Color3f stitecolor = Color3f(.5f, 0.f, .5f); Vec3f stitescale = Vec3f(3.1f + 0.2f * scalediff); Draw3DObject(ssol, stiteangle, stitepos, stitescale, stitecolor, mat); } }
CCParticleBatchNode* AppConfig::createParticleBatchNode(const char * plistFileName, unsigned particleNodeCount) { CCParticleSystemQuad* particle = CCParticleSystemQuad::create(plistFileName); CCParticleBatchNode* particleBatchNode = CCParticleBatchNode::createWithTexture(particle->getTexture()); for(unsigned index = 0; index < particleNodeCount; index++) createParticle(plistFileName,particleBatchNode); return particleBatchNode; }
// ----------------------------------------------------- void MSAParticleSystem3D::addParticle( Vec3f _pos ) { MSAParticleGroup3D * current_group = 0; TT_Custom_MSAParticle3D * p = createParticle(_pos); current_group = maingroup; current_group->addParticle( p ); p->release(); }