aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerpartsim.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llviewerpartsim.cpp')
-rw-r--r--linden/indra/newview/llviewerpartsim.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/linden/indra/newview/llviewerpartsim.cpp b/linden/indra/newview/llviewerpartsim.cpp
index 2658e67..8c06381 100644
--- a/linden/indra/newview/llviewerpartsim.cpp
+++ b/linden/indra/newview/llviewerpartsim.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2003-2007, Linden Research, Inc. 5 * Copyright (c) 2003-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -249,13 +250,13 @@ void LLViewerPartGroup::removePart(const S32 part_num)
249void LLViewerPartGroup::updateParticles(const F32 dt) 250void LLViewerPartGroup::updateParticles(const F32 dt)
250{ 251{
251 LLMemType mt(LLMemType::MTYPE_PARTICLES); 252 LLMemType mt(LLMemType::MTYPE_PARTICLES);
252 S32 i, count; 253 S32 i;
253 254
254 LLVector3 gravity(0.f, 0.f, -9.8f); 255 LLVector3 gravity(0.f, 0.f, -9.8f);
255 256
256 LLViewerRegion *regionp = getRegion(); 257 LLViewerRegion *regionp = getRegion();
257 count = (S32) mParticles.size(); 258 S32 end = (S32) mParticles.size();
258 for (i = 0; i < count; i++) 259 for (i = 0; i < end; i++)
259 { 260 {
260 LLVector3 a(0.f, 0.f, 0.f); 261 LLVector3 a(0.f, 0.f, 0.f);
261 LLViewerPart& part = *((LLViewerPart*) mParticles[i]); 262 LLViewerPart& part = *((LLViewerPart*) mParticles[i]);
@@ -364,9 +365,8 @@ void LLViewerPartGroup::updateParticles(const F32 dt)
364 // Kill dead particles (either flagged dead, or too old) 365 // Kill dead particles (either flagged dead, or too old)
365 if ((part.mLastUpdateTime > part.mMaxAge) || (LLViewerPart::LL_PART_DEAD_MASK == part.mFlags)) 366 if ((part.mLastUpdateTime > part.mMaxAge) || (LLViewerPart::LL_PART_DEAD_MASK == part.mFlags))
366 { 367 {
367 removePart(i); 368 end--;
368 i--; 369 LLPointer<LLViewerPart>::swap(mParticles[i], mParticles[end]);
369 count--;
370 } 370 }
371 else 371 else
372 { 372 {
@@ -375,13 +375,24 @@ void LLViewerPartGroup::updateParticles(const F32 dt)
375 { 375 {
376 // Transfer particles between groups 376 // Transfer particles between groups
377 gWorldPointer->mPartSim.put(&part); 377 gWorldPointer->mPartSim.put(&part);
378 removePart(i); 378 end--;
379 i--; 379 LLPointer<LLViewerPart>::swap(mParticles[i], mParticles[end]);
380 count--;
381 } 380 }
382 } 381 }
383 } 382 }
384 383
384 S32 removed = (S32)mParticles.size() - end;
385 if (removed > 0)
386 {
387 // we removed one or more particles, so flag this group for update
388 mParticles.erase(mParticles.begin() + end, mParticles.end());
389 if (mVOPartGroupp.notNull())
390 {
391 gPipeline.markRebuild(mVOPartGroupp->mDrawable, LLDrawable::REBUILD_ALL, TRUE);
392 }
393 LLViewerPartSim::decPartCount(removed);
394 }
395
385 // Kill the viewer object if this particle group is empty 396 // Kill the viewer object if this particle group is empty
386 if (mParticles.empty()) 397 if (mParticles.empty())
387 { 398 {
@@ -480,7 +491,7 @@ LLViewerPartGroup *LLViewerPartSim::put(LLViewerPart* part)
480 const F32 MAX_MAG = 1000000.f*1000000.f; // 1 million 491 const F32 MAX_MAG = 1000000.f*1000000.f; // 1 million
481 if (part->mPosAgent.magVecSquared() > MAX_MAG || !part->mPosAgent.isFinite()) 492 if (part->mPosAgent.magVecSquared() > MAX_MAG || !part->mPosAgent.isFinite())
482 { 493 {
483#if !LL_RELEASE_FOR_DOWNLOAD 494#if 0 && !LL_RELEASE_FOR_DOWNLOAD
484 llwarns << "LLViewerPartSim::put Part out of range!" << llendl; 495 llwarns << "LLViewerPartSim::put Part out of range!" << llendl;
485 llwarns << part->mPosAgent << llendl; 496 llwarns << part->mPosAgent << llendl;
486#endif 497#endif