upgrade emitters garbage collection

This commit is contained in:
MihailRis
2024-12-23 17:26:22 +03:00
parent 78761a445a
commit 52494a680c
3 changed files with 21 additions and 12 deletions
+6 -1
View File
@@ -19,7 +19,7 @@ Emitter::Emitter(
)
: level(level),
origin(std::move(origin)),
prototype({this, 0, glm::vec3(), preset.velocity, preset.lifetime, region}),
prototype({this, 0, {}, preset.velocity, preset.lifetime, region}),
texture(texture),
count(count),
preset(std::move(preset)) {
@@ -113,6 +113,7 @@ void Emitter::update(
if (count > 0) {
count--;
}
refCount++;
}
}
@@ -124,6 +125,10 @@ bool Emitter::isDead() const {
return count == 0;
}
bool Emitter::isReferred() const {
return refCount > 0;
}
const EmitterOrigin& Emitter::getOrigin() const {
return origin;
}