本文整理汇总了C++中ParticleEmitter::AddLayer方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleEmitter::AddLayer方法的具体用法?C++ ParticleEmitter::AddLayer怎么用?C++ ParticleEmitter::AddLayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleEmitter
的用法示例。
在下文中一共展示了ParticleEmitter::AddLayer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CloneParticleLayerNode
LayerParticleEditorNode* ParticlesEditorController::CloneParticleLayerNode(LayerParticleEditorNode* layerToClone)
{
if (!layerToClone || !layerToClone->GetLayer())
{
return NULL;
}
EmitterParticleEditorNode* emitterNode = layerToClone->GetEmitterEditorNode();
if (!emitterNode)
{
return NULL;
}
ParticleEmitter* emitter = emitterNode->GetParticleEmitter();
if (!emitter)
{
return NULL;
}
ParticleLayer* clonedLayer = layerToClone->GetLayer()->Clone();
emitter->AddLayer(clonedLayer);
LayerParticleEditorNode* clonedEditorNode = new LayerParticleEditorNode(emitterNode, clonedLayer);
emitterNode->AddChildNode(clonedEditorNode);
return clonedEditorNode;
}
示例2: PerformMoveBetweenEmitters
bool ParticlesEditorController::PerformMoveBetweenEmitters(EmitterParticleEditorNode* oldEmitterNode,
EmitterParticleEditorNode* newEmitterNode,
LayerParticleEditorNode* layerNodeToMove,
LayerParticleEditorNode* layerNodeToInsertAbove)
{
ParticleEmitter* oldParentEmitter = oldEmitterNode->GetParticleEmitter();
ParticleEmitter* newParentEmitter = newEmitterNode->GetParticleEmitter();
if (!oldParentEmitter || !newParentEmitter)
{
return false;
}
// Move the Editor node. layerNodeToInsertAbove is allowed to be NULL.
newEmitterNode->AddChildNodeAbove(layerNodeToMove, layerNodeToInsertAbove);
oldEmitterNode->RemoveChildNode(layerNodeToMove, false);
// Move the Particle Layers themselves.
ParticleLayer* layerToMove = layerNodeToMove->GetLayer();
ParticleLayer* layerToInsertAbove = NULL;
if (layerNodeToInsertAbove)
{
layerToInsertAbove = layerNodeToInsertAbove->GetLayer();
}
SafeRetain(layerToMove);
oldParentEmitter->RemoveLayer(layerToMove);
newParentEmitter->AddLayer(layerToMove, layerToInsertAbove);
SafeRelease(layerToMove);
// Update the emitter.
layerNodeToMove->UpdateEmitterEditorNode(newEmitterNode);
return true;
}
示例3: AddParticleLayerToNode
LayerParticleEditorNode* ParticlesEditorController::AddParticleLayerToNode(EmitterParticleEditorNode* emitterNode)
{
if (!emitterNode)
{
return NULL;
}
ParticleEmitter* emitter = emitterNode->GetParticleEmitter();
if (!emitter)
{
return NULL;
}
// Create the new layer.
ParticleLayer *layer;
if(emitter->GetIs3D())
{
layer = new ParticleLayer3D(emitter);
}
else
{
layer = new ParticleLayer();
}
layer->startTime = 0;
layer->endTime = LIFETIME_FOR_NEW_PARTICLE_EMITTER;
layer->life = new PropertyLineValue<float32>(emitter->GetLifeTime());
layer->layerName = String("Layer");
emitter->AddLayer(layer);
// Create the new node and add it to the tree.
LayerParticleEditorNode* layerNode = new LayerParticleEditorNode(emitterNode, layer);
emitterNode->AddChildNode(layerNode);
SafeRelease(layer);
return layerNode;
}
示例4:
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;
}