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


C++ ParticleEmitter::setDirection方法代码示例

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


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

示例1: updateVisuals

void Turboprop::updateVisuals(RoR::GfxActor* gfx_actor)
{
    RoR::GfxActor::NodeData* node_buf = gfx_actor->GetSimNodeBuffer();

    //smoke
    if (smokeNode)
    {
        smokeNode->setPosition(node_buf[nodeback].AbsPosition);
        ParticleEmitter* emit = smokePS->getEmitter(0);
        Vector3 dir = node_buf[nodeback].AbsPosition - node_buf[noderef].AbsPosition;
        emit->setDirection(dir);
        emit->setParticleVelocity(propwash - propwash / 10, propwash + propwash / 10);
        if (!failed)
        {
            if (ignition)
            {
                emit->setEnabled(true);
                emit->setColour(ColourValue(0.0, 0.0, 0.0, 0.03 + throtle * 0.05));
                emit->setTimeToLive((0.03 + throtle * 0.05) / 0.1);
            }
            else
            {
                emit->setEnabled(false);
            }
        }
        else
        {
            emit->setDirection(Vector3(0, 1, 0));
            emit->setParticleVelocity(5, 9);
            emit->setEnabled(true);
            emit->setColour(ColourValue(0.0, 0.0, 0.0, 0.1));
            emit->setTimeToLive(0.1 / 0.1);
        }
    }

#ifdef USE_ANGELSCRIPT
    if (failed != failedold)
    {
        TRIGGER_EVENT(SE_TRUCK_ENGINE_FIRE, trucknum);
        failedold = failed;
    }
#endif
}
开发者ID:Speciesx,项目名称:rigs-of-rods,代码行数:43,代码来源:TurboProp.cpp

示例2: Update


//.........这里部分代码省略.........
	
	if (changed)
		UpdateLightMap();
		

	//  update particle emitters
	if (pSet->particles && pCar)
	{
		//  boost
		for (i=0; i < PAR_BOOST; ++i)  if (parBoost[i])
		{
			/// <><> damage reduce
			float dmg = pCar->dynamics.fDamage >= 80.f ? 0.f : std::max(0.f, 1.4f - pCar->dynamics.fDamage*0.01f);
			float emitB = posInfo.fboost * 40.f * dmg;  // par
			ParticleEmitter* pe = parBoost[i]->getEmitter(0);
			pe->setEmissionRate(emitB);
		}
		//  spaceship thrusters
		for (i=0; i < PAR_THRUST*2; ++i)  if (parThrust[i])
		{
			float dmg = 1.f - 0.5f * pCar->dynamics.fDamage*0.01f;
			float emitT = posInfo.hov_throttle * 60.f * dmg;  // par
			ParticleEmitter* pe = parThrust[i]->getEmitter(0);
			pe->setEmissionRate(emitT);
		}
	}

	//  world hit
	if (parHit)
	{	ParticleEmitter* pe = parHit->getEmitter(0);
		if (posInfo.fHitTime > 0.f && pSet->particles)
		{
			pe->setPosition(posInfo.vHitPos);
			pe->setDirection(posInfo.vHitNorm);

			pe->setEmissionRate(pSet->particles_len * std::min(160.f, posInfo.fParIntens) * posInfo.fHitTime);
			pe->setParticleVelocity(posInfo.fParVel);
		}else
			pe->setEmissionRate(0.f);
	}

	//  wheels  ------------------------------------------------------------------------
	const float trlH = sc->ter ? 0.90f : 0.76f;  // vdr needs up (ter bumps), no ter  ..get from wheel contact ?rpl

	for (w=0; w < numWheels; ++w)
	{
		float wR = whRadius[w];
		#ifdef CAM_TILT_DBG  // cam debug test only
			if (fCam)
				ndWh[w]->setPosition(fCam->posHit[w]);
			ndWh[w]->setScale(0.5f*Vector3::UNIT_SCALE);
		#else
		ndWh[w]->setPosition(posInfo.whPos[w]);
		#endif
		ndWh[w]->setOrientation(posInfo.whRot[w]);

		///  Update particles and trails
		if (isGhostTrk())
			continue;  // doesnt have any
		
		int whMtr = posInfo.whTerMtr[w];
		int whRd = posInfo.whRoadMtr[w];
		
		bool pipe = whRd >= 30 && whRd < 60;  //old: whRd == 2;
		//todo: road,pipe 4mtr [whRd] layer params..
		float whVel = posInfo.whVel[w] * 3.6f;  //kmh
开发者ID:Mixone-FinallyHere,项目名称:stuntrally,代码行数:67,代码来源:CarModel_Update.cpp

示例3: updateVisuals

void Turbojet::updateVisuals()
{
    //nozzle
    nzsnode->setPosition(nodes[nodeback].AbsPosition);
    //build a local system
    Vector3 laxis = nodes[nodefront].RelPosition - nodes[nodeback].RelPosition;
    laxis.normalise();
    Vector3 paxis = Plane(laxis, 0).projectVector(nodes[noderef].RelPosition - nodes[nodeback].RelPosition);
    paxis.normalise();
    Vector3 taxis = laxis.crossProduct(paxis);
    Quaternion dir = Quaternion(laxis, paxis, taxis);
    nzsnode->setOrientation(dir);
    //afterburner
    if (afterburner)
    {
        absnode->setVisible(true);
        float flamelength = (afterburnthrust / 15.0) * (rpm / 100.0);
        flamelength = flamelength * (1.0 + (((Real)rand() / (Real)RAND_MAX) - 0.5) / 10.0);
        absnode->setScale(flamelength, radius * 2.0, radius * 2.0);
        absnode->setPosition(nodes[nodeback].AbsPosition + dir * Vector3(-0.2, 0.0, 0.0));
        absnode->setOrientation(dir);
    }
    else
        absnode->setVisible(false);
    //smoke
    if (smokeNode)
    {
        smokeNode->setPosition(nodes[nodeback].AbsPosition);
        ParticleEmitter* emit = smokePS->getEmitter(0);
        ParticleEmitter* hemit = 0;
        if (heathazePS)
            hemit = heathazePS->getEmitter(0);
        emit->setDirection(-axis);
        emit->setParticleVelocity(exhaust_velocity);
        if (hemit)
        {
            hemit->setDirection(-axis);
            hemit->setParticleVelocity(exhaust_velocity);
        }
        if (!failed)
        {
            if (ignition)
            {
                emit->setEnabled(true);
                emit->setColour(ColourValue(0.0, 0.0, 0.0, 0.02 + throtle * 0.03));
                emit->setTimeToLive((0.02 + throtle * 0.03) / 0.1);
                if (hemit)
                {
                    hemit->setEnabled(true);
                    hemit->setTimeToLive((0.02 + throtle * 0.03) / 0.1);
                }
            }
            else
            {
                emit->setEnabled(false);
                if (hemit)
                    hemit->setEnabled(false);
            }
        }
        else
        {
            emit->setDirection(Vector3(0, 1, 0));
            emit->setParticleVelocity(7.0);
            emit->setEnabled(true);
            emit->setColour(ColourValue(0.0, 0.0, 0.0, 0.1));
            emit->setTimeToLive(0.1 / 0.1);

            if (hemit)
            {
                hemit->setDirection(Vector3(0, 1, 0));
                hemit->setParticleVelocity(7.0);
                hemit->setEnabled(true);
                hemit->setTimeToLive(0.1 / 0.1);
            }
        }
    }
}
开发者ID:disloyalpick,项目名称:rigs-of-rods,代码行数:77,代码来源:TurboJet.cpp

示例4: update

void DustPool::update(float gspeed)
{
	gspeed=fabs(gspeed);
	for (int i=0; i<allocated; i++)
	{
		ParticleEmitter *emit = pss[i]->getEmitter(0);
		Vector3 ndir = velocities[i];
		Real vel = ndir.length();
		ColourValue col = colours[i];

		if (vel == 0)
			vel += 0.0001;
		ndir = ndir / vel;

		emit->setEnabled(true);

		if (types[i] != DUST_RIPPLE)
		{
			emit->setDirection(ndir);
			emit->setParticleVelocity(vel);
			sns[i]->setPosition(positions[i]);
		}
		

		if (types[i]==DUST_NORMAL)
		{
			ndir.y=0;
			ndir=ndir/2.0;

			col.a=(vel+(gspeed/10.0))*0.05;
			emit->setTimeToLive((vel+(gspeed/10.0))*0.05/0.1);
		}
		else if (types[i]==DUST_CLUMP)
		{
			ndir=ndir/2.0;
			if (ndir.y<0) ndir.y=-ndir.y;

			col.a=1.0;
		} 
		else if (types[i]==DUST_RUBBER)
		{
			ndir.y=0;
			ndir=ndir/4.0;

			col.a = vel*0.05;
			col.b = 0.9;
			col.g = 0.9;
			col.r = 0.9;

			emit->setTimeToLive(vel*0.05/0.1);
		} 
		else if (types[i]==DUST_SPARKS)
		{
			//ugh
		} 
		else if (types[i]==DUST_VAPOUR)
		{
			emit->setParticleVelocity(vel/2.0);

			col.a = rates[i] * 0.03;
			col.b = 0.9;
			col.g = 0.9;
			col.r = 0.9;

			emit->setTimeToLive(rates[i]*0.03/0.1);
		} 
		else if (types[i]==DUST_DRIP)
		{
			emit->setEmissionRate(rates[i]);
		} 
		else if (types[i]==DUST_SPLASH)
		{
			if (ndir.y<0) 
				ndir.y=-ndir.y/2.0;

			emit->setDirection(ndir);

			col.a = vel*0.05;
			col.b = 0.9;
			col.g = 0.9;
			col.r = 0.9;

			emit->setTimeToLive(vel*0.05/0.1);
		} 
		else if (types[i]==DUST_RIPPLE)
		{
			positions[i].y = gEnv->terrainManager->getWater()->getHeight() - 0.02;
			sns[i]->setPosition(positions[i]);

			col.a = vel*0.04;
			col.b = 0.9;
			col.g = 0.9;
			col.r = 0.9;

			emit->setTimeToLive(vel*0.04/0.1);
		}

		emit->setColour(col);
	}
	for (int i=allocated; i<size; i++)
//.........这里部分代码省略.........
开发者ID:Clever-Boy,项目名称:rigs-of-rods,代码行数:101,代码来源:DustPool.cpp


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