summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRye <rye@alchemyviewer.org>2025-12-15 14:07:15 -0500
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2025-12-16 04:19:35 +0200
commit76dd2826f69f783103591be6fae3dc7582b2f6ed (patch)
tree7514ba11ffffa79e739a31fc5e6a0b821137388e
parent2d40a1cfa9930f96570cccf415f6038d6dcc657c (diff)
Clean up dead partsyspacket code
Signed-off-by: Rye <rye@alchemyviewer.org>
-rw-r--r--indra/llmessage/CMakeLists.txt2
-rw-r--r--indra/llmessage/partsyspacket.cpp1297
-rw-r--r--indra/llmessage/partsyspacket.h261
3 files changed, 0 insertions, 1560 deletions
diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt
index 2e51e1b5d4..f143ee18cf 100644
--- a/indra/llmessage/CMakeLists.txt
+++ b/indra/llmessage/CMakeLists.txt
@@ -79,7 +79,6 @@ set(llmessage_SOURCE_FILES
message_prehash.cpp
message_string_table.cpp
net.cpp
- partsyspacket.cpp
patch_code.cpp
patch_dct.cpp
patch_idct.cpp
@@ -171,7 +170,6 @@ set(llmessage_HEADER_FILES
message.h
message_prehash.h
net.h
- partsyspacket.h
patch_code.h
patch_dct.h
sound_ids.h
diff --git a/indra/llmessage/partsyspacket.cpp b/indra/llmessage/partsyspacket.cpp
deleted file mode 100644
index 6113adbfcf..0000000000
--- a/indra/llmessage/partsyspacket.cpp
+++ /dev/null
@@ -1,1297 +0,0 @@
-/**
- * @file partsyspacket.cpp
- * @brief Object for packing particle system initialization parameters
- * before sending them over the network.
- *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "linden_common.h"
-
-#include "partsyspacket.h"
-#include "indra_constants.h"
-
-// this function is global
-void gSetInitDataDefaults(LLPartInitData *setMe)
-{
- U32 i;
-
- //for(i = 0; i < 18; i++)
- //{
- // setMe->k[i] = 0.0f;
- //}
-
- //setMe->kill_p[0] = setMe->kill_p[1] = setMe->kill_p[2] = 0.0f;
- //setMe->kill_p[3] = -0.2f; // time parameter, die when t= 5.0f
- //setMe->kill_p[4] = 1.0f;
- //setMe->kill_p[5] = -0.5f; // or radius == 2 (contracting)
-
- //setMe->bounce_p[0] = setMe->bounce_p[1] =
- // setMe->bounce_p[2] = setMe->bounce_p[3] = 0.0f;
- //setMe->bounce_p[4] = 1.0f;
-
- setMe->bounce_b = 1.0f;
- // i just changed the meaning of bounce_b
- // its now the attenuation from revlecting your velocity across the normal
- // set by bounce_p
-
- //setMe->pos_ranges[0] = setMe->pos_ranges[2] = setMe->pos_ranges[4] = -1.0f;
- //setMe->pos_ranges[1] = setMe->pos_ranges[3] = setMe->pos_ranges[5] = 1.0f;
-
- //setMe->vel_ranges[0] = setMe->vel_ranges[2] = setMe->vel_ranges[4] = -1.0f;
- //setMe->vel_ranges[1] = setMe->vel_ranges[3] = setMe->vel_ranges[5] = 1.0f;
-
- for(i = 0; i < 3; i++)
- {
- setMe->diffEqAlpha[i] = 0.0f;
- setMe->diffEqScale[i] = 0.0f;
- }
-
- setMe->scale_range[0] = 1.00f;
- setMe->scale_range[1] = 5.00f;
- setMe->scale_range[2] = setMe->scale_range[3] = 0.0f;
-
- setMe->alpha_range[0] = setMe->alpha_range[1] = 1.0f;
- setMe->alpha_range[2] = setMe->alpha_range[3] = 0.0f;
-
- setMe->vel_offset[0] = 0.0f;
- setMe->vel_offset[1] = 0.0f;
- setMe->vel_offset[2] = 0.0f;
-
- // start dropping particles when I'm more then one sim away
- setMe->mDistBeginFadeout = 256.0f;
- setMe->mDistEndFadeout = 1.414f * 512.0f;
- // stop displaying particles when I'm more then two sim diagonals away
-
- setMe->mImageUuid = IMG_SHOT;
-
- for(i = 0; i < 8; i++)
- {
- setMe->mFlags[i] = 0x00;
- }
-
- setMe->createMe = true;
-
- setMe->maxParticles = 25;
- setMe->initialParticles = 25;
-
- //These defaults are for an explosion - a short lived set of debris affected by gravity.
- //Action flags default to PART_SYS_AFFECTED_BY_WIND + PART_SYS_AFFECTED_BY_GRAVITY + PART_SYS_DISTANCE_DEATH
- setMe->mFlags[PART_SYS_ACTION_BYTE] = PART_SYS_AFFECTED_BY_WIND | PART_SYS_AFFECTED_BY_GRAVITY | PART_SYS_DISTANCE_DEATH;
- setMe->mFlags[PART_SYS_KILL_BYTE] = PART_SYS_DISTANCE_DEATH + PART_SYS_TIME_DEATH;
-
- setMe->killPlaneNormal[0] = 0.0f;setMe->killPlaneNormal[1] = 0.0f;setMe->killPlaneNormal[2] = 1.0f; //Straight up
- setMe->killPlaneZ = 0.0f; //get local ground z as an approximation if turn on PART_SYS_KILL_PLANE
- setMe->bouncePlaneNormal[0] = 0.0f;setMe->bouncePlaneNormal[1] = 0.0f;setMe->bouncePlaneNormal[2] = 1.0f; //Straight up
- setMe->bouncePlaneZ = 0.0f; //get local ground z as an approximation if turn on PART_SYS_BOUNCE
- setMe->spawnRange = 1.0f;
- setMe->spawnFrequency = 0.0f; //Create the instant one dies
- setMe->spawnFreqencyRange = 0.0f;
- setMe->spawnDirection[0] = 0.0f;setMe->spawnDirection[1] = 0.0f;setMe->spawnDirection[2] = 1.0f; //Straight up
- setMe->spawnDirectionRange = 1.0f; //global scattering
- setMe->spawnVelocity = 0.75f;
- setMe->spawnVelocityRange = 0.25f; //velocity +/- 0.25
- setMe->speedLimit = 1.0f;
-
- setMe->windWeight = 0.5f; //0.0f means looks like a heavy object (if gravity is on), 1.0f means light and fluffy
- setMe->currentGravity[0] = 0.0f;setMe->currentGravity[1] = 0.0f;setMe->currentGravity[2] = -9.81f;
- //This has to be constant to allow for compression
-
- setMe->gravityWeight = 0.5f; //0.0f means boyed by air, 1.0f means it's a lead weight
- setMe->globalLifetime = 0.0f; //Arbitrary, but default is no global die, so doesn't matter
- setMe->individualLifetime = 5.0f;
- setMe->individualLifetimeRange = 1.0f; //Particles last 5 secs +/- 1
- setMe->alphaDecay = 1.0f; //normal alpha fadeout
- setMe->scaleDecay = 0.0f; //no scale decay
- setMe->distanceDeath = 10.0f; //die if hit unit radius
- setMe->dampMotionFactor = 0.0f;
-
- setMe->windDiffusionFactor[0] = 0.0f;
- setMe->windDiffusionFactor[1] = 0.0f;
- setMe->windDiffusionFactor[2] = 0.0f;
-}
-
-LLPartSysCompressedPacket::LLPartSysCompressedPacket()
-{
- // default constructor for mDefaults called implicitly/automatically here
- for(int i = 0; i < MAX_PART_SYS_PACKET_SIZE; i++)
- {
- mData[i] = '\0';
- }
-
- mNumBytes = 0;
-
- gSetInitDataDefaults(&mDefaults);
-}
-
-LLPartSysCompressedPacket::~LLPartSysCompressedPacket()
-{
- // no dynamic data is stored by this class, do nothing.
-}
-
-void LLPartSysCompressedPacket::writeFlagByte(LLPartInitData *in)
-{
- mData[0] = mData[1] = mData[2] = '\0';
-
- U32 i;
- //for(i = 1; i < 18; i++) {
- // if(in->k[i] != mDefaults.k[i])
- // {
- // mData[0] |= PART_SYS_K_MASK;
- // break;
- // }
- //}
-
- if(in->killPlaneZ != mDefaults.killPlaneZ ||
- in->killPlaneNormal[0] != mDefaults.killPlaneNormal[0] ||
- in->killPlaneNormal[1] != mDefaults.killPlaneNormal[1] ||
- in->killPlaneNormal[2] != mDefaults.killPlaneNormal[2] ||
- in->distanceDeath != mDefaults.distanceDeath)
- {
- mData[0] |= PART_SYS_KILL_P_MASK;
- }
-
-
-
- if(in->bouncePlaneZ != mDefaults.bouncePlaneZ ||
- in->bouncePlaneNormal[0] != mDefaults.bouncePlaneNormal[0] ||
- in->bouncePlaneNormal[1] != mDefaults.bouncePlaneNormal[1] ||
- in->bouncePlaneNormal[2] != mDefaults.bouncePlaneNormal[2])
- {
- mData[0] |= PART_SYS_BOUNCE_P_MASK;
- }
-
- if(in->bounce_b != mDefaults.bounce_b)
- {
- mData[0] |= PART_SYS_BOUNCE_B_MASK;
- }
-
-
- //if(in->pos_ranges[0] != mDefaults.pos_ranges[0] || in->pos_ranges[1] != mDefaults.pos_ranges[1] ||
- // in->pos_ranges[2] != mDefaults.pos_ranges[2] || in->pos_ranges[3] != mDefaults.pos_ranges[3] ||
- // in->pos_ranges[4] != mDefaults.pos_ranges[4] || in->pos_ranges[5] != mDefaults.pos_ranges[5])
- //{
- // mData[0] |= PART_SYS_POS_RANGES_MASK;
- //}
-
- //if(in->vel_ranges[0] != mDefaults.vel_ranges[0] || in->vel_ranges[1] != mDefaults.vel_ranges[1] ||
- // in->vel_ranges[2] != mDefaults.vel_ranges[2] || in->vel_ranges[3] != mDefaults.vel_ranges[3] ||
- // in->vel_ranges[4] != mDefaults.vel_ranges[4] || in->vel_ranges[5] != mDefaults.vel_ranges[5])
- //{
-// mData[0] |= PART_SYS_VEL_RANGES_MASK;
- //}
-
-
- if(in->diffEqAlpha[0] != mDefaults.diffEqAlpha[0] ||
- in->diffEqAlpha[1] != mDefaults.diffEqAlpha[1] ||
- in->diffEqAlpha[2] != mDefaults.diffEqAlpha[2] ||
- in->diffEqScale[0] != mDefaults.diffEqScale[0] ||
- in->diffEqScale[1] != mDefaults.diffEqScale[1] ||
- in->diffEqScale[2] != mDefaults.diffEqScale[2])
- {
- mData[0] |= PART_SYS_ALPHA_SCALE_DIFF_MASK;
- }
-
-
- if(in->scale_range[0] != mDefaults.scale_range[0] ||
- in->scale_range[1] != mDefaults.scale_range[1] ||
- in->scale_range[2] != mDefaults.scale_range[2] ||
- in->scale_range[3] != mDefaults.scale_range[3])
- {
- mData[0] |= PART_SYS_SCALE_RANGE_MASK;
- }
-
-
- if(in->alpha_range[0] != mDefaults.alpha_range[0] ||
- in->alpha_range[1] != mDefaults.alpha_range[1] ||
- in->alpha_range[2] != mDefaults.alpha_range[2] ||
- in->alpha_range[3] != mDefaults.alpha_range[3])
- {
- mData[2] |= PART_SYS_BYTE_3_ALPHA_MASK;
- }
-
- if(in->vel_offset[0] != mDefaults.vel_offset[0] ||
- in->vel_offset[1] != mDefaults.vel_offset[1] ||
- in->vel_offset[2] != mDefaults.vel_offset[2])
- {
- mData[0] |= PART_SYS_VEL_OFFSET_MASK;
- }
-
-
- if(in->mImageUuid != mDefaults.mImageUuid)
- {
- mData[0] |= PART_SYS_M_IMAGE_UUID_MASK;
- }
-
- for( i = 0; i < 8; i++)
- {
- if(in->mFlags[i])
- {
- mData[1] |= 1<<i;
-// llprintline("Flag \"%x\" gets byte \"%x\"\n", i<<i, in->mFlags[i]);
- }
- }
-
-
- if(in->spawnRange != mDefaults.spawnRange ||
- in->spawnFrequency != mDefaults.spawnFrequency ||
- in->spawnFreqencyRange != mDefaults.spawnFreqencyRange ||
- in->spawnDirection[0] != mDefaults.spawnDirection[0] ||
- in->spawnDirection[1] != mDefaults.spawnDirection[1] ||
- in->spawnDirection[2] != mDefaults.spawnDirection[2] ||
- in->spawnDirectionRange != mDefaults.spawnDirectionRange ||
- in->spawnVelocity != mDefaults.spawnVelocity ||
- in->spawnVelocityRange != mDefaults.spawnVelocityRange)
- {
- mData[3] |= PART_SYS_BYTE_SPAWN_MASK;
- }
-
-
- if(in->windWeight != mDefaults.windWeight ||
- in->currentGravity[0] != mDefaults.currentGravity[0] ||
- in->currentGravity[1] != mDefaults.currentGravity[1] ||
- in->currentGravity[2] != mDefaults.currentGravity[2] ||
- in->gravityWeight != mDefaults.gravityWeight)
- {
- mData[3] |= PART_SYS_BYTE_ENVIRONMENT_MASK;
- }
-
-
- if(in->globalLifetime != mDefaults.globalLifetime ||
- in->individualLifetime != mDefaults.individualLifetime ||
- in->individualLifetimeRange != mDefaults.individualLifetimeRange)
- {
- mData[3] |= PART_SYS_BYTE_LIFESPAN_MASK;
- }
-
-
- if(in->speedLimit != mDefaults.speedLimit ||
- in->alphaDecay != mDefaults.alphaDecay ||
- in->scaleDecay != mDefaults.scaleDecay ||
- in->dampMotionFactor != mDefaults.dampMotionFactor)
- {
- mData[3] |= PART_SYS_BYTE_DECAY_DAMP_MASK;
- }
-
- if(in->windDiffusionFactor[0] != mDefaults.windDiffusionFactor[0] ||
- in->windDiffusionFactor[1] != mDefaults.windDiffusionFactor[1] ||
- in->windDiffusionFactor[2] != mDefaults.windDiffusionFactor[2])
- {
- mData[3] |= PART_SYS_BYTE_WIND_DIFF_MASK;
- }
-}
-
-F32 floatFromTwoBytes(S8 bMant, S8 bExp)
-{
- F32 result = bMant;
- while(bExp > 0)
- {
- result *= 2.0f;
- bExp--;
- }
- while(bExp < 0)
- {
- result *= 0.5f;
- bExp++;
- }
- return result;
-}
-
-void twoBytesFromFloat(F32 fIn, S8 &bMant, S8 &bExp)
-{
- bExp = 0;
- if(fIn > 127.0f)
- {
- fIn = 127.0f;
- }
- if(fIn < -127.0f)
- {
- fIn = -127.0f;
- }
- while(fIn < 64 && fIn > -64 && bExp > -127)
- {
- fIn *= 2.0f;
- bExp--;
- }
- while((fIn > 128 || fIn < -128) && bExp < 127)
- {
- fIn *= 0.5f;
- bExp++;
- }
- bMant = (S8)fIn;
-}
-
-
-
-/*
-U32 LLPartSysCompressedPacket::writeK(LLPartInitData *in, U32 startByte)
-{
- U32 i, kFlag, i_mod_eight;
- S8 bMant, bExp;
-
- kFlag = startByte;
-
- startByte += 3; // 3 bytes contain enough room for 18 flag bits
- mData[kFlag] = 0x00;
-// llprintline("In the writeK\n");
-
- i_mod_eight = 0;
- for(i = 0; i < 18; i++)
- {
- if(in->k[i] != mDefaults.k[i])
- {
-
- mData[kFlag] |= 1<<i_mod_eight;
- twoBytesFromFloat(in->k[i], bMant, bExp);
-
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- }
- i_mod_eight++;
- while(i_mod_eight >= 8)
- {
- kFlag++;
- i_mod_eight -= 8;
- }
- }
-
- return startByte;
-}*/
-
-U32 LLPartSysCompressedPacket::writeKill_p(LLPartInitData *in, U32 startByte)
-{
- S8 bMant, bExp;
-
- twoBytesFromFloat(in->killPlaneNormal[0], bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- twoBytesFromFloat(in->killPlaneNormal[1], bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- twoBytesFromFloat(in->killPlaneNormal[2], bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
-
- twoBytesFromFloat(in->killPlaneZ, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- twoBytesFromFloat(in->distanceDeath, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
-
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::writeBounce_p(LLPartInitData *in, U32 startByte)
-{
- S8 bMant, bExp;
-
- twoBytesFromFloat(in->bouncePlaneNormal[0], bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- twoBytesFromFloat(in->bouncePlaneNormal[1], bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- twoBytesFromFloat(in->bouncePlaneNormal[2], bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
-
-
- twoBytesFromFloat(in->bouncePlaneZ, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
-
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::writeBounce_b(LLPartInitData *in, U32 startByte)
-{
- S8 bMant, bExp;
- twoBytesFromFloat(in->bounce_b, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- return startByte;
-}
-
-//U32 LLPartSysCompressedPacket::writePos_ranges(LLPartInitData *in, U32 startByte)
-//{
-// S8 tmp;
-// int i;
-// for(i = 0; i < 6; i++)
-// {
-// tmp = (S8) in->pos_ranges[i]; // float to int conversion (keep the sign)
-// mData[startByte++] = (U8)tmp; // signed to unsigned typecast
-// }
-// return startByte;
-//}
-
-//U32 LLPartSysCompressedPacket::writeVel_ranges(LLPartInitData *in, U32 startByte)
-//{
-// S8 tmp;
-// int i;
-// for(i = 0; i < 6; i++)
-// {
-// tmp = (S8) in->vel_ranges[i]; // float to int conversion (keep the sign)
-// mData[startByte++] = (U8)tmp; // signed to unsigned typecast
-// }
-// return startByte;
-//}
-
-U32 LLPartSysCompressedPacket::writeAlphaScaleDiffEqn_range(LLPartInitData *in, U32 startByte)
-{
- S8 bExp, bMant;
- int i;
- for(i = 0; i < 3; i++)
- {
- twoBytesFromFloat(in->diffEqAlpha[i], bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- }
- for(i = 0; i < 3; i++)
- {
- twoBytesFromFloat(in->diffEqScale[i], bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- }
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::writeScale_range(LLPartInitData *in, U32 startByte)
-{
- S8 bExp, bMant;
- int i;
- for(i = 0; i < 4; i++)
- {
- twoBytesFromFloat(in->scale_range[i], bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- }
- return startByte;
-}
-
-
-U32 LLPartSysCompressedPacket::writeAlpha_range(LLPartInitData *in, U32 startByte)
-{
- S8 bExp, bMant;
- int i;
- for(i = 0; i < 4; i++)
- {
- twoBytesFromFloat(in->alpha_range[i], bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- }
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::writeVelocityOffset(LLPartInitData *in, U32 startByte)
-{
- S8 bExp, bMant;
- int i;
- for(i = 0; i < 3; i++)
- {
- twoBytesFromFloat(in->vel_offset[i], bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- }
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::writeUUID(LLPartInitData *in, U32 startByte)
-{
- U8 * bufPtr = mData + startByte;
- if(in->mImageUuid == IMG_SHOT) {
- mData[startByte++] = 0x01;
- return startByte;
- }
-
- if(in->mImageUuid == IMG_SPARK) {
- mData[startByte++] = 0x02;
- return startByte;
- }
-
-
- if(in->mImageUuid == IMG_BIG_EXPLOSION_1) {
- mData[startByte++] = 0x03;
- return startByte;
- }
-
- if(in->mImageUuid == IMG_BIG_EXPLOSION_2) {
- mData[startByte++] = 0x04;
- return startByte;
- }
-
-
- if(in->mImageUuid == IMG_SMOKE_POOF) {
- mData[startByte++] = 0x05;
- return startByte;
- }
-
- if(in->mImageUuid == IMG_FIRE) {
- mData[startByte++] = 0x06;
- return startByte;
- }
-
-
- if(in->mImageUuid == IMG_EXPLOSION) {
- mData[startByte++] = 0x07;
- return startByte;
- }
-
- if(in->mImageUuid == IMG_EXPLOSION_2) {
- mData[startByte++] = 0x08;
- return startByte;
- }
-
-
- if(in->mImageUuid == IMG_EXPLOSION_3) {
- mData[startByte++] = 0x09;
- return startByte;
- }
-
- if(in->mImageUuid == IMG_EXPLOSION_4) {
- mData[startByte++] = 0x0A;
- return startByte;
- }
-
- mData[startByte++] = 0x00; // flag for "read whole UUID"
-
- memcpy(bufPtr, in->mImageUuid.mData, 16); /* Flawfinder: ignore */
- return (startByte+16);
-}
-
-U32 LLPartSysCompressedPacket::writeSpawn(LLPartInitData *in, U32 startByte)
-{
- S8 bExp, bMant;
- int i;
-
- twoBytesFromFloat(in->spawnRange, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- twoBytesFromFloat(in->spawnFrequency, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- twoBytesFromFloat(in->spawnFreqencyRange, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
-
-
-
- for(i = 0; i < 3; i++)
- {
- twoBytesFromFloat(in->spawnDirection[i], bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- }
-
- twoBytesFromFloat(in->spawnDirectionRange, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- twoBytesFromFloat(in->spawnVelocity, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- twoBytesFromFloat(in->spawnVelocityRange, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
-
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::writeEnvironment(LLPartInitData *in, U32 startByte)
-{
- S8 bExp, bMant;
- int i;
-
- twoBytesFromFloat(in->windWeight, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
-
- for(i = 0; i < 3; i++)
- {
- twoBytesFromFloat(in->currentGravity[i], bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- }
-
- twoBytesFromFloat(in->gravityWeight, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::writeLifespan(LLPartInitData *in, U32 startByte)
-{
- S8 bExp, bMant;
-
- twoBytesFromFloat(in->globalLifetime, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
-
- twoBytesFromFloat(in->individualLifetime, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
-
- twoBytesFromFloat(in->individualLifetimeRange, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
-
- return startByte;
-}
-
-
-U32 LLPartSysCompressedPacket::writeDecayDamp(LLPartInitData *in, U32 startByte)
-{
- S8 bExp, bMant;
-
- twoBytesFromFloat(in->speedLimit, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
-
- twoBytesFromFloat(in->alphaDecay, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
-
- twoBytesFromFloat(in->scaleDecay, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
-
- twoBytesFromFloat(in->dampMotionFactor, bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
-
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::writeWindDiffusionFactor(LLPartInitData *in, U32 startByte)
-{
- S8 bExp, bMant;
-
- twoBytesFromFloat(in->windDiffusionFactor[0], bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
-
- twoBytesFromFloat(in->windDiffusionFactor[1], bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
-
- twoBytesFromFloat(in->windDiffusionFactor[2], bMant, bExp);
- mData[startByte++] = bMant;
- mData[startByte++] = bExp;
-
- return startByte;
-}
-
-
-
-
-
-
-/*
-U32 LLPartSysCompressedPacket::readK(LLPartInitData *in, U32 startByte)
-{
- U32 i, i_mod_eight, kFlag;
- S8 bMant, bExp; // 1 bytes mantissa and exponent for a float
- kFlag = startByte;
- startByte += 3; // 3 bytes has enough room for 18 bits
-
- i_mod_eight = 0;
- for(i = 0; i < 18; i++)
- {
- if(mData[kFlag]&(1<<i_mod_eight))
- {
-
-
-
- bMant = mData[startByte++];
- bExp = mData[startByte++];
-
-
- in->k[i] = floatFromTwoBytes(bMant, bExp); // much tighter platform-independent
- // way to ship floats
-
- }
- i_mod_eight++;
- if(i_mod_eight >= 8)
- {
- i_mod_eight -= 8;
- kFlag++;
- }
- }
-
- return startByte;
-}
-*/
-
-U32 LLPartSysCompressedPacket::readKill_p(LLPartInitData *in, U32 startByte)
-{
- S8 bMant, bExp;
-
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->killPlaneNormal[0] = floatFromTwoBytes(bMant, bExp);
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->killPlaneNormal[1] = floatFromTwoBytes(bMant, bExp);
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->killPlaneNormal[2] = floatFromTwoBytes(bMant, bExp);
-
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->killPlaneZ = floatFromTwoBytes(bMant, bExp);
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->distanceDeath = floatFromTwoBytes(bMant, bExp);
-
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::readBounce_p(LLPartInitData *in, U32 startByte)
-{
-
- S8 bMant, bExp;
-
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->bouncePlaneNormal[0] = floatFromTwoBytes(bMant, bExp);
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->bouncePlaneNormal[1] = floatFromTwoBytes(bMant, bExp);
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->bouncePlaneNormal[2] = floatFromTwoBytes(bMant, bExp);
-
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->bouncePlaneZ = floatFromTwoBytes(bMant, bExp);
-
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::readBounce_b(LLPartInitData *in, U32 startByte)
-{
- S8 bMant, bExp;
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->bounce_b = floatFromTwoBytes(bMant, bExp);
- return startByte;
-}
-
-
-//U32 LLPartSysCompressedPacket::readPos_ranges(LLPartInitData *in, U32 startByte)
-//{
-// S8 tmp;
-// int i;
-// for(i = 0; i < 6; i++)
-// {
-// tmp = (S8)mData[startByte++];
-// in->pos_ranges[i] = tmp;
-// }
-// return startByte;
-//}
-
-//U32 LLPartSysCompressedPacket::readVel_ranges(LLPartInitData *in, U32 startByte)
-//{
-// S8 tmp;
-// int i;
-// for(i = 0; i < 6; i++)
-// {
-// tmp = (S8)mData[startByte++];
-// in->vel_ranges[i] = tmp;
-// }
-// return startByte;
-//}
-
-
-
-U32 LLPartSysCompressedPacket::readAlphaScaleDiffEqn_range(LLPartInitData *in, U32 startByte)
-{
- int i;
- S8 bMant, bExp;
- for(i = 0; i < 3; i++)
- {
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->diffEqAlpha[i] = floatFromTwoBytes(bMant, bExp);
- }
- for(i = 0; i < 3; i++)
- {
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->diffEqScale[i] = floatFromTwoBytes(bMant, bExp);
- }
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::readAlpha_range(LLPartInitData *in, U32 startByte)
-{
- int i;
- S8 bMant, bExp;
- for(i = 0; i < 4; i++)
- {
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->alpha_range[i] = floatFromTwoBytes(bMant, bExp);
- }
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::readScale_range(LLPartInitData *in, U32 startByte)
-{
- int i;
- S8 bMant, bExp;
- for(i = 0; i < 4; i++)
- {
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->scale_range[i] = floatFromTwoBytes(bMant, bExp);
- }
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::readVelocityOffset(LLPartInitData *in, U32 startByte)
-{
- int i;
- S8 bMant, bExp;
- for(i = 0; i < 3; i++)
- {
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->vel_offset[i] = floatFromTwoBytes(bMant, bExp);
- }
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::readUUID(LLPartInitData *in, U32 startByte)
-{
- U8 * bufPtr = mData + startByte;
-
- if(mData[startByte] == 0x01)
- {
- in->mImageUuid = IMG_SHOT;
- return startByte+1;
- }
- if(mData[startByte] == 0x02)
- {
- in->mImageUuid = IMG_SPARK;
- return startByte+1;
- }
- if(mData[startByte] == 0x03)
- {
- in->mImageUuid = IMG_BIG_EXPLOSION_1;
- return startByte+1;
- }
- if(mData[startByte] == 0x04)
- {
- in->mImageUuid = IMG_BIG_EXPLOSION_2;
- return startByte+1;
- }
- if(mData[startByte] == 0x05)
- {
- in->mImageUuid = IMG_SMOKE_POOF;
- return startByte+1;
- }
- if(mData[startByte] == 0x06)
- {
- in->mImageUuid = IMG_FIRE;
- return startByte+1;
- }
- if(mData[startByte] == 0x07)
- {
- in->mImageUuid = IMG_EXPLOSION;
- return startByte+1;
- }
- if(mData[startByte] == 0x08)
- {
- in->mImageUuid = IMG_EXPLOSION_2;
- return startByte+1;
- }
- if(mData[startByte] == 0x09)
- {
- in->mImageUuid = IMG_EXPLOSION_3;
- return startByte+1;
- }
- if(mData[startByte] == 0x0A)
- {
- in->mImageUuid = IMG_EXPLOSION_4;
- return startByte+1;
- }
-
- startByte++; // cause we actually have to read the UUID now.
- memcpy(in->mImageUuid.mData, bufPtr, 16); /* Flawfinder: ignore */
- return (startByte+16);
-}
-
-
-
-
-U32 LLPartSysCompressedPacket::readSpawn(LLPartInitData *in, U32 startByte)
-{
- S8 bMant, bExp;
- U32 i;
-
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->spawnRange = floatFromTwoBytes(bMant, bExp);
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->spawnFrequency = floatFromTwoBytes(bMant, bExp);
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->spawnFreqencyRange = floatFromTwoBytes(bMant, bExp);
-
- for(i = 0; i < 3; i++)
- {
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->spawnDirection[i] = floatFromTwoBytes(bMant, bExp);
- }
-
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->spawnDirectionRange = floatFromTwoBytes(bMant, bExp);
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->spawnVelocity = floatFromTwoBytes(bMant, bExp);
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->spawnVelocityRange = floatFromTwoBytes(bMant, bExp);
-
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::readEnvironment(LLPartInitData *in, U32 startByte)
-{
- S8 bMant, bExp;
- U32 i;
-
-
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->windWeight = floatFromTwoBytes(bMant, bExp);
-
- for(i = 0; i < 3; i++)
- {
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->currentGravity[i] = floatFromTwoBytes(bMant, bExp);
- }
-
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->gravityWeight = floatFromTwoBytes(bMant, bExp);
-
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::readLifespan(LLPartInitData *in, U32 startByte)
-{
- S8 bMant, bExp;
-
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->globalLifetime = floatFromTwoBytes(bMant, bExp);
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->individualLifetime = floatFromTwoBytes(bMant, bExp);
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->individualLifetimeRange = floatFromTwoBytes(bMant, bExp);
-
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::readDecayDamp(LLPartInitData *in, U32 startByte)
-{
- S8 bMant, bExp;
-
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->speedLimit = floatFromTwoBytes(bMant, bExp);
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->alphaDecay = floatFromTwoBytes(bMant, bExp);
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->scaleDecay = floatFromTwoBytes(bMant, bExp);
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->dampMotionFactor = floatFromTwoBytes(bMant, bExp);
-
- return startByte;
-}
-
-U32 LLPartSysCompressedPacket::readWindDiffusionFactor(LLPartInitData *in, U32 startByte)
-{
- int i;
- S8 bMant, bExp;
- for(i = 0; i < 3; i++)
- {
- bMant = mData[startByte++];
- bExp = mData[startByte++];
- in->windDiffusionFactor[i] = floatFromTwoBytes(bMant, bExp);
- }
- return startByte;
-}
-
-bool LLPartSysCompressedPacket::fromLLPartInitData(LLPartInitData *in, U32 &bytesUsed)
-{
-
- writeFlagByte(in);
- U32 currByte = 4;
-
-// llprintline("calling \"fromLLPartInitData\"\n");
-
- //if(mData[0] & PART_SYS_K_MASK)
- //{
- // currByte = writeK(in, 3); // first 3 bytes are reserved for header data
- //}
-
-
-
- if(mData[0] & PART_SYS_KILL_P_MASK)
- {
- currByte = writeKill_p(in, currByte);
- }
-
- if(mData[0] & PART_SYS_BOUNCE_P_MASK)
- {
- currByte = writeBounce_p(in, currByte);
- }
-
- if(mData[0] & PART_SYS_BOUNCE_B_MASK)
- {
- currByte = writeBounce_b(in, currByte);
- }
-
- //if(mData[0] & PART_SYS_POS_RANGES_MASK)
- //{
- // currByte = writePos_ranges(in, currByte);
- //}
-
- //if(mData[0] & PART_SYS_VEL_RANGES_MASK)
- //{
- // currByte = writeVel_ranges(in, currByte);
- //}
-
- if(mData[0] & PART_SYS_ALPHA_SCALE_DIFF_MASK)
- {
- currByte = writeAlphaScaleDiffEqn_range(in, currByte);
- }
-
- if(mData[0] & PART_SYS_SCALE_RANGE_MASK)
- {
- currByte = writeScale_range(in, currByte);
- }
-
- if(mData[0] & PART_SYS_VEL_OFFSET_MASK)
- {
- currByte = writeVelocityOffset(in, currByte);
- }
-
- if(mData[0] & PART_SYS_M_IMAGE_UUID_MASK)
- {
- currByte = writeUUID(in, currByte);
- }
-
-
- if(mData[3] & PART_SYS_BYTE_SPAWN_MASK)
- {
- currByte = writeSpawn(in, currByte);
- }
-
- if(mData[3] & PART_SYS_BYTE_ENVIRONMENT_MASK)
- {
- currByte = writeEnvironment(in, currByte);
- }
-
- if(mData[3] & PART_SYS_BYTE_LIFESPAN_MASK)
- {
- currByte = writeLifespan(in, currByte);
- }
-
- if(mData[3] & PART_SYS_BYTE_DECAY_DAMP_MASK)
- {
- currByte = writeDecayDamp(in, currByte);
- }
-
- if(mData[3] & PART_SYS_BYTE_WIND_DIFF_MASK)
- {
- currByte = writeWindDiffusionFactor(in, currByte);
- }
-
-
- if(mData[2] & PART_SYS_BYTE_3_ALPHA_MASK)
- {
- currByte = writeAlpha_range(in, currByte);
- }
-
- mData[currByte++] = (U8)in->maxParticles;
- mData[currByte++] = (U8)in->initialParticles;
-
-
- U32 flagFlag = 1; // flag indicating which flag bytes are non-zero
- // yeah, I know, the name sounds funny
- for(U32 i = 0; i < 8; i++)
- {
-
-// llprintline("Flag \"%x\" gets byte \"%x\"\n", flagFlag, in->mFlags[i]);
- if(mData[1] & flagFlag)
- {
- mData[currByte++] = in->mFlags[i];
-// llprintline("and is valid...\n");
- }
- flagFlag <<= 1;
- }
-
- bytesUsed = mNumBytes = currByte;
-
-
-
-// llprintline("returning from \"fromLLPartInitData\" with %d bytes\n", bytesUsed);
-
- return true;
-}
-
-bool LLPartSysCompressedPacket::toLLPartInitData(LLPartInitData *out, U32 *bytesUsed)
-{
- U32 currByte = 4;
-
- gSetInitDataDefaults(out);
-
- if(mData[0] & PART_SYS_KILL_P_MASK)
- {
- currByte = readKill_p(out, currByte);
- }
-
- if(mData[0] & PART_SYS_BOUNCE_P_MASK)
- {
- currByte = readBounce_p(out, currByte);
- }
-
- if(mData[0] & PART_SYS_BOUNCE_B_MASK)
- {
- currByte = readBounce_b(out, currByte);
- }
-
- if(mData[0] & PART_SYS_ALPHA_SCALE_DIFF_MASK)
- {
- currByte = readAlphaScaleDiffEqn_range(out, currByte);
- }
-
- if(mData[0] & PART_SYS_SCALE_RANGE_MASK)
- {
- currByte = readScale_range(out, currByte);
- }
-
- if(mData[0] & PART_SYS_VEL_OFFSET_MASK)
- {
- currByte = readVelocityOffset(out, currByte);
- }
-
- if(mData[0] & PART_SYS_M_IMAGE_UUID_MASK)
- {
- currByte = readUUID(out, currByte);
- }
-
-
- if(mData[3] & PART_SYS_BYTE_SPAWN_MASK)
- {
- currByte = readSpawn(out, currByte);
- }
-
- if(mData[3] & PART_SYS_BYTE_ENVIRONMENT_MASK)
- {
- currByte = readEnvironment(out, currByte);
- }
-
- if(mData[3] & PART_SYS_BYTE_LIFESPAN_MASK)
- {
- currByte = readLifespan(out, currByte);
- }
-
- if(mData[3] & PART_SYS_BYTE_DECAY_DAMP_MASK)
- {
- currByte = readDecayDamp(out, currByte);
- }
-
- if(mData[3] & PART_SYS_BYTE_WIND_DIFF_MASK)
- {
- currByte = readWindDiffusionFactor(out, currByte);
- }
-
- if(mData[2] & PART_SYS_BYTE_3_ALPHA_MASK)
- {
- currByte = readAlpha_range(out, currByte);
- }
-
- out->maxParticles = mData[currByte++];
- out->initialParticles = mData[currByte++];
-
- U32 flagFlag = 1; // flag indicating which flag bytes are non-zero
- // yeah, I know, the name sounds funny
- for(U32 i = 0; i < 8; i++)
- {
- flagFlag = 1<<i;
-
- if((mData[1] & flagFlag))
- {
- out->mFlags[i] = mData[currByte++];
- }
- }
-
- *bytesUsed = currByte;
- return true;
-}
-
-bool LLPartSysCompressedPacket::fromUnsignedBytes(U8 *in, U32 bytesUsed)
-{
- if ((in != NULL) && (bytesUsed <= sizeof(mData)))
- {
- memcpy(mData, in, bytesUsed); /* Flawfinder: ignore */
- mNumBytes = bytesUsed;
- return true;
- }
- else
- {
- LL_ERRS() << "NULL input data or number of bytes exceed mData size" << LL_ENDL;
- return false;
- }
-}
-
-
-U32 LLPartSysCompressedPacket::bufferSize()
-{
- return mNumBytes;
-}
-
-bool LLPartSysCompressedPacket::toUnsignedBytes(U8 *out)
-{
- memcpy(out, mData, mNumBytes); /* Flawfinder: ignore */
- return true;
-}
-
-U8 * LLPartSysCompressedPacket::getBytePtr()
-{
- return mData;
-}
-
-
diff --git a/indra/llmessage/partsyspacket.h b/indra/llmessage/partsyspacket.h
deleted file mode 100644
index 23307f3409..0000000000
--- a/indra/llmessage/partsyspacket.h
+++ /dev/null
@@ -1,261 +0,0 @@
-/**
- * @file partsyspacket.h
- * @brief Object for packing particle system initialization parameters
- * before sending them over the network
- *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_PARTSYSPACKET_H
-#define LL_PARTSYSPACKET_H
-
-#include "lluuid.h"
-
-// Particle system stuff
-
-const U64 PART_SYS_MAX_TIME_IN_USEC = 1000000; // 1 second, die not quite near instantaneously
-
-
-// this struct is for particle system initialization parameters
-// I'm breaking some rules here, but I need a storage structure to hold initialization data
-// for these things. Sorry guys, they're not simple enough (yet) to avoid this cleanly
-struct LLPartInitData {
- // please do not add functions to this class -- data only!
- //F32 k[18]; // first 9 --> x,y,z last 9 --> scale, alpha, rot
- //F32 kill_p[6]; // last one is for particles that die when they reach a spherical bounding radius
- //F32 kill_plane[3];
- //F32 bounce_p[5];
- F32 bounce_b; // recently changed
- // no need to store orientation and position here, as they're sent over seperately
- //F32 pos_ranges[6];
- //F32 vel_ranges[6];
- F32 scale_range[4];
- F32 alpha_range[4];
- F32 vel_offset[3]; //new - more understandable!
-
- F32 mDistBeginFadeout; // for fadeout LOD optimization
- F32 mDistEndFadeout;
-
- LLUUID mImageUuid;
- //U8 n; // number of particles
- U8 mFlags[8]; // for miscellaneous data --> its interpretation can change at my whim!
- U8 createMe; // do I need to be created? or has the work allready been done?
- //ActionFlag is now mFlags[PART_SYS_ACTION_BYTE]
- //Spawn point is initially object creation center
-
- F32 diffEqAlpha[3];
- F32 diffEqScale[3];
-
- U8 maxParticles;
- //How many particles exist at any time within the system?
- U8 initialParticles;
- //How many particles exist when the system is created?
- F32 killPlaneZ;
- //For simplicity assume the XY plane, so this sets an altitude at which to die
- F32 killPlaneNormal[3];
- //Normal if not planar XY
- F32 bouncePlaneZ;
- //For simplicity assume the XY plane, so this sets an altitude at which to bounce
- F32 bouncePlaneNormal[3];
- //Normal if not planar XY
- F32 spawnRange;
- //Range of emission points about the mSpawnPoint
- F32 spawnFrequency;
- //Required if the system is to spawn new particles.
- //This variable determines the time after a particle dies when it is respawned.
- F32 spawnFreqencyRange;
- //Determines the random range of time until a new particle is spawned.
- F32 spawnDirection[3];
- //Direction vector giving the mean direction in which particles are spawned
- F32 spawnDirectionRange;
- //Direction limiting the angular range of emissions about the mean direction. 1.0f means everywhere, 0.0f means uni-directional
- F32 spawnVelocity;
- //The mean speed at which particles are emitted
- F32 spawnVelocityRange;
- //The range of speeds about the mean at which particles are emitted.
- F32 speedLimit;
- //Used to constrain particle maximum velocity
- F32 windWeight;
- //How much of an effect does wind have
- F32 currentGravity[3];
- //Gravity direction used in update calculations
- F32 gravityWeight;
- //How much of an effect does gravity have
- F32 globalLifetime;
- //If particles re-spawn, a system can exist forever.
- //If (ActionFlags & PART_SYS_GLOBAL_DIE) is true this variable is used to determine how long the system lasts.
- F32 individualLifetime;
- //How long does each particle last if nothing else happens to it
- F32 individualLifetimeRange;
- //Range of variation in individual lifetimes
- F32 alphaDecay;
- //By what factor does alpha decrease as the lifetime of a particle is approached.
- F32 scaleDecay;
- //By what factor does scale decrease as the lifetime of a particle is approached.
- F32 distanceDeath;
- //With the increased functionality, particle systems can expand to indefinite size
- //(e.g. wind can chaotically move particles into a wide spread).
- //To avoid particles exceeding normal object size constraints,
- //set the PART_SYS_DISTANCE_DEATH flag, and set a distance value here, representing a radius around the spawn point.
- F32 dampMotionFactor;
- //How much to damp motion
- F32 windDiffusionFactor[3];
- //Change the size and alpha of particles as wind speed increases (scale gets bigger, alpha smaller)
-};
-
-// constants for setting flag values
-// BYTES are in range 0-8, bits are in range 2^0 - 2^8 and can only be powers of two
-const int PART_SYS_NO_Z_BUFFER_BYTE = 0; // option to turn off z-buffer when rendering
-const int PART_SYS_NO_Z_BUFFER_BIT = 2; // particle systems --
-// I advise against using this, as it looks bad in every case I've tried
-
-const int PART_SYS_SLOW_ANIM_BYTE = 0; // slow animation down by a factor of 10
-const int PART_SYS_SLOW_ANIM_BIT = 1; // useful for tweaking anims during debugging
-
-const int PART_SYS_FOLLOW_VEL_BYTE = 0; // indicates whether to orient sprites towards
-const int PART_SYS_FOLLOW_VEL_BIT = 4; // their velocity vector -- default is false
-
-const int PART_SYS_IS_LIGHT_BYTE = 0; // indicates whether a particular particle system
-const int PART_SYS_IS_LIGHT_BIT = 8; // is also a light object -- for andrew
-// should deprecate this once there is a general method for setting light properties of objects
-
-const int PART_SYS_SPAWN_COPY_BYTE = 0; // indicates whether to spawn baby particle systems on
-const int PART_SYS_SPAWN_COPY_BIT = 0x10; // particle death -- intended for smoke trails
-
-const int PART_SYS_COPY_VEL_BYTE = 0; // indicates whether baby particle systems inherit parents vel
-const int PART_SYS_COPY_VEL_BIT = 0x20; // (by default they don't)
-
-const int PART_SYS_INVISIBLE_BYTE = 0; // optional -- turn off display, just simulate
-const int PART_SYS_INVISIBLE_BIT = 0x40; // useful for smoke trails
-
-const int PART_SYS_ADAPT_TO_FRAMERATE_BYTE = 0; // drop sprites from render call proportionally
-const int PART_SYS_ADAPT_TO_FRAMERATE_BIT = 0x80; // to how far we are below 60 fps
-
-
-// 26 September 2001 - not even big enough to hold all changes, so should enlarge anyway
-//const U16 MAX_PART_SYS_PACKET_SIZE = 180;
-const U16 MAX_PART_SYS_PACKET_SIZE = 256;
-
-//const U8 PART_SYS_K_MASK = 0x01;
-const U8 PART_SYS_KILL_P_MASK = 0x02;
-const U8 PART_SYS_BOUNCE_P_MASK = 0x04;
-const U8 PART_SYS_BOUNCE_B_MASK = 0x08;
-//const U8 PART_SYS_POS_RANGES_MASK = 0x10;
-//const U8 PART_SYS_VEL_RANGES_MASK = 0x20;
-const U8 PART_SYS_VEL_OFFSET_MASK = 0x10; //re-use one of the original slots now commented out
-const U8 PART_SYS_ALPHA_SCALE_DIFF_MASK = 0x20; //re-use one of the original slots now commented out
-const U8 PART_SYS_SCALE_RANGE_MASK = 0x40;
-const U8 PART_SYS_M_IMAGE_UUID_MASK = 0x80;
-const U8 PART_SYS_BYTE_3_ALPHA_MASK = 0x01; // wrapped around, didn't we?
-
-const U8 PART_SYS_BYTE_SPAWN_MASK = 0x01;
-const U8 PART_SYS_BYTE_ENVIRONMENT_MASK = 0x02;
-const U8 PART_SYS_BYTE_LIFESPAN_MASK = 0x04;
-const U8 PART_SYS_BYTE_DECAY_DAMP_MASK = 0x08;
-const U8 PART_SYS_BYTE_WIND_DIFF_MASK = 0x10;
-
-
-// 26 September 2001 - new constants for mActionFlags
-const int PART_SYS_ACTION_BYTE = 1;
-const U8 PART_SYS_SPAWN = 0x01;
-const U8 PART_SYS_BOUNCE = 0x02;
-const U8 PART_SYS_AFFECTED_BY_WIND = 0x04;
-const U8 PART_SYS_AFFECTED_BY_GRAVITY = 0x08;
-const U8 PART_SYS_EVALUATE_WIND_PER_PARTICLE = 0x10;
-const U8 PART_SYS_DAMP_MOTION = 0x20;
-const U8 PART_SYS_WIND_DIFFUSION = 0x40;
-
-// 26 September 2001 - new constants for mKillFlags
-const int PART_SYS_KILL_BYTE = 2;
-const U8 PART_SYS_KILL_PLANE = 0x01;
-const U8 PART_SYS_GLOBAL_DIE = 0x02;
-const U8 PART_SYS_DISTANCE_DEATH = 0x04;
-const U8 PART_SYS_TIME_DEATH = 0x08;
-
-
-// global, because the sim-side also calls it in the LLPartInitDataFactory
-
-
-void gSetInitDataDefaults(LLPartInitData *setMe);
-
-class LLPartSysCompressedPacket
-{
-public:
- LLPartSysCompressedPacket();
- ~LLPartSysCompressedPacket();
- bool fromLLPartInitData(LLPartInitData *in, U32 &bytesUsed);
- bool toLLPartInitData(LLPartInitData *out, U32 *bytesUsed);
- bool fromUnsignedBytes(U8 *in, U32 bytesUsed);
- bool toUnsignedBytes(U8 *out);
- U32 bufferSize();
- U8 *getBytePtr();
-
-protected:
- U8 mData[MAX_PART_SYS_PACKET_SIZE];
- U32 mNumBytes;
- LLPartInitData mDefaults; // this is intended to hold default LLPartInitData values
- // please do not modify it
- LLPartInitData mWorkingCopy; // uncompressed data I'm working with
-
-protected:
- // private functions (used only to break up code)
- void writeFlagByte(LLPartInitData *in);
- //U32 writeK(LLPartInitData *in, U32 startByte);
- U32 writeKill_p(LLPartInitData *in, U32 startByte);
- U32 writeBounce_p(LLPartInitData *in, U32 startByte);
- U32 writeBounce_b(LLPartInitData *in, U32 startByte);
- //U32 writePos_ranges(LLPartInitData *in, U32 startByte);
- //U32 writeVel_ranges(LLPartInitData *in, U32 startByte);
- U32 writeAlphaScaleDiffEqn_range(LLPartInitData *in, U32 startByte);
- U32 writeScale_range(LLPartInitData *in, U32 startByte);
- U32 writeAlpha_range(LLPartInitData *in, U32 startByte);
- U32 writeUUID(LLPartInitData *in, U32 startByte);
-
- U32 writeVelocityOffset(LLPartInitData *in, U32 startByte);
- U32 writeSpawn(LLPartInitData *in, U32 startByte); //all spawn data
- U32 writeEnvironment(LLPartInitData *in, U32 startByte); //wind and gravity
- U32 writeLifespan(LLPartInitData *in, U32 startByte); //lifespan data - individual and global
- U32 writeDecayDamp(LLPartInitData *in, U32 startByte); //alpha and scale, and motion damp
- U32 writeWindDiffusionFactor(LLPartInitData *in, U32 startByte);
-
-
- //U32 readK(LLPartInitData *in, U32 startByte);
- U32 readKill_p(LLPartInitData *in, U32 startByte);
- U32 readBounce_p(LLPartInitData *in, U32 startByte);
- U32 readBounce_b(LLPartInitData *in, U32 startByte);
- //U32 readPos_ranges(LLPartInitData *in, U32 startByte);
- //U32 readVel_ranges(LLPartInitData *in, U32 startByte);
- U32 readAlphaScaleDiffEqn_range(LLPartInitData *in, U32 startByte);
- U32 readScale_range(LLPartInitData *in, U32 startByte);
- U32 readAlpha_range(LLPartInitData *in, U32 startByte);
- U32 readUUID(LLPartInitData *in, U32 startByte);
-
- U32 readVelocityOffset(LLPartInitData *in, U32 startByte);
- U32 readSpawn(LLPartInitData *in, U32 startByte); //all spawn data
- U32 readEnvironment(LLPartInitData *in, U32 startByte); //wind and gravity
- U32 readLifespan(LLPartInitData *in, U32 startByte); //lifespan data - individual and global
- U32 readDecayDamp(LLPartInitData *in, U32 startByte); //alpha and scale, and motion damp
- U32 readWindDiffusionFactor(LLPartInitData *in, U32 startByte);
-};
-
-#endif
-