aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerpartsource.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llviewerpartsource.cpp
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/llviewerpartsource.cpp')
-rw-r--r--linden/indra/newview/llviewerpartsource.cpp42
1 files changed, 17 insertions, 25 deletions
diff --git a/linden/indra/newview/llviewerpartsource.cpp b/linden/indra/newview/llviewerpartsource.cpp
index 0f30edf..040d108 100644
--- a/linden/indra/newview/llviewerpartsource.cpp
+++ b/linden/indra/newview/llviewerpartsource.cpp
@@ -98,9 +98,7 @@ LLViewerPartSourceScript::LLViewerPartSourceScript(LLViewerObject *source_objp)
98 llassert(source_objp); 98 llassert(source_objp);
99 mSourceObjectp = source_objp; 99 mSourceObjectp = source_objp;
100 mPosAgent = mSourceObjectp->getPositionAgent(); 100 mPosAgent = mSourceObjectp->getPositionAgent();
101 LLUUID id; 101 mImagep = gImageList.getImageFromFile("pixiesmall.j2c");
102 id.set( gViewerArt.getString("pixiesmall.tga") );
103 mImagep = gImageList.getImage(id);
104 mImagep->bind(); 102 mImagep->bind();
105 mImagep->setClamp(TRUE, TRUE); 103 mImagep->setClamp(TRUE, TRUE);
106} 104}
@@ -123,7 +121,7 @@ void LLViewerPartSourceScript::update(const F32 dt)
123 F32 old_update_time = mLastUpdateTime; 121 F32 old_update_time = mLastUpdateTime;
124 mLastUpdateTime += dt; 122 mLastUpdateTime += dt;
125 123
126 F32 ref_rate_travelspeed = llmin(gWorldPointer->mPartSim.getRefRate(), 1.f); 124 F32 ref_rate_travelspeed = llmin(LLViewerPartSim::getInstance()->getRefRate(), 1.f);
127 125
128 F32 dt_update = mLastUpdateTime - mLastPartTime; 126 F32 dt_update = mLastUpdateTime - mLastPartTime;
129 127
@@ -213,7 +211,7 @@ void LLViewerPartSourceScript::update(const F32 dt)
213 mRotation.setQuat(0, 0, 0); 211 mRotation.setQuat(0, 0, 0);
214 } 212 }
215 213
216 if (gWorldPointer->mPartSim.aboveParticleLimit()) 214 if (LLViewerPartSim::getInstance()->aboveParticleLimit())
217 { 215 {
218 // Don't bother doing any more updates if we're above the particle limit, 216 // Don't bother doing any more updates if we're above the particle limit,
219 // just give up. 217 // just give up.
@@ -235,7 +233,7 @@ void LLViewerPartSourceScript::update(const F32 dt)
235 (mPartSysData.mPartData.mStartScale[1] 233 (mPartSysData.mPartData.mStartScale[1]
236 + mPartSysData.mPartData.mEndScale[1])/2)); 234 + mPartSysData.mPartData.mEndScale[1])/2));
237 235
238 F32 pixel_meter_ratio = gCamera->getPixelMeterRatio(); 236 F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio();
239 237
240 // Maximum distance at which spawned particles will be viewable 238 // Maximum distance at which spawned particles will be viewable
241 F32 max_dist = max_short_side * pixel_meter_ratio; 239 F32 max_dist = max_short_side * pixel_meter_ratio;
@@ -250,7 +248,7 @@ void LLViewerPartSourceScript::update(const F32 dt)
250 } 248 }
251 249
252 // Distance from camera 250 // Distance from camera
253 F32 dist = (mPosAgent - gCamera->getOrigin()).magVec(); 251 F32 dist = (mPosAgent - LLViewerCamera::getInstance()->getOrigin()).magVec();
254 252
255 // Particle size vs distance vs maxage throttling 253 // Particle size vs distance vs maxage throttling
256 254
@@ -267,14 +265,14 @@ void LLViewerPartSourceScript::update(const F32 dt)
267 } 265 }
268 266
269 if(mDelay) 267 if(mDelay)
270 { 268 {
271 limited_rate = llmax(limited_rate, 0.01f * mDelay--) ; 269 limited_rate = llmax(limited_rate, 0.01f * mDelay--) ;
272 } 270 }
273 271
274 S32 i; 272 S32 i;
275 for (i = 0; i < mPartSysData.mBurstPartCount; i++) 273 for (i = 0; i < mPartSysData.mBurstPartCount; i++)
276 { 274 {
277 if (ll_frand() < llmax(1.0f - gWorldPointer->mPartSim.getBurstRate(), limited_rate)) 275 if (ll_frand() < llmax(1.0f - LLViewerPartSim::getInstance()->getBurstRate(), limited_rate))
278 { 276 {
279 // Limit particle generation 277 // Limit particle generation
280 continue; 278 continue;
@@ -385,7 +383,7 @@ void LLViewerPartSourceScript::update(const F32 dt)
385 mPartSysData.mBurstRadius = 0; 383 mPartSysData.mBurstRadius = 0;
386 } 384 }
387 385
388 gWorldPointer->mPartSim.addPart(part); 386 LLViewerPartSim::getInstance()->addPart(part);
389 } 387 }
390 388
391 mLastPartTime = mLastUpdateTime; 389 mLastPartTime = mLastUpdateTime;
@@ -528,9 +526,7 @@ void LLViewerPartSourceSpiral::update(const F32 dt)
528 LLMemType mt(LLMemType::MTYPE_PARTICLES); 526 LLMemType mt(LLMemType::MTYPE_PARTICLES);
529 if (!mImagep) 527 if (!mImagep)
530 { 528 {
531 LLUUID id; 529 mImagep = gImageList.getImageFromFile("pixiesmall.j2c");
532 id.set( gViewerArt.getString("pixiesmall.tga") );
533 mImagep = gImageList.getImage(id);
534 } 530 }
535 531
536 const F32 RATE = 0.025f; 532 const F32 RATE = 0.025f;
@@ -544,7 +540,7 @@ void LLViewerPartSourceSpiral::update(const F32 dt)
544 if (dt_update > RATE) 540 if (dt_update > RATE)
545 { 541 {
546 mLastPartTime = mLastUpdateTime; 542 mLastPartTime = mLastUpdateTime;
547 if (!gWorldPointer->mPartSim.shouldAddPart()) 543 if (!LLViewerPartSim::getInstance()->shouldAddPart())
548 { 544 {
549 // Particle simulation says we have too many particles, skip all this 545 // Particle simulation says we have too many particles, skip all this
550 return; 546 return;
@@ -567,7 +563,7 @@ void LLViewerPartSourceSpiral::update(const F32 dt)
567 part->mScale.mV[1] = 0.25f; 563 part->mScale.mV[1] = 0.25f;
568 part->mParameter = ll_frand(F_TWO_PI); 564 part->mParameter = ll_frand(F_TWO_PI);
569 565
570 gWorldPointer->mPartSim.addPart(part); 566 LLViewerPartSim::getInstance()->addPart(part);
571 } 567 }
572} 568}
573 569
@@ -691,7 +687,7 @@ void LLViewerPartSourceBeam::update(const F32 dt)
691 if (dt_update > RATE) 687 if (dt_update > RATE)
692 { 688 {
693 mLastPartTime = mLastUpdateTime; 689 mLastPartTime = mLastUpdateTime;
694 if (!gWorldPointer->mPartSim.shouldAddPart()) 690 if (!LLViewerPartSim::getInstance()->shouldAddPart())
695 { 691 {
696 // Particle simulation says we have too many particles, skip all this 692 // Particle simulation says we have too many particles, skip all this
697 return; 693 return;
@@ -699,9 +695,7 @@ void LLViewerPartSourceBeam::update(const F32 dt)
699 695
700 if (!mImagep) 696 if (!mImagep)
701 { 697 {
702 LLUUID id; 698 mImagep = gImageList.getImageFromFile("pixiesmall.j2c");
703 id.set( gViewerArt.getString("pixiesmall.tga") );
704 mImagep = gImageList.getImage(id);
705 } 699 }
706 700
707 LLPointer<LLViewerPart> part = new LLViewerPart(); 701 LLPointer<LLViewerPart> part = new LLViewerPart();
@@ -724,7 +718,7 @@ void LLViewerPartSourceBeam::update(const F32 dt)
724 part->mPosAgent = mPosAgent; 718 part->mPosAgent = mPosAgent;
725 part->mVelocity = mTargetPosAgent - mPosAgent; 719 part->mVelocity = mTargetPosAgent - mPosAgent;
726 720
727 gWorldPointer->mPartSim.addPart(part); 721 LLViewerPartSim::getInstance()->addPart(part);
728 } 722 }
729} 723}
730 724
@@ -787,9 +781,7 @@ void LLViewerPartSourceChat::update(const F32 dt)
787 LLMemType mt(LLMemType::MTYPE_PARTICLES); 781 LLMemType mt(LLMemType::MTYPE_PARTICLES);
788 if (!mImagep) 782 if (!mImagep)
789 { 783 {
790 LLUUID id; 784 mImagep = gImageList.getImageFromFile("pixiesmall.j2c");
791 id.set( gViewerArt.getString("pixiesmall.tga") );
792 mImagep = gImageList.getImage(id);
793 } 785 }
794 786
795 787
@@ -813,7 +805,7 @@ void LLViewerPartSourceChat::update(const F32 dt)
813 if (dt_update > RATE) 805 if (dt_update > RATE)
814 { 806 {
815 mLastPartTime = mLastUpdateTime; 807 mLastPartTime = mLastUpdateTime;
816 if (!gWorldPointer->mPartSim.shouldAddPart()) 808 if (!LLViewerPartSim::getInstance()->shouldAddPart())
817 { 809 {
818 // Particle simulation says we have too many particles, skip all this 810 // Particle simulation says we have too many particles, skip all this
819 return; 811 return;
@@ -836,7 +828,7 @@ void LLViewerPartSourceChat::update(const F32 dt)
836 part->mScale.mV[1] = 0.25f; 828 part->mScale.mV[1] = 0.25f;
837 part->mParameter = ll_frand(F_TWO_PI); 829 part->mParameter = ll_frand(F_TWO_PI);
838 830
839 gWorldPointer->mPartSim.addPart(part); 831 LLViewerPartSim::getInstance()->addPart(part);
840 } 832 }
841} 833}
842 834