diff options
author | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
commit | 89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch) | |
tree | bcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/newview/llviewerpartsource.cpp | |
parent | Second Life viewer sources 1.13.3.2 (diff) | |
download | meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2 meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz |
Second Life viewer sources 1.14.0.0
Diffstat (limited to 'linden/indra/newview/llviewerpartsource.cpp')
-rw-r--r-- | linden/indra/newview/llviewerpartsource.cpp | 180 |
1 files changed, 105 insertions, 75 deletions
diff --git a/linden/indra/newview/llviewerpartsource.cpp b/linden/indra/newview/llviewerpartsource.cpp index 39869e2..33e6df4 100644 --- a/linden/indra/newview/llviewerpartsource.cpp +++ b/linden/indra/newview/llviewerpartsource.cpp | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "llviewerobjectlist.h" | 37 | #include "llviewerobjectlist.h" |
38 | #include "llvoavatar.h" | 38 | #include "llvoavatar.h" |
39 | #include "llworld.h" | 39 | #include "llworld.h" |
40 | #include "pipeline.h" | ||
40 | 41 | ||
41 | LLViewerPartSource::LLViewerPartSource(const U32 type) : | 42 | LLViewerPartSource::LLViewerPartSource(const U32 type) : |
42 | mType(type), | 43 | mType(type), |
@@ -45,6 +46,8 @@ LLViewerPartSource::LLViewerPartSource(const U32 type) : | |||
45 | mLastUpdateTime = 0.f; | 46 | mLastUpdateTime = 0.f; |
46 | mLastPartTime = 0.f; | 47 | mLastPartTime = 0.f; |
47 | mIsDead = FALSE; | 48 | mIsDead = FALSE; |
49 | static U32 id_seed = 0; | ||
50 | mID = ++id_seed; | ||
48 | } | 51 | } |
49 | 52 | ||
50 | void LLViewerPartSource::setDead() | 53 | void LLViewerPartSource::setDead() |
@@ -67,6 +70,7 @@ void LLViewerPartSource::update(const F32 dt) | |||
67 | LLViewerPartSourceScript::LLViewerPartSourceScript(LLViewerObject *source_objp) : | 70 | LLViewerPartSourceScript::LLViewerPartSourceScript(LLViewerObject *source_objp) : |
68 | LLViewerPartSource(LL_PART_SOURCE_SCRIPT) | 71 | LLViewerPartSource(LL_PART_SOURCE_SCRIPT) |
69 | { | 72 | { |
73 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
70 | llassert(source_objp); | 74 | llassert(source_objp); |
71 | mSourceObjectp = source_objp; | 75 | mSourceObjectp = source_objp; |
72 | mPosAgent = mSourceObjectp->getPositionAgent(); | 76 | mPosAgent = mSourceObjectp->getPositionAgent(); |
@@ -80,18 +84,18 @@ LLViewerPartSourceScript::LLViewerPartSourceScript(LLViewerObject *source_objp) | |||
80 | 84 | ||
81 | void LLViewerPartSourceScript::setDead() | 85 | void LLViewerPartSourceScript::setDead() |
82 | { | 86 | { |
87 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
83 | mIsDead = TRUE; | 88 | mIsDead = TRUE; |
84 | mSourceObjectp = NULL; | 89 | mSourceObjectp = NULL; |
85 | mTargetObjectp = NULL; | 90 | mTargetObjectp = NULL; |
86 | } | 91 | } |
87 | 92 | ||
88 | |||
89 | |||
90 | void LLViewerPartSourceScript::update(const F32 dt) | 93 | void LLViewerPartSourceScript::update(const F32 dt) |
91 | { | 94 | { |
95 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
92 | F32 old_update_time = mLastUpdateTime; | 96 | F32 old_update_time = mLastUpdateTime; |
93 | mLastUpdateTime += dt; | 97 | mLastUpdateTime += dt; |
94 | 98 | ||
95 | F32 dt_update = mLastUpdateTime - mLastPartTime; | 99 | F32 dt_update = mLastUpdateTime - mLastPartTime; |
96 | 100 | ||
97 | // Update this for objects which have the follow flag set... | 101 | // Update this for objects which have the follow flag set... |
@@ -142,6 +146,17 @@ void LLViewerPartSourceScript::update(const F32 dt) | |||
142 | return; | 146 | return; |
143 | } | 147 | } |
144 | 148 | ||
149 | |||
150 | if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PARTICLES)) | ||
151 | { | ||
152 | if (mSourceObjectp.notNull()) | ||
153 | { | ||
154 | std::ostringstream ostr; | ||
155 | ostr << mPartSysData; | ||
156 | mSourceObjectp->setDebugText(ostr.str()); | ||
157 | } | ||
158 | } | ||
159 | |||
145 | BOOL first_run = FALSE; | 160 | BOOL first_run = FALSE; |
146 | if (old_update_time <= 0.f) | 161 | if (old_update_time <= 0.f) |
147 | { | 162 | { |
@@ -153,21 +168,7 @@ void LLViewerPartSourceScript::update(const F32 dt) | |||
153 | while ((dt_update > mPartSysData.mBurstRate) || first_run) | 168 | while ((dt_update > mPartSysData.mBurstRate) || first_run) |
154 | { | 169 | { |
155 | first_run = FALSE; | 170 | first_run = FALSE; |
156 | LLViewerPart part; | 171 | |
157 | |||
158 | part.init(this, mImagep, NULL); | ||
159 | part.mFlags = mPartSysData.mPartData.mFlags; | ||
160 | part.mMaxAge = mPartSysData.mPartData.mMaxAge; | ||
161 | part.mStartColor = mPartSysData.mPartData.mStartColor; | ||
162 | part.mEndColor = mPartSysData.mPartData.mEndColor; | ||
163 | part.mColor = part.mStartColor; | ||
164 | |||
165 | part.mStartScale = mPartSysData.mPartData.mStartScale; | ||
166 | part.mEndScale = mPartSysData.mPartData.mEndScale; | ||
167 | part.mScale = part.mStartScale; | ||
168 | |||
169 | part.mAccel = mPartSysData.mPartAccel; | ||
170 | |||
171 | // Update the rotation of the particle source by the angular velocity | 172 | // Update the rotation of the particle source by the angular velocity |
172 | // First check to see if there is still an angular velocity. | 173 | // First check to see if there is still an angular velocity. |
173 | F32 angular_velocity_mag = mPartSysData.mAngularVelocity.magVec(); | 174 | F32 angular_velocity_mag = mPartSysData.mAngularVelocity.magVec(); |
@@ -200,14 +201,29 @@ void LLViewerPartSourceScript::update(const F32 dt) | |||
200 | continue; | 201 | continue; |
201 | } | 202 | } |
202 | 203 | ||
204 | LLPointer<LLViewerPart> part = new LLViewerPart(); | ||
205 | |||
206 | part->init(this, mImagep, NULL); | ||
207 | part->mFlags = mPartSysData.mPartData.mFlags; | ||
208 | part->mMaxAge = mPartSysData.mPartData.mMaxAge; | ||
209 | part->mStartColor = mPartSysData.mPartData.mStartColor; | ||
210 | part->mEndColor = mPartSysData.mPartData.mEndColor; | ||
211 | part->mColor = part->mStartColor; | ||
212 | |||
213 | part->mStartScale = mPartSysData.mPartData.mStartScale; | ||
214 | part->mEndScale = mPartSysData.mPartData.mEndScale; | ||
215 | part->mScale = part->mStartScale; | ||
216 | |||
217 | part->mAccel = mPartSysData.mPartAccel; | ||
218 | |||
203 | if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_DROP) | 219 | if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_DROP) |
204 | { | 220 | { |
205 | part.mPosAgent = mPosAgent; | 221 | part->mPosAgent = mPosAgent; |
206 | part.mVelocity.setVec(0.f, 0.f, 0.f); | 222 | part->mVelocity.setVec(0.f, 0.f, 0.f); |
207 | } | 223 | } |
208 | else if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_EXPLODE) | 224 | else if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_EXPLODE) |
209 | { | 225 | { |
210 | part.mPosAgent = mPosAgent; | 226 | part->mPosAgent = mPosAgent; |
211 | LLVector3 part_dir_vector; | 227 | LLVector3 part_dir_vector; |
212 | 228 | ||
213 | F32 mvs; | 229 | F32 mvs; |
@@ -221,19 +237,18 @@ void LLViewerPartSourceScript::update(const F32 dt) | |||
221 | while ((mvs > 1.f) || (mvs < 0.01f)); | 237 | while ((mvs > 1.f) || (mvs < 0.01f)); |
222 | 238 | ||
223 | part_dir_vector.normVec(); | 239 | part_dir_vector.normVec(); |
224 | part.mPosAgent += mPartSysData.mBurstRadius*part_dir_vector; | 240 | part->mPosAgent += mPartSysData.mBurstRadius*part_dir_vector; |
225 | part.mVelocity = part_dir_vector; | 241 | part->mVelocity = part_dir_vector; |
226 | F32 speed = mPartSysData.mBurstSpeedMin + ll_frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin); | 242 | F32 speed = mPartSysData.mBurstSpeedMin + ll_frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin); |
227 | part.mVelocity *= speed; | 243 | part->mVelocity *= speed; |
228 | } | 244 | } |
229 | else if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE | 245 | else if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE |
230 | || mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE) | 246 | || mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE) |
231 | { | 247 | { |
232 | part.mPosAgent = mPosAgent; | 248 | part->mPosAgent = mPosAgent; |
233 | 249 | ||
234 | // original implemenetation for part_dir_vector was just: | 250 | // original implemenetation for part_dir_vector was just: |
235 | LLVector3 part_dir_vector(0.0, 0.0, 1.0); | 251 | LLVector3 part_dir_vector(0.0, 0.0, 1.0); |
236 | |||
237 | // params from the script... | 252 | // params from the script... |
238 | // outer = outer cone angle | 253 | // outer = outer cone angle |
239 | // inner = inner cone angle | 254 | // inner = inner cone angle |
@@ -243,13 +258,11 @@ void LLViewerPartSourceScript::update(const F32 dt) | |||
243 | 258 | ||
244 | // generate a random angle within the given space... | 259 | // generate a random angle within the given space... |
245 | F32 angle = innerAngle + ll_frand(outerAngle - innerAngle); | 260 | F32 angle = innerAngle + ll_frand(outerAngle - innerAngle); |
246 | |||
247 | // split which side it will go on randomly... | 261 | // split which side it will go on randomly... |
248 | if (ll_frand() < 0.5) | 262 | if (ll_frand() < 0.5) |
249 | { | 263 | { |
250 | angle = -angle; | 264 | angle = -angle; |
251 | } | 265 | } |
252 | |||
253 | // Both patterns rotate around the x-axis first: | 266 | // Both patterns rotate around the x-axis first: |
254 | part_dir_vector.rotVec(angle, 1.0, 0.0, 0.0); | 267 | part_dir_vector.rotVec(angle, 1.0, 0.0, 0.0); |
255 | 268 | ||
@@ -258,31 +271,32 @@ void LLViewerPartSourceScript::update(const F32 dt) | |||
258 | { | 271 | { |
259 | part_dir_vector.rotVec(ll_frand(4*F_PI), 0.0, 0.0, 1.0); | 272 | part_dir_vector.rotVec(ll_frand(4*F_PI), 0.0, 0.0, 1.0); |
260 | } | 273 | } |
261 | 274 | ||
262 | // Only apply this rotation if using the deprecated angles. | 275 | // Only apply this rotation if using the deprecated angles. |
263 | if (! (mPartSysData.mFlags & LLPartSysData::LL_PART_USE_NEW_ANGLE)) | 276 | if (! (mPartSysData.mFlags & LLPartSysData::LL_PART_USE_NEW_ANGLE)) |
264 | { | 277 | { |
265 | // Deprecated... | 278 | // Deprecated... |
266 | part_dir_vector.rotVec(outerAngle, 1.0, 0.0, 0.0); | 279 | part_dir_vector.rotVec(outerAngle, 1.0, 0.0, 0.0); |
267 | } | 280 | } |
268 | 281 | ||
269 | if (mSourceObjectp) | 282 | if (mSourceObjectp) |
270 | { | 283 | { |
271 | part_dir_vector = part_dir_vector * mSourceObjectp->getRenderRotation(); | 284 | part_dir_vector = part_dir_vector * mSourceObjectp->getRenderRotation(); |
272 | } | 285 | } |
286 | |||
273 | part_dir_vector = part_dir_vector * mRotation; | 287 | part_dir_vector = part_dir_vector * mRotation; |
288 | |||
289 | part->mPosAgent += mPartSysData.mBurstRadius*part_dir_vector; | ||
274 | 290 | ||
275 | part.mPosAgent += mPartSysData.mBurstRadius*part_dir_vector; | 291 | part->mVelocity = part_dir_vector; |
276 | |||
277 | part.mVelocity = part_dir_vector; | ||
278 | 292 | ||
279 | F32 speed = mPartSysData.mBurstSpeedMin + ll_frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin); | 293 | F32 speed = mPartSysData.mBurstSpeedMin + ll_frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin); |
280 | part.mVelocity *= speed; | 294 | part->mVelocity *= speed; |
281 | } | 295 | } |
282 | else | 296 | else |
283 | { | 297 | { |
284 | part.mPosAgent = mPosAgent; | 298 | part->mPosAgent = mPosAgent; |
285 | part.mVelocity.setVec(0.f, 0.f, 0.f); | 299 | part->mVelocity.setVec(0.f, 0.f, 0.f); |
286 | //llwarns << "Unknown source pattern " << (S32)mPartSysData.mPattern << llendl; | 300 | //llwarns << "Unknown source pattern " << (S32)mPartSysData.mPattern << llendl; |
287 | } | 301 | } |
288 | 302 | ||
@@ -297,6 +311,7 @@ void LLViewerPartSourceScript::update(const F32 dt) | |||
297 | // static | 311 | // static |
298 | LLViewerPartSourceScript *LLViewerPartSourceScript::unpackPSS(LLViewerObject *source_objp, LLViewerPartSourceScript *pssp, const S32 block_num) | 312 | LLViewerPartSourceScript *LLViewerPartSourceScript::unpackPSS(LLViewerObject *source_objp, LLViewerPartSourceScript *pssp, const S32 block_num) |
299 | { | 313 | { |
314 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
300 | if (!pssp) | 315 | if (!pssp) |
301 | { | 316 | { |
302 | if (LLPartSysData::isNullPS(block_num)) | 317 | if (LLPartSysData::isNullPS(block_num)) |
@@ -338,6 +353,7 @@ LLViewerPartSourceScript *LLViewerPartSourceScript::unpackPSS(LLViewerObject *so | |||
338 | 353 | ||
339 | LLViewerPartSourceScript *LLViewerPartSourceScript::unpackPSS(LLViewerObject *source_objp, LLViewerPartSourceScript *pssp, LLDataPacker &dp) | 354 | LLViewerPartSourceScript *LLViewerPartSourceScript::unpackPSS(LLViewerObject *source_objp, LLViewerPartSourceScript *pssp, LLDataPacker &dp) |
340 | { | 355 | { |
356 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
341 | if (!pssp) | 357 | if (!pssp) |
342 | { | 358 | { |
343 | LLViewerPartSourceScript *new_pssp = new LLViewerPartSourceScript(source_objp); | 359 | LLViewerPartSourceScript *new_pssp = new LLViewerPartSourceScript(source_objp); |
@@ -369,11 +385,13 @@ LLViewerPartSourceScript *LLViewerPartSourceScript::unpackPSS(LLViewerObject *so | |||
369 | 385 | ||
370 | void LLViewerPartSourceScript::setImage(LLViewerImage *imagep) | 386 | void LLViewerPartSourceScript::setImage(LLViewerImage *imagep) |
371 | { | 387 | { |
388 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
372 | mImagep = imagep; | 389 | mImagep = imagep; |
373 | } | 390 | } |
374 | 391 | ||
375 | void LLViewerPartSourceScript::setTargetObject(LLViewerObject *objp) | 392 | void LLViewerPartSourceScript::setTargetObject(LLViewerObject *objp) |
376 | { | 393 | { |
394 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
377 | mTargetObjectp = objp; | 395 | mTargetObjectp = objp; |
378 | } | 396 | } |
379 | 397 | ||
@@ -389,6 +407,7 @@ LLViewerPartSourceSpiral::LLViewerPartSourceSpiral(const LLVector3 &pos) : | |||
389 | 407 | ||
390 | void LLViewerPartSourceSpiral::setDead() | 408 | void LLViewerPartSourceSpiral::setDead() |
391 | { | 409 | { |
410 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
392 | mIsDead = TRUE; | 411 | mIsDead = TRUE; |
393 | mSourceObjectp = NULL; | 412 | mSourceObjectp = NULL; |
394 | } | 413 | } |
@@ -396,6 +415,7 @@ void LLViewerPartSourceSpiral::setDead() | |||
396 | 415 | ||
397 | void LLViewerPartSourceSpiral::updatePart(LLViewerPart &part, const F32 dt) | 416 | void LLViewerPartSourceSpiral::updatePart(LLViewerPart &part, const F32 dt) |
398 | { | 417 | { |
418 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
399 | F32 frac = part.mLastUpdateTime/part.mMaxAge; | 419 | F32 frac = part.mLastUpdateTime/part.mMaxAge; |
400 | 420 | ||
401 | LLVector3 center_pos; | 421 | LLVector3 center_pos; |
@@ -420,6 +440,7 @@ void LLViewerPartSourceSpiral::updatePart(LLViewerPart &part, const F32 dt) | |||
420 | 440 | ||
421 | void LLViewerPartSourceSpiral::update(const F32 dt) | 441 | void LLViewerPartSourceSpiral::update(const F32 dt) |
422 | { | 442 | { |
443 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
423 | if (!mImagep) | 444 | if (!mImagep) |
424 | { | 445 | { |
425 | LLUUID id; | 446 | LLUUID id; |
@@ -448,18 +469,18 @@ void LLViewerPartSourceSpiral::update(const F32 dt) | |||
448 | { | 469 | { |
449 | mPosAgent = mSourceObjectp->getRenderPosition(); | 470 | mPosAgent = mSourceObjectp->getRenderPosition(); |
450 | } | 471 | } |
451 | LLViewerPart part; | 472 | LLPointer<LLViewerPart> part = new LLViewerPart(); |
452 | part.init(this, mImagep, updatePart); | 473 | part->init(this, mImagep, updatePart); |
453 | part.mStartColor = mColor; | 474 | part->mStartColor = mColor; |
454 | part.mEndColor = mColor; | 475 | part->mEndColor = mColor; |
455 | part.mEndColor.mV[3] = 0.f; | 476 | part->mEndColor.mV[3] = 0.f; |
456 | part.mPosAgent = mPosAgent; | 477 | part->mPosAgent = mPosAgent; |
457 | part.mMaxAge = 1.f; | 478 | part->mMaxAge = 1.f; |
458 | part.mFlags = LLViewerPart::LL_PART_INTERP_COLOR_MASK; | 479 | part->mFlags = LLViewerPart::LL_PART_INTERP_COLOR_MASK; |
459 | part.mLastUpdateTime = 0.f; | 480 | part->mLastUpdateTime = 0.f; |
460 | part.mScale.mV[0] = 0.25f; | 481 | part->mScale.mV[0] = 0.25f; |
461 | part.mScale.mV[1] = 0.25f; | 482 | part->mScale.mV[1] = 0.25f; |
462 | part.mParameter = ll_frand(F_TWO_PI); | 483 | part->mParameter = ll_frand(F_TWO_PI); |
463 | 484 | ||
464 | gWorldPointer->mPartSim.addPart(part); | 485 | gWorldPointer->mPartSim.addPart(part); |
465 | } | 486 | } |
@@ -467,6 +488,7 @@ void LLViewerPartSourceSpiral::update(const F32 dt) | |||
467 | 488 | ||
468 | void LLViewerPartSourceSpiral::setSourceObject(LLViewerObject *objp) | 489 | void LLViewerPartSourceSpiral::setSourceObject(LLViewerObject *objp) |
469 | { | 490 | { |
491 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
470 | mSourceObjectp = objp; | 492 | mSourceObjectp = objp; |
471 | } | 493 | } |
472 | 494 | ||
@@ -490,6 +512,7 @@ LLViewerPartSourceBeam::~LLViewerPartSourceBeam() | |||
490 | 512 | ||
491 | void LLViewerPartSourceBeam::setDead() | 513 | void LLViewerPartSourceBeam::setDead() |
492 | { | 514 | { |
515 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
493 | mIsDead = TRUE; | 516 | mIsDead = TRUE; |
494 | mSourceObjectp = NULL; | 517 | mSourceObjectp = NULL; |
495 | mTargetObjectp = NULL; | 518 | mTargetObjectp = NULL; |
@@ -503,6 +526,7 @@ void LLViewerPartSourceBeam::setColor(const LLColor4 &color) | |||
503 | 526 | ||
504 | void LLViewerPartSourceBeam::updatePart(LLViewerPart &part, const F32 dt) | 527 | void LLViewerPartSourceBeam::updatePart(LLViewerPart &part, const F32 dt) |
505 | { | 528 | { |
529 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
506 | F32 frac = part.mLastUpdateTime/part.mMaxAge; | 530 | F32 frac = part.mLastUpdateTime/part.mMaxAge; |
507 | 531 | ||
508 | LLViewerPartSource *ps = (LLViewerPartSource*)part.mPartSourcep; | 532 | LLViewerPartSource *ps = (LLViewerPartSource*)part.mPartSourcep; |
@@ -547,7 +571,7 @@ void LLViewerPartSourceBeam::updatePart(LLViewerPart &part, const F32 dt) | |||
547 | 571 | ||
548 | void LLViewerPartSourceBeam::update(const F32 dt) | 572 | void LLViewerPartSourceBeam::update(const F32 dt) |
549 | { | 573 | { |
550 | 574 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | |
551 | const F32 RATE = 0.025f; | 575 | const F32 RATE = 0.025f; |
552 | 576 | ||
553 | mLastUpdateTime += dt; | 577 | mLastUpdateTime += dt; |
@@ -595,25 +619,25 @@ void LLViewerPartSourceBeam::update(const F32 dt) | |||
595 | mImagep = gImageList.getImage(id); | 619 | mImagep = gImageList.getImage(id); |
596 | } | 620 | } |
597 | 621 | ||
598 | LLViewerPart part; | 622 | LLPointer<LLViewerPart> part = new LLViewerPart(); |
599 | part.init(this, mImagep, NULL); | 623 | part->init(this, mImagep, NULL); |
600 | 624 | ||
601 | part.mFlags = LLPartData::LL_PART_INTERP_COLOR_MASK | | 625 | part->mFlags = LLPartData::LL_PART_INTERP_COLOR_MASK | |
602 | LLPartData::LL_PART_INTERP_SCALE_MASK | | 626 | LLPartData::LL_PART_INTERP_SCALE_MASK | |
603 | LLPartData::LL_PART_TARGET_POS_MASK | | 627 | LLPartData::LL_PART_TARGET_POS_MASK | |
604 | LLPartData::LL_PART_FOLLOW_VELOCITY_MASK; | 628 | LLPartData::LL_PART_FOLLOW_VELOCITY_MASK; |
605 | part.mMaxAge = 0.5f; | 629 | part->mMaxAge = 0.5f; |
606 | part.mStartColor = mColor; | 630 | part->mStartColor = mColor; |
607 | part.mEndColor = part.mStartColor; | 631 | part->mEndColor = part->mStartColor; |
608 | part.mEndColor.mV[3] = 0.4f; | 632 | part->mEndColor.mV[3] = 0.4f; |
609 | part.mColor = part.mStartColor; | 633 | part->mColor = part->mStartColor; |
610 | 634 | ||
611 | part.mStartScale = LLVector2(0.1f, 0.1f); | 635 | part->mStartScale = LLVector2(0.1f, 0.1f); |
612 | part.mEndScale = LLVector2(0.1f, 0.1f); | 636 | part->mEndScale = LLVector2(0.1f, 0.1f); |
613 | part.mScale = part.mStartScale; | 637 | part->mScale = part->mStartScale; |
614 | 638 | ||
615 | part.mPosAgent = mPosAgent; | 639 | part->mPosAgent = mPosAgent; |
616 | part.mVelocity = mTargetPosAgent - mPosAgent; | 640 | part->mVelocity = mTargetPosAgent - mPosAgent; |
617 | 641 | ||
618 | gWorldPointer->mPartSim.addPart(part); | 642 | gWorldPointer->mPartSim.addPart(part); |
619 | } | 643 | } |
@@ -621,11 +645,13 @@ void LLViewerPartSourceBeam::update(const F32 dt) | |||
621 | 645 | ||
622 | void LLViewerPartSourceBeam::setSourceObject(LLViewerObject* objp) | 646 | void LLViewerPartSourceBeam::setSourceObject(LLViewerObject* objp) |
623 | { | 647 | { |
648 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
624 | mSourceObjectp = objp; | 649 | mSourceObjectp = objp; |
625 | } | 650 | } |
626 | 651 | ||
627 | void LLViewerPartSourceBeam::setTargetObject(LLViewerObject* objp) | 652 | void LLViewerPartSourceBeam::setTargetObject(LLViewerObject* objp) |
628 | { | 653 | { |
654 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
629 | mTargetObjectp = objp; | 655 | mTargetObjectp = objp; |
630 | } | 656 | } |
631 | 657 | ||
@@ -640,6 +666,7 @@ LLViewerPartSourceChat::LLViewerPartSourceChat(const LLVector3 &pos) : | |||
640 | 666 | ||
641 | void LLViewerPartSourceChat::setDead() | 667 | void LLViewerPartSourceChat::setDead() |
642 | { | 668 | { |
669 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
643 | mIsDead = TRUE; | 670 | mIsDead = TRUE; |
644 | mSourceObjectp = NULL; | 671 | mSourceObjectp = NULL; |
645 | } | 672 | } |
@@ -647,6 +674,7 @@ void LLViewerPartSourceChat::setDead() | |||
647 | 674 | ||
648 | void LLViewerPartSourceChat::updatePart(LLViewerPart &part, const F32 dt) | 675 | void LLViewerPartSourceChat::updatePart(LLViewerPart &part, const F32 dt) |
649 | { | 676 | { |
677 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
650 | F32 frac = part.mLastUpdateTime/part.mMaxAge; | 678 | F32 frac = part.mLastUpdateTime/part.mMaxAge; |
651 | 679 | ||
652 | LLVector3 center_pos; | 680 | LLVector3 center_pos; |
@@ -671,6 +699,7 @@ void LLViewerPartSourceChat::updatePart(LLViewerPart &part, const F32 dt) | |||
671 | 699 | ||
672 | void LLViewerPartSourceChat::update(const F32 dt) | 700 | void LLViewerPartSourceChat::update(const F32 dt) |
673 | { | 701 | { |
702 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
674 | if (!mImagep) | 703 | if (!mImagep) |
675 | { | 704 | { |
676 | LLUUID id; | 705 | LLUUID id; |
@@ -709,18 +738,18 @@ void LLViewerPartSourceChat::update(const F32 dt) | |||
709 | { | 738 | { |
710 | mPosAgent = mSourceObjectp->getRenderPosition(); | 739 | mPosAgent = mSourceObjectp->getRenderPosition(); |
711 | } | 740 | } |
712 | LLViewerPart part; | 741 | LLPointer<LLViewerPart> part = new LLViewerPart(); |
713 | part.init(this, mImagep, updatePart); | 742 | part->init(this, mImagep, updatePart); |
714 | part.mStartColor = mColor; | 743 | part->mStartColor = mColor; |
715 | part.mEndColor = mColor; | 744 | part->mEndColor = mColor; |
716 | part.mEndColor.mV[3] = 0.f; | 745 | part->mEndColor.mV[3] = 0.f; |
717 | part.mPosAgent = mPosAgent; | 746 | part->mPosAgent = mPosAgent; |
718 | part.mMaxAge = 1.f; | 747 | part->mMaxAge = 1.f; |
719 | part.mFlags = LLViewerPart::LL_PART_INTERP_COLOR_MASK; | 748 | part->mFlags = LLViewerPart::LL_PART_INTERP_COLOR_MASK; |
720 | part.mLastUpdateTime = 0.f; | 749 | part->mLastUpdateTime = 0.f; |
721 | part.mScale.mV[0] = 0.25f; | 750 | part->mScale.mV[0] = 0.25f; |
722 | part.mScale.mV[1] = 0.25f; | 751 | part->mScale.mV[1] = 0.25f; |
723 | part.mParameter = ll_frand(F_TWO_PI); | 752 | part->mParameter = ll_frand(F_TWO_PI); |
724 | 753 | ||
725 | gWorldPointer->mPartSim.addPart(part); | 754 | gWorldPointer->mPartSim.addPart(part); |
726 | } | 755 | } |
@@ -728,6 +757,7 @@ void LLViewerPartSourceChat::update(const F32 dt) | |||
728 | 757 | ||
729 | void LLViewerPartSourceChat::setSourceObject(LLViewerObject *objp) | 758 | void LLViewerPartSourceChat::setSourceObject(LLViewerObject *objp) |
730 | { | 759 | { |
760 | LLMemType mt(LLMemType::MTYPE_PARTICLES); | ||
731 | mSourceObjectp = objp; | 761 | mSourceObjectp = objp; |
732 | } | 762 | } |
733 | 763 | ||