summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerpartsim.cpp
diff options
context:
space:
mode:
authorJosh Bell <josh@lindenlab.com>2007-04-11 17:54:18 +0000
committerJosh Bell <josh@lindenlab.com>2007-04-11 17:54:18 +0000
commit0277259455c4354f81ea8a24c8ab93f27567bc6f (patch)
treef1411dab563dcf697f794e9e8a592a6d3e5c4d2d /indra/newview/llviewerpartsim.cpp
parent568397bbcc4fca307ebc010ec7f815422b9ba80a (diff)
svn merge -r 59968:60342 svn+ssh://svn.lindenlab.com/svn/linden/branches/maintenance --> release
Diffstat (limited to 'indra/newview/llviewerpartsim.cpp')
-rw-r--r--indra/newview/llviewerpartsim.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp
index bf09c54100..cb0df92386 100644
--- a/indra/newview/llviewerpartsim.cpp
+++ b/indra/newview/llviewerpartsim.cpp
@@ -230,13 +230,13 @@ void LLViewerPartGroup::removePart(const S32 part_num)
void LLViewerPartGroup::updateParticles(const F32 dt)
{
LLMemType mt(LLMemType::MTYPE_PARTICLES);
- S32 i, count;
+ S32 i;
LLVector3 gravity(0.f, 0.f, -9.8f);
LLViewerRegion *regionp = getRegion();
- count = (S32) mParticles.size();
- for (i = 0; i < count; i++)
+ S32 end = (S32) mParticles.size();
+ for (i = 0; i < end; i++)
{
LLVector3 a(0.f, 0.f, 0.f);
LLViewerPart& part = *((LLViewerPart*) mParticles[i]);
@@ -345,9 +345,8 @@ void LLViewerPartGroup::updateParticles(const F32 dt)
// Kill dead particles (either flagged dead, or too old)
if ((part.mLastUpdateTime > part.mMaxAge) || (LLViewerPart::LL_PART_DEAD_MASK == part.mFlags))
{
- removePart(i);
- i--;
- count--;
+ end--;
+ LLPointer<LLViewerPart>::swap(mParticles[i], mParticles[end]);
}
else
{
@@ -356,13 +355,24 @@ void LLViewerPartGroup::updateParticles(const F32 dt)
{
// Transfer particles between groups
gWorldPointer->mPartSim.put(&part);
- removePart(i);
- i--;
- count--;
+ end--;
+ LLPointer<LLViewerPart>::swap(mParticles[i], mParticles[end]);
}
}
}
+ S32 removed = (S32)mParticles.size() - end;
+ if (removed > 0)
+ {
+ // we removed one or more particles, so flag this group for update
+ mParticles.erase(mParticles.begin() + end, mParticles.end());
+ if (mVOPartGroupp.notNull())
+ {
+ gPipeline.markRebuild(mVOPartGroupp->mDrawable, LLDrawable::REBUILD_ALL, TRUE);
+ }
+ LLViewerPartSim::decPartCount(removed);
+ }
+
// Kill the viewer object if this particle group is empty
if (mParticles.empty())
{