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.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/linden/indra/newview/llviewerpartsim.cpp b/linden/indra/newview/llviewerpartsim.cpp
index 529ec4d..c303fc5 100644
--- a/linden/indra/newview/llviewerpartsim.cpp
+++ b/linden/indra/newview/llviewerpartsim.cpp
@@ -53,6 +53,7 @@ const F32 PART_SIM_BOX_RAD = 0.5f*F_SQRT3*PART_SIM_BOX_SIDE;
53//static 53//static
54S32 LLViewerPartSim::sMaxParticleCount = 0; 54S32 LLViewerPartSim::sMaxParticleCount = 0;
55S32 LLViewerPartSim::sParticleCount = 0; 55S32 LLViewerPartSim::sParticleCount = 0;
56S32 LLViewerPartSim::sParticleCount2 = 0;
56// This controls how greedy individual particle burst sources are allowed to be, and adapts according to how near the particle-count limit we are. 57// This controls how greedy individual particle burst sources are allowed to be, and adapts according to how near the particle-count limit we are.
57F32 LLViewerPartSim::sParticleAdaptiveRate = 0.0625f; 58F32 LLViewerPartSim::sParticleAdaptiveRate = 0.0625f;
58F32 LLViewerPartSim::sParticleBurstRate = 0.5f; 59F32 LLViewerPartSim::sParticleBurstRate = 0.5f;
@@ -84,12 +85,16 @@ LLViewerPart::LLViewerPart() :
84{ 85{
85 LLMemType mt(LLMemType::MTYPE_PARTICLES); 86 LLMemType mt(LLMemType::MTYPE_PARTICLES);
86 mPartSourcep = NULL; 87 mPartSourcep = NULL;
88
89 ++LLViewerPartSim::sParticleCount2 ;
87} 90}
88 91
89LLViewerPart::~LLViewerPart() 92LLViewerPart::~LLViewerPart()
90{ 93{
91 LLMemType mt(LLMemType::MTYPE_PARTICLES); 94 LLMemType mt(LLMemType::MTYPE_PARTICLES);
92 mPartSourcep = NULL; 95 mPartSourcep = NULL;
96
97 --LLViewerPartSim::sParticleCount2 ;
93} 98}
94 99
95void LLViewerPart::init(LLPointer<LLViewerPartSource> sourcep, LLViewerImage *imagep, LLVPCallback cb) 100void LLViewerPart::init(LLPointer<LLViewerPartSource> sourcep, LLViewerImage *imagep, LLVPCallback cb)
@@ -263,6 +268,8 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt)
263 268
264 LLVector3 gravity(0.f, 0.f, GRAVITY); 269 LLVector3 gravity(0.f, 0.f, GRAVITY);
265 270
271 LLViewerPartSim::checkParticleCount(mParticles.size());
272
266 LLViewerRegion *regionp = getRegion(); 273 LLViewerRegion *regionp = getRegion();
267 S32 end = (S32) mParticles.size(); 274 S32 end = (S32) mParticles.size();
268 for (S32 i = 0 ; i < (S32)mParticles.size();) 275 for (S32 i = 0 ; i < (S32)mParticles.size();)
@@ -416,6 +423,8 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt)
416 gObjectList.killObject(mVOPartGroupp); 423 gObjectList.killObject(mVOPartGroupp);
417 mVOPartGroupp = NULL; 424 mVOPartGroupp = NULL;
418 } 425 }
426
427 LLViewerPartSim::checkParticleCount() ;
419} 428}
420 429
421 430
@@ -451,6 +460,19 @@ void LLViewerPartGroup::removeParticlesByID(const U32 source_id)
451// 460//
452// 461//
453 462
463//static
464void LLViewerPartSim::checkParticleCount(U32 size)
465{
466 if(LLViewerPartSim::sParticleCount2 != LLViewerPartSim::sParticleCount)
467 {
468 llerrs << "sParticleCount: " << LLViewerPartSim::sParticleCount << " ; sParticleCount2: " << LLViewerPartSim::sParticleCount2 << llendl ;
469 }
470
471 if(size > (U32)LLViewerPartSim::sParticleCount2)
472 {
473 llerrs << "curren particle size: " << LLViewerPartSim::sParticleCount2 << " array size: " << size << llendl ;
474 }
475}
454 476
455LLViewerPartSim::LLViewerPartSim() 477LLViewerPartSim::LLViewerPartSim()
456{ 478{
@@ -509,6 +531,12 @@ void LLViewerPartSim::addPart(LLViewerPart* part)
509 { 531 {
510 put(part); 532 put(part);
511 } 533 }
534 else
535 {
536 //delete the particle if can not add it in
537 delete part ;
538 part = NULL ;
539 }
512} 540}
513 541
514 542
@@ -544,7 +572,7 @@ LLViewerPartGroup *LLViewerPartSim::put(LLViewerPart* part)
544 if(!return_group) 572 if(!return_group)
545 { 573 {
546 llassert_always(part->mPosAgent.isFinite()); 574 llassert_always(part->mPosAgent.isFinite());
547 LLViewerPartGroup *groupp = createViewerPartGroup(part->mPosAgent, desired_size, part->mFlags & LLPartData::LL_PART_HUD); 575 LLViewerPartGroup *groupp = createViewerPartGroup(part->mPosAgent, desired_size, part->mFlags & LLPartData::LL_PART_HUD);
548 groupp->mUniformParticles = (part->mScale.mV[0] == part->mScale.mV[1] && 576 groupp->mUniformParticles = (part->mScale.mV[0] == part->mScale.mV[1] &&
549 !(part->mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK)); 577 !(part->mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK));
550 if (!groupp->addPart(part)) 578 if (!groupp->addPart(part))