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


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

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


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

示例1: AddParticleEmitterNodeToScene

void ParticlesEditorController::AddParticleEmitterNodeToScene(Entity* emitterSceneNode)
{
    // We are adding new Emitter to the Particle Effect node just selected.
    Entity* effectNode = NULL;
    BaseParticleEditorNode* selectedNode = GetSelectedNode();
    if (selectedNode)
    {
        effectNode = selectedNode->GetRootNode();
    }
    
    EffectParticleEditorNode* effectEditorNode = GetRootForParticleEffectNode(effectNode);
    if (effectNode && effectEditorNode)
    {
        EmitterParticleEditorNode* emitterEditorNode = new EmitterParticleEditorNode(effectNode, emitterSceneNode,
                                                                                     QString::fromStdString(emitterSceneNode->GetName()));
		
		ParticleEmitter * emitter = GetEmitter(emitterSceneNode);
		if (!emitter)
		{
		    return;
		}
		emitter->SetLifeTime(LIFETIME_FOR_NEW_PARTICLE_EMITTER);

        effectNode->AddNode(emitterSceneNode);
        effectEditorNode->AddChildNode(emitterEditorNode);
    }
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例2: UpdateDurationForChildNodes

void ParticleEffectComponent::UpdateDurationForChildNodes(float32 newEmitterLifeTime)
{
	int32 childrenCount = entity->GetChildrenCount();
	for (int32 i = 0; i < childrenCount; i ++)
	{
		RenderComponent * component = static_cast<RenderComponent*>(entity->GetChild(i)->GetComponent(Component::RENDER_COMPONENT));
		if(component && component->GetRenderObject() && component->GetRenderObject()->GetType() == RenderObject::TYPE_PARTICLE_EMTITTER)
		{
			ParticleEmitter * emitter = static_cast<ParticleEmitter*>(component->GetRenderObject());
			emitter->SetLifeTime(newEmitterLifeTime);
		}
	}
}
开发者ID:vilonosec,项目名称:dava.framework,代码行数:13,代码来源:ParticleEffectComponent.cpp

示例3:

RenderObject * ParticleEmitter3D::Clone(RenderObject *newObject)
{
	if(!newObject)
	{
		DVASSERT_MSG(IsPointerToExactClass<ParticleEmitter3D>(this), "Can clone only ParticleEmitter3D");
		newObject = new ParticleEmitter3D();
	}
	else
	{
		CleanupLayers();
		ReleaseFromCache(static_cast<ParticleEmitter *>(newObject)->emitterFileName);
	}

	ParticleEmitter* clonedEmitter = static_cast<ParticleEmitter*>(newObject);
	clonedEmitter->SetConfigPath(this->configPath);
	clonedEmitter->SetPosition(this->position);
	clonedEmitter->SetAngle(this->angle);
	
	clonedEmitter->SetLifeTime(this->lifeTime);
	clonedEmitter->SetRepeatCount(this->repeatCount);
	clonedEmitter->SetTime(this->time);
	clonedEmitter->SetEmitPointsCount(this->emitPointsCount);
	clonedEmitter->SetPaused(this->isPaused);
	clonedEmitter->SetAutoRestart(this->isAutorestart);
	clonedEmitter->SetParticlesFollow(this->particlesFollow);
	clonedEmitter->Set3D(this->is3D);
	clonedEmitter->SetPlaybackSpeed(this->playbackSpeed);

	clonedEmitter->SetInitialTranslationVector(this->initialTranslationVector);

	if (this->emissionVector)
	{
		clonedEmitter->emissionVector = this->emissionVector->Clone();
        clonedEmitter->emissionVector->Release();
	}
	if (this->emissionAngle)
	{
		clonedEmitter->emissionAngle = this->emissionAngle->Clone();
        clonedEmitter->emissionAngle->Release();
	}
	if (this->emissionRange)
	{
		clonedEmitter->emissionRange = this->emissionRange->Clone();
        clonedEmitter->emissionRange->Release();
	}
	if (this->radius)
	{
		clonedEmitter->radius = this->radius->Clone();
        clonedEmitter->radius->Release();
	}
	if (this->colorOverLife)
	{
		clonedEmitter->colorOverLife = this->colorOverLife->Clone();
        clonedEmitter->colorOverLife->Release();
	}
	if (this->size)
	{
		clonedEmitter->size = this->size->Clone();
        clonedEmitter->size->Release();
	}
	
	clonedEmitter->emitterType = this->emitterType;
	clonedEmitter->currentColor = this->currentColor;
	clonedEmitter->SetShortEffect(shortEffect);
	
	// Now can add Layers. Need to update their parents.
	for (Vector<ParticleLayer*>::iterator iter = this->layers.begin(); iter != this->layers.end();
		 iter ++)
	{
		ParticleLayer* clonedLayer = (*iter)->Clone(NULL);
		ParticleLayer3D* clonedLayer3D = dynamic_cast<ParticleLayer3D*>(clonedLayer);
		if (clonedLayer3D)
		{
			clonedLayer3D->SetParent(clonedEmitter);
		}

		clonedEmitter->AddLayer(clonedLayer);
		SafeRelease(clonedLayer);
	}

	time = 0.0f;
	repeatCount = 0;
	lodLevelLocked = false;
	currentLodLevel = desiredLodLevel;

	clonedEmitter->emitterFileName = emitterFileName;
	RetainInCache(emitterFileName);

	return newObject;
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:90,代码来源:ParticleEmitter3D.cpp


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