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:
Vladislav Belov
2026-06-28 17:34:03 +02:00
parent 961dfc9279
commit 8491b7f084
4 changed files with 7 additions and 17 deletions
+1 -7
View File
@@ -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)
-9
View File
@@ -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;
+1
View File
@@ -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);
}
+5 -1
View File
@@ -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);