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


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

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


在下文中一共展示了ParticleEmitter::setColour方法的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: generateGlow

void Pod::generateGlow(PodColor color, PodShape shape)
{
    if (!glowNode)
    {
        std::string particleName = "General/GlowPod";
        Ogre::ColourValue particleValue;
        switch (color)
        {
            case POD_COLOR_BLUE:
                particleValue.r = 0.1;
                particleValue.g = 0.3;
                particleValue.b = 1.0;
                break;
            case POD_COLOR_GREEN:
                particleValue.r = 0.0;
                particleValue.g = 1.0;
                particleValue.b = 0.0;
                break;
            case POD_COLOR_PINK:
                particleValue.r = 1.0;
                particleValue.g = 0.0;
                particleValue.b = 0.0;
                break;
            case POD_COLOR_YELLOW:
                particleValue.r = 1.0;
                particleValue.g = 1.0;
                particleValue.b = 0.0;
                break;
            default:
                particleValue.r = 0.5;
                particleValue.g = 0.5;
                particleValue.b = 1.0;
                break;
        }
        
        switch (shape)
        {
            case POD_SHAPE_CONE:
                particleName += "Cylinder";
                break;
            case POD_SHAPE_DIAMOND:
                particleName += "Box";
                break;
            case POD_SHAPE_SPHERE:
                particleName += "Ellipsoid";
                break;
            case POD_SHAPE_TRIANGLE:
                particleName += "Ellipsoid"; // No ogre particle shape for tris
                break;
            case POD_SHAPE_HOLDOUT:
                particleName += "Ellipsoid";
                break;
            default:
                particleName += "Cylinder";
                break;
        }
        
        // Make independent to avoid rotation orientions when translating.
        glowNode = OgreFramework::getSingletonPtr()->m_pSceneMgrMain->getRootSceneNode()->createChildSceneNode("GlowNode" + Util::toStringInt(glowID));
        glowEffect = glowNode->getCreator()->createParticleSystem("GlowEffect" + Util::toStringInt(glowID), particleName);
        ParticleEmitter* glowEmitter = glowEffect->getEmitter(0); // Assuming only one emitter
        
        glowEmitter->setColour(particleValue);
        
        glowNode->attachObject(glowEffect);
        glowNode->setPosition(head->_getDerivedPosition());
        ++glowID;
    }
}
开发者ID:fancymans,项目名称:brain-game,代码行数:69,代码来源:Pod.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::setColour方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。