diff options
author | Armin Weatherwax | 2010-12-22 14:28:24 +0100 |
---|---|---|
committer | Armin Weatherwax | 2010-12-22 14:28:24 +0100 |
commit | 1d1482eeec3c26c1eb9c14eba6eb78462f704606 (patch) | |
tree | 4a0b6abec090298a34f02e5b9d99abae892f6247 /linden/indra/llmessage/llpartdata.cpp | |
parent | fix: Bug #721: Search lags (diff) | |
download | meta-impy-1d1482eeec3c26c1eb9c14eba6eb78462f704606.zip meta-impy-1d1482eeec3c26c1eb9c14eba6eb78462f704606.tar.gz meta-impy-1d1482eeec3c26c1eb9c14eba6eb78462f704606.tar.bz2 meta-impy-1d1482eeec3c26c1eb9c14eba6eb78462f704606.tar.xz |
load unloaded-avatar-cloud particle system from LLSD file.
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llmessage/llpartdata.cpp | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/linden/indra/llmessage/llpartdata.cpp b/linden/indra/llmessage/llpartdata.cpp index 485bc6a..a2811ab 100644 --- a/linden/indra/llmessage/llpartdata.cpp +++ b/linden/indra/llmessage/llpartdata.cpp | |||
@@ -347,3 +347,93 @@ void LLPartSysData::setPartAccel(const LLVector3 &accel) | |||
347 | mPartAccel.mV[VY] = llclamp(accel.mV[VY], -100.f, 100.f); | 347 | mPartAccel.mV[VY] = llclamp(accel.mV[VY], -100.f, 100.f); |
348 | mPartAccel.mV[VZ] = llclamp(accel.mV[VZ], -100.f, 100.f); | 348 | mPartAccel.mV[VZ] = llclamp(accel.mV[VZ], -100.f, 100.f); |
349 | } | 349 | } |
350 | |||
351 | LLSD LLPartSysData::asLLSD() const | ||
352 | { | ||
353 | LLSD sd = LLSD(); | ||
354 | |||
355 | sd["LL_PART_INTERP_COLOR_MASK"] = (LLPartData::LL_PART_INTERP_COLOR_MASK & mPartData.mFlags) ? 1 : 0; | ||
356 | sd["LL_PART_INTERP_SCALE_MASK"] = (LLPartData::LL_PART_INTERP_SCALE_MASK & mPartData.mFlags) ? 1 : 0; | ||
357 | sd["LL_PART_BOUNCE_MASK"] = (LLPartData::LL_PART_BOUNCE_MASK & mPartData.mFlags) ? 1 : 0; | ||
358 | sd["LL_PART_WIND_MASK"] = (LLPartData::LL_PART_WIND_MASK & mPartData.mFlags) ? 1 : 0; | ||
359 | sd["LL_PART_FOLLOW_SRC_MASK"] = (LLPartData::LL_PART_FOLLOW_SRC_MASK & mPartData.mFlags) ? 1 : 0; | ||
360 | sd["LL_PART_FOLLOW_VELOCITY_MASK"] = (LLPartData::LL_PART_FOLLOW_VELOCITY_MASK & mPartData.mFlags) ? 1 : 0; | ||
361 | sd["LL_PART_TARGET_POS_MASK"] = (LLPartData::LL_PART_TARGET_POS_MASK & mPartData.mFlags) ? 1 : 0; | ||
362 | sd["LL_PART_TARGET_LINEAR_MASK"] = (LLPartData::LL_PART_TARGET_LINEAR_MASK & mPartData.mFlags) ? 1 : 0; | ||
363 | sd["LL_PART_EMISSIVE_MASK"] = (LLPartData::LL_PART_EMISSIVE_MASK & mPartData.mFlags) ? 1 : 0; | ||
364 | sd["LL_PART_BEAM_MASK"] = (LLPartData::LL_PART_BEAM_MASK & mPartData.mFlags) ? 1 : 0; | ||
365 | |||
366 | sd["SourceMaxage"] = mPartData.mMaxAge; | ||
367 | sd["Startcolor"] = ll_sd_from_color4(mPartData.mStartColor); | ||
368 | sd["Endcolor"] = ll_sd_from_color4(mPartData.mEndColor); | ||
369 | sd["Startscale"] = ll_sd_from_vector2(mPartData.mStartScale); | ||
370 | sd["Endscale"] = ll_sd_from_vector2(mPartData.mEndScale); | ||
371 | |||
372 | sd["ParticleMaxAge"] = mMaxAge; | ||
373 | sd["ParticleStartAge"] = mStartAge; | ||
374 | |||
375 | |||
376 | sd["LL_PART_SRC_PATTERN_DROP"] = ( mPattern & LL_PART_SRC_PATTERN_DROP) ? 1 : 0; | ||
377 | sd["LL_PART_SRC_PATTERN_EXPLODE"] = ( mPattern & LL_PART_SRC_PATTERN_EXPLODE) ? 1 : 0; | ||
378 | sd["LL_PART_SRC_PATTERN_ANGLE"] = ( mPattern & LL_PART_SRC_PATTERN_ANGLE) ? 1 : 0; | ||
379 | sd["LL_PART_SRC_PATTERN_ANGLE_CONE"] = ( mPattern & LL_PART_SRC_PATTERN_ANGLE_CONE) ? 1 : 0 ; | ||
380 | sd["LL_PART_SRC_PATTERN_ANGLE_CONE_EMPTY"] = ( mPattern & LL_PART_SRC_PATTERN_ANGLE_CONE_EMPTY) ? 1 : 0; | ||
381 | |||
382 | sd["InnerAngle"] = mInnerAngle; | ||
383 | sd["OuterAngle"] = mOuterAngle; | ||
384 | sd["AngularVelocity"] = ll_sd_from_vector3(mAngularVelocity); | ||
385 | sd["BurstRate"] = mBurstRate; | ||
386 | sd["BurstPartCount"] = mBurstPartCount; | ||
387 | sd["BurstSpeedMin"] = mBurstSpeedMin; | ||
388 | sd["BurstSpeedMax"] = mBurstSpeedMax; | ||
389 | sd["BurstRadius"] = mBurstRadius; | ||
390 | sd["PartImageID"] = mPartImageID.asString(); | ||
391 | sd["TargetId"] = mTargetUUID.asString(); | ||
392 | return sd; | ||
393 | } | ||
394 | |||
395 | bool LLPartSysData::fromLLSD(LLSD& sd) | ||
396 | { | ||
397 | mPartData.mFlags = 0; | ||
398 | if (sd["LL_PART_INTERP_COLOR_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_INTERP_COLOR_MASK; | ||
399 | if (sd["LL_PART_INTERP_SCALE_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_INTERP_SCALE_MASK; | ||
400 | if (sd["LL_PART_BOUNCE_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_BOUNCE_MASK; | ||
401 | if (sd["LL_PART_WIND_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_WIND_MASK; | ||
402 | if (sd["LL_PART_FOLLOW_SRC_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_FOLLOW_SRC_MASK; | ||
403 | if (sd["LL_PART_FOLLOW_VELOCITY_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_FOLLOW_VELOCITY_MASK; | ||
404 | if (sd["LL_PART_TARGET_POS_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_TARGET_POS_MASK; | ||
405 | if (sd["LL_PART_TARGET_LINEAR_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_TARGET_LINEAR_MASK; | ||
406 | if (sd["LL_PART_EMISSIVE_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_EMISSIVE_MASK; | ||
407 | if (sd["LL_PART_BEAM_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_BEAM_MASK; | ||
408 | |||
409 | mPartData.mMaxAge = (F32)sd["SourceMaxage"].asReal(); | ||
410 | mPartData.mStartColor = ll_color4_from_sd(sd["Startcolor"]); | ||
411 | mPartData.mEndColor = ll_color4_from_sd(sd["Endcolor"]); | ||
412 | mPartData.mStartScale = ll_vector2_from_sd(sd["Startscale"]); | ||
413 | mPartData.mEndScale = ll_vector2_from_sd(sd["Endscale"]); | ||
414 | |||
415 | mMaxAge = (F32)sd["ParticleMaxAge"].asReal(); | ||
416 | mStartAge = (F32)sd["ParticleStartAge"].asReal(); | ||
417 | |||
418 | mPattern = 0; | ||
419 | if (sd["LL_PART_SRC_PATTERN_DROP"]) mPattern |= LL_PART_SRC_PATTERN_DROP; | ||
420 | if (sd["LL_PART_SRC_PATTERN_EXPLODE"]) mPattern |= LL_PART_SRC_PATTERN_EXPLODE; | ||
421 | if (sd["LL_PART_SRC_PATTERN_ANGLE"]) mPattern |= LL_PART_SRC_PATTERN_ANGLE; | ||
422 | if (sd["LL_PART_SRC_PATTERN_ANGLE_CONE"]) mPattern |= LL_PART_SRC_PATTERN_ANGLE_CONE; | ||
423 | if (sd["LL_PART_SRC_PATTERN_ANGLE_CONE_EMPTY"]) mPattern |= LL_PART_SRC_PATTERN_ANGLE_CONE_EMPTY; | ||
424 | |||
425 | mInnerAngle = (F32)sd["InnerAngle"].asReal(); | ||
426 | mOuterAngle = (F32)sd["OuterAngle"].asReal(); | ||
427 | mAngularVelocity = ll_vector3_from_sd(sd["AngularVelocity"]); | ||
428 | mBurstRate = (F32)sd["BurstRate"].asReal(); | ||
429 | int burst_part_count = sd["BurstPartCount"]; | ||
430 | mBurstPartCount = (U8)burst_part_count; | ||
431 | mBurstSpeedMin = (F32)sd["BurstSpeedMin"].asReal(); | ||
432 | mBurstSpeedMax = (F32)sd["BurstSpeedMax"].asReal(); | ||
433 | mBurstRadius = (F32)sd["BurstRadius"].asReal(); | ||
434 | |||
435 | mPartImageID = LLUUID(sd[("PartImageID")].asString()); | ||
436 | mTargetUUID = LLUUID(sd["TargetId"].asString()); | ||
437 | |||
438 | return true; | ||
439 | } \ No newline at end of file | ||