当前位置: 首页>>代码示例>>C++>>正文


C++ ParticleSystem::Update方法代码示例

本文整理汇总了C++中ParticleSystem::Update方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleSystem::Update方法的具体用法?C++ ParticleSystem::Update怎么用?C++ ParticleSystem::Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParticleSystem的用法示例。


在下文中一共展示了ParticleSystem::Update方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LaunchMagicMissileExplosion

static void LaunchMagicMissileExplosion(const Vec3f & _ePos, bool mrCheat) {
	
	ParticleParams cp = g_particleParameters[ParticleParam_MagicMissileExplosion];
	
	if(mrCheat) {
		cp = g_particleParameters[ParticleParam_MagicMissileExplosionMar];
	}
	
	ParticleSystem * pPS = new ParticleSystem();
	pPS->SetParams(cp);
	pPS->SetPos(_ePos);
	pPS->Update(0);
	
	EERIE_LIGHT * light = dynLightCreate();
	if(light) {
		light->intensity = 2.3f;
		light->fallstart = 250.f;
		light->fallend   = 420.f;

		if(mrCheat) {
			light->rgb = Color3f(1.f, 0.3f, .8f);
		} else {
			light->rgb = Color3f(0.f, 0.f, .8f);
		}

		light->pos = _ePos;
		light->duration = ArxDurationMs(1500);
	}

	arx_assert(pParticleManager);
	pParticleManager->AddSystem(pPS);

	ARX_SOUND_PlaySFX(SND_SPELL_MM_HIT, &_ePos);
}
开发者ID:Dimoks,项目名称:ArxLibertatis_fork,代码行数:34,代码来源:SpellsLvl01.cpp

示例2: DrawParticles

void DrawParticles ()
{
	Shaders::SetShader("Particles");
	EnableTexturing();
	EnableBlending();
	Matrices::SetViewMatrix(matrix2x3::Identity());
	Matrices::SetModelMatrix(matrix2x3::Identity());
	for (std::list<ParticleSystem*>::iterator iter = particleSystems.begin();
	                                          iter != particleSystems.end();
	                                          ++iter)
	{
		ParticleSystem* ps = *iter;
		bool isDead = ps->Update();
		if (isDead)
		{
			std::list<ParticleSystem*>::iterator iterCopy = iter;
			++iter;
			particleSystems.erase(iterCopy);
			delete ps;
			if (iter == particleSystems.end())
				break;
		}
		ps->Draw();
	}
}
开发者ID:prophile,项目名称:xsera,代码行数:25,代码来源:Graphics.cpp

示例3: LaunchPoisonExplosion

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);
}
开发者ID:nemyax,项目名称:ArxLibertatis,代码行数:52,代码来源:Spells05.cpp

示例4: Update

//*************************************************************************************************************
void Update(float delta)
{
	D3DXVECTOR2 velocity(mousedx, mousedy);

	cameraangle.prev = cameraangle.curr;

	if( mousedown == 1 )
		cameraangle.curr += velocity * 0.004f;

	// clamp to [-pi, pi]
	if( cameraangle.curr.y >= 1.5f )
		cameraangle.curr.y = 1.5f;

	if( cameraangle.curr.y <= -1.5f )
		cameraangle.curr.y = -1.5f;

	system1.Update();
}
开发者ID:IwishIcanFLighT,项目名称:Asylum_Tutorials,代码行数:19,代码来源:main.cpp

示例5: LaunchMagicMissileExplosion

static void LaunchMagicMissileExplosion(const Vec3f & _ePos, bool mrCheat) {
	
	ParticleParams cp = MagicMissileExplosionParticle();
	
	if(mrCheat) {
		cp = MagicMissileExplosionMrCheatParticle();
	}
	
	ParticleSystem * pPS = new ParticleSystem();
	pPS->SetParams(cp);
	pPS->SetPos(_ePos);
	pPS->Update(0);

	LightHandle id = GetFreeDynLight();

	if(lightHandleIsValid(id)) {
		EERIE_LIGHT * light = lightHandleGet(id);
		
		light->intensity = 2.3f;
		light->fallstart = 250.f;
		light->fallend   = 420.f;

		if(mrCheat) {
			light->rgb.r = 1.f;
			light->rgb.g = 0.3f;
			light->rgb.b = .8f;
		} else {
			light->rgb.r = 0.f;
			light->rgb.g = 0.f;
			light->rgb.b = .8f;
		}

		light->pos = _ePos;
		light->duration = 1500;
	}

	arx_assert(pParticleManager);
	pParticleManager->AddSystem(pPS);

	ARX_SOUND_PlaySFX(SND_SPELL_MM_HIT, &_ePos);
}
开发者ID:byouloh,项目名称:ArxLibertatis,代码行数:41,代码来源:Spells01.cpp

示例6: LaunchPoisonExplosion

static void LaunchPoisonExplosion(const Vec3f & aePos) {
	
	// système de partoches pour l'explosion
	ParticleSystem * pPS = new ParticleSystem();
	
	pPS->SetParams(g_particleParameters[ParticleParam_Poison1]);
	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));
		}
	}

	g_particleManager.AddSystem(pPS);
}
开发者ID:arx,项目名称:ArxLibertatis,代码行数:21,代码来源:Spells05.cpp

示例7: Update

//-----------------------------------------------------------------------------
void ParticleManager::Update(long _lTime)
{
	if (listParticleSystem.empty()) return;

	list<ParticleSystem *>::iterator i;
	i = listParticleSystem.begin();

	while (i != listParticleSystem.end())
	{
		ParticleSystem * p = *i;
		++i;

		if (!p->IsAlive())
		{
			delete p;
			listParticleSystem.remove(p);
		}
		else
		{
			p->Update(_lTime);
		}
	}
}
开发者ID:lemmel,项目名称:ArxLibertatis,代码行数:24,代码来源:ParticleManager.cpp

示例8: Create


//.........这里部分代码省略.........
	cp.fStartSize = 0;
	cp.fStartSizeRandom = 1; 
	cp.fStartColor[0] = 20;
	cp.fStartColor[1] = 20;
	cp.fStartColor[2] = 20;
	cp.fStartColor[3] = 50;
	cp.fStartColorRandom[0] = 0;
	cp.fStartColorRandom[1] = 0;
	cp.fStartColorRandom[2] = 0;
	cp.fStartColorRandom[3] = 50;

	cp.fEndSize = 1; 
	cp.fEndSizeRandom = 4;
	cp.fEndColor[0] = 20;
	cp.fEndColor[1] = 20;
	cp.fEndColor[2] = 20;
	cp.fEndColor[3] = 10;
	cp.fEndColorRandom[0] = 0;
	cp.fEndColorRandom[1] = 0;
	cp.fEndColorRandom[2] = 0;
	cp.fEndColorRandom[3] = 0;

	cp.iBlendMode = 5;

	pPS->SetParams(cp);
	pPS->ulParticleSpawn = 0;
	pPS->SetTexture("graph/particles/lil_greypouf", 0, 200);

	Vec3f ep;
	ep.x = aePos->x;
	ep.y = aePos->y - 80;
	ep.z = aePos->z;
	pPS->SetPos(ep);
	pPS->Update(0);
	pPS->iParticleNbMax = 0;

	if (pParticleManager)
	{
		pParticleManager->AddSystem(pPS);
	} else {
		// TODO memory leak (pPS)?
	}

	// système de partoches pour la poussière au sol
	pPS = new ParticleSystem();
	
	cp.iNbMax = 20;
	cp.fLife = 1000; //2000
	cp.fLifeRandom = 2000;
	cp.p3Pos.x = 20;
	cp.p3Pos.y = 5;
	cp.p3Pos.z = 20;
	cp.p3Direction.x = 0;
	cp.p3Direction.y = -10;
	cp.p3Direction.z = 0;
	cp.fAngle = radians(144);
	cp.fSpeed = 10;
	cp.fSpeedRandom = 10;
	cp.p3Gravity.x = 0;
	cp.p3Gravity.y = -4;
	cp.p3Gravity.z = 0;
	cp.fFlash = 0;
	cp.fRotation = 0;

	cp.fStartSize = 2;
	cp.fStartSizeRandom = 2; 
开发者ID:EstrangedGames,项目名称:ArxLibertatis,代码行数:67,代码来源:Spells06.cpp

示例9: LaunchPoisonExplosion

void LaunchPoisonExplosion(Vec3f * aePos) {
	
	// système de partoches pour l'explosion
	ParticleSystem * pPS = new ParticleSystem();
	ParticleParams cp;
	cp.iNbMax = 80; 
	cp.fLife = 1500;
	cp.fLifeRandom = 500;
	cp.p3Pos = Vec3f::repeat(5);
	cp.p3Direction.x = 0;
	cp.p3Direction.y = 4;
	cp.p3Direction.z = 0;
	cp.fAngle = radians(360);
	cp.fSpeed = 200;
	cp.fSpeedRandom = 0;
	cp.p3Gravity.x = 0;
	cp.p3Gravity.y = 17;
	cp.p3Gravity.z = 0;
	cp.fFlash = 0;
	cp.fRotation = 80;
	cp.bRotationRandomDirection = true;
	cp.bRotationRandomStart = true;

	cp.fStartSize = 5;
	cp.fStartSizeRandom = 3;
	cp.fStartColor[0] = 0;
	cp.fStartColor[1] = 76;
	cp.fStartColor[2] = 0;
	cp.fStartColor[3] = 0;
	cp.fStartColorRandom[0] = 0;
	cp.fStartColorRandom[1] = 0;
	cp.fStartColorRandom[2] = 0;
	cp.fStartColorRandom[3] = 150; 
	cp.bStartLock = false;

	cp.fEndSize = 30;
	cp.fEndSizeRandom = 5;
	cp.fEndColor[0] = 0;
	cp.fEndColor[1] = 0;
	cp.fEndColor[2] = 0;
	cp.fEndColor[3] = 0;
	cp.fEndColorRandom[0] = 0;
	cp.fEndColorRandom[1] = 25; 
	cp.fEndColorRandom[2] = 0;
	cp.fEndColorRandom[3] = 20; 
	cp.bEndLock = false;

	cp.iBlendMode = 3;
	cp.iFreq = -1;
	cp.bTexInfo = false;
	pPS->SetParams(cp);
	pPS->ulParticleSpawn = 0;
	pPS->SetTexture("graph/particles/big_greypouf", 0, 200);

	pPS->SetPos(*aePos);
	pPS->Update(0);
	pPS->iParticleNbMax = 0;

	std::list<Particle *>::iterator i;

	for (i = pPS->listParticle.begin(); i != pPS->listParticle.end(); ++i)
	{
		Particle * pP = *i;

		if (pP->isAlive())
		{
			if (pP->p3Velocity.y >= 0.5f * 200)
				pP->p3Velocity.y = 0.5f * 200;

			if (pP->p3Velocity.y <= -0.5f * 200)
				pP->p3Velocity.y = -0.5f * 200;
		}
	}

	if (pParticleManager)
	{
		pParticleManager->AddSystem(pPS);
	}
}
开发者ID:Eli2,项目名称:ArxLibertatis,代码行数:79,代码来源:Spells05.cpp

示例10: LaunchMagicMissileExplosion

void LaunchMagicMissileExplosion(const Vec3f & _ePos, int t = 0, long spellinstance = -1)
{
	// système de partoches pour l'explosion
	ParticleSystem * pPS = new ParticleSystem();
	ParticleParams cp;
	memset(&cp, 0, sizeof(cp));
	cp.iNbMax = 100 + t * 50;
	cp.fLife = 1500;
	cp.fLifeRandom = 0;
	cp.p3Pos = Vec3f(10.f);
	cp.p3Direction = Vec3f(0.f, -10.f, 0.f);
	cp.fAngle = radians(360);
	cp.fSpeed = 130;
	cp.fSpeedRandom = 100;
	cp.p3Gravity = Vec3f(0.f, 10.f, 0.f);
	cp.fFlash = 0;
	cp.fRotation = 16;

	cp.fStartSize = 5;
	cp.fStartSizeRandom = 10;


	cp.fEndSize = 0;
	cp.fEndSizeRandom = 2;

	if(spellinstance >= 0 && spells[spellinstance].caster == 0 && cur_mr == 3) {
		cp.fStartSize = 20;
		cp.fSpeed = 13;
		cp.fSpeedRandom = 10;
		cp.fStartColorRandom[0] = 0;
		cp.fStartColorRandom[1] = 0;
		cp.fStartColorRandom[2] = 0;
		cp.fStartColorRandom[3] = 0;

		cp.fStartColor[0] = 0;
		cp.fStartColor[1] = 0;
		cp.fStartColor[2] = 0;
		cp.fStartColor[3] = 0;
		cp.fEndColor[0] = 255;
		cp.fEndColor[1] = 40;
		cp.fEndColor[2] = 120;
		cp.fEndColor[3] = 10;//55;
		pPS->SetTexture("graph/particles/(fx)_mr", 0, 500);
	} else {
		cp.fStartColorRandom[0] = 100;
		cp.fStartColorRandom[1] = 100;
		cp.fStartColorRandom[2] = 100;
		cp.fStartColorRandom[3] = 100;

		cp.fStartColor[0] = 110;
		cp.fStartColor[1] = 110;
		cp.fStartColor[2] = 110;
		cp.fStartColor[3] = 110;
		cp.fEndColor[0] = 0;
		cp.fEndColor[1] = 0;
		cp.fEndColor[2] = 120;
		cp.fEndColor[3] = 10;
		pPS->SetTexture("graph/particles/magicexplosion", 0, 500);
	}

	cp.fEndColorRandom[0] = 50;
	cp.fEndColorRandom[1] = 50;
	cp.fEndColorRandom[2] = 50;
	cp.fEndColorRandom[3] = 50;

	cp.blendMode = RenderMaterial::Additive;

	pPS->SetParams(cp);
	pPS->ulParticleSpawn = 0;
	
	Vec3f eP = _ePos;
	
	pPS->SetPos(eP);
	pPS->Update(0);
	pPS->iParticleNbMax = 0;

	long id = GetFreeDynLight();

	if(id != -1) {
		DynLight[id].exist = 1;
		DynLight[id].intensity = 2.3f;
		DynLight[id].fallstart = 250.f;
		DynLight[id].fallend   = 420.f;

		if(spellinstance >= 0 && spells[spellinstance].caster == 0 && cur_mr == 3) {
			DynLight[id].rgb.r = 1.f;
			DynLight[id].rgb.g = 0.3f;
			DynLight[id].rgb.b = .8f;
		} else {
			DynLight[id].rgb.r = 0.f;
			DynLight[id].rgb.g = 0.f;
			DynLight[id].rgb.b = .8f;
		}

		DynLight[id].pos = eP;
		DynLight[id].duration = 1500;
	}

	if(pParticleManager)
		pParticleManager->AddSystem(pPS);
//.........这里部分代码省略.........
开发者ID:zhaozw,项目名称:ArxLibertatis,代码行数:101,代码来源:Spells01.cpp

示例11: Update

void Update( void )
{
	fireParticles.Update();
	smokeParticles.Update();
}
开发者ID:Alyanorno,项目名称:particle_system,代码行数:5,代码来源:main.cpp


注:本文中的ParticleSystem::Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。