mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-08-15 14:43:32 -07:00
Removes Unattach from emitter
We don't really need that proxy. As the main idea is to move the ownership from a model to the particle manager.
This commit is contained in:
parent
961dfc9279
commit
8491b7f084
4 changed files with 7 additions and 17 deletions
|
|
@ -381,12 +381,6 @@ void CParticleEmitter::RenderArray(
|
||||||
g_Renderer.GetStats().m_Particles += m_NumberOfVisibleParticles;
|
g_Renderer.GetStats().m_Particles += m_NumberOfVisibleParticles;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleEmitter::Unattach(const CParticleEmitterPtr& self)
|
|
||||||
{
|
|
||||||
m_Active = false;
|
|
||||||
m_Type->m_Manager.AddUnattachedEmitter(self);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CParticleEmitter::AddParticle(const SParticle& particle)
|
void CParticleEmitter::AddParticle(const SParticle& particle)
|
||||||
{
|
{
|
||||||
if (m_NextParticleIdx >= m_Particles.size())
|
if (m_NextParticleIdx >= m_Particles.size())
|
||||||
|
|
@ -410,7 +404,7 @@ CModelParticleEmitter::CModelParticleEmitter(const CParticleEmitterTypePtr& type
|
||||||
|
|
||||||
CModelParticleEmitter::~CModelParticleEmitter()
|
CModelParticleEmitter::~CModelParticleEmitter()
|
||||||
{
|
{
|
||||||
m_Emitter->Unattach(m_Emitter);
|
m_Type->m_Manager.AddUnattachedEmitter(std::move(m_Emitter));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModelParticleEmitter::SetEntityVariable(const std::string& name, float value)
|
void CModelParticleEmitter::SetEntityVariable(const std::string& name, float value)
|
||||||
|
|
|
||||||
|
|
@ -150,15 +150,6 @@ public:
|
||||||
void RenderArray(
|
void RenderArray(
|
||||||
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
Renderer::Backend::IDeviceCommandContext* deviceCommandContext);
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop this emitter emitting new particles, and pass responsibility for rendering
|
|
||||||
* to the CParticleManager. This should be called before dropping the last std::shared_ptr
|
|
||||||
* to this object so that it will carry on rendering (until all particles have dissipated)
|
|
||||||
* even when it's no longer attached to a model.
|
|
||||||
* @param self the std::shared_ptr you're about to drop
|
|
||||||
*/
|
|
||||||
void Unattach(const CParticleEmitterPtr& self);
|
|
||||||
|
|
||||||
void SetEntityVariable(const std::string& name, float value);
|
void SetEntityVariable(const std::string& name, float value);
|
||||||
|
|
||||||
CParticleEmitterTypePtr m_Type;
|
CParticleEmitterTypePtr m_Type;
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ CParticleEmitterTypePtr CParticleManager::LoadEmitterType(const VfsPath& path)
|
||||||
|
|
||||||
void CParticleManager::AddUnattachedEmitter(const CParticleEmitterPtr& emitter)
|
void CParticleManager::AddUnattachedEmitter(const CParticleEmitterPtr& emitter)
|
||||||
{
|
{
|
||||||
|
emitter->m_Active = false;
|
||||||
m_UnattachedEmitters.push_back(emitter);
|
m_UnattachedEmitters.push_back(emitter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,11 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tell the manager to handle rendering of an emitter that is no longer
|
* Tell the manager to handle rendering of an emitter that is no longer
|
||||||
* attached to a unit.
|
* attached to a unit. After the call the emitter becomes inactive.
|
||||||
|
*
|
||||||
|
* This should be called before dropping the emitter so that the manager
|
||||||
|
* will carry on rendering (until all particles have dissipated)
|
||||||
|
* even when it's no longer attached to a model.
|
||||||
*/
|
*/
|
||||||
void AddUnattachedEmitter(const CParticleEmitterPtr& emitter);
|
void AddUnattachedEmitter(const CParticleEmitterPtr& emitter);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue