mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-10 02:17:00 +00: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:
@@ -381,12 +381,6 @@ void CParticleEmitter::RenderArray(
|
||||
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)
|
||||
{
|
||||
if (m_NextParticleIdx >= m_Particles.size())
|
||||
@@ -410,7 +404,7 @@ CModelParticleEmitter::CModelParticleEmitter(const CParticleEmitterTypePtr& type
|
||||
|
||||
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)
|
||||
|
||||
@@ -150,15 +150,6 @@ public:
|
||||
void RenderArray(
|
||||
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);
|
||||
|
||||
CParticleEmitterTypePtr m_Type;
|
||||
|
||||
@@ -61,6 +61,7 @@ CParticleEmitterTypePtr CParticleManager::LoadEmitterType(const VfsPath& path)
|
||||
|
||||
void CParticleManager::AddUnattachedEmitter(const CParticleEmitterPtr& emitter)
|
||||
{
|
||||
emitter->m_Active = false;
|
||||
m_UnattachedEmitters.push_back(emitter);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,11 @@ public:
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user