00001
00033 #ifndef LL_PARTSYSPACKET_H
00034 #define LL_PARTSYSPACKET_H
00035
00036 #include "lluuid.h"
00037
00038
00039
00040 const U64 PART_SYS_MAX_TIME_IN_USEC = 1000000;
00041
00042
00043
00044
00045
00046 struct LLPartInitData {
00047
00048
00049
00050
00051
00052 F32 bounce_b;
00053
00054
00055
00056 F32 scale_range[4];
00057 F32 alpha_range[4];
00058 F32 vel_offset[3];
00059
00060 F32 mDistBeginFadeout;
00061 F32 mDistEndFadeout;
00062
00063 LLUUID mImageUuid;
00064
00065 U8 mFlags[8];
00066 U8 createMe;
00067
00068
00069
00070 F32 diffEqAlpha[3];
00071 F32 diffEqScale[3];
00072
00073 U8 maxParticles;
00074
00075 U8 initialParticles;
00076
00077 F32 killPlaneZ;
00078
00079 F32 killPlaneNormal[3];
00080
00081 F32 bouncePlaneZ;
00082
00083 F32 bouncePlaneNormal[3];
00084
00085 F32 spawnRange;
00086
00087 F32 spawnFrequency;
00088
00089
00090 F32 spawnFreqencyRange;
00091
00092 F32 spawnDirection[3];
00093
00094 F32 spawnDirectionRange;
00095
00096 F32 spawnVelocity;
00097
00098 F32 spawnVelocityRange;
00099
00100 F32 speedLimit;
00101
00102 F32 windWeight;
00103
00104 F32 currentGravity[3];
00105
00106 F32 gravityWeight;
00107
00108 F32 globalLifetime;
00109
00110
00111 F32 individualLifetime;
00112
00113 F32 individualLifetimeRange;
00114
00115 F32 alphaDecay;
00116
00117 F32 scaleDecay;
00118
00119 F32 distanceDeath;
00120
00121
00122
00123
00124 F32 dampMotionFactor;
00125
00126 F32 windDiffusionFactor[3];
00127
00128 };
00129
00130
00131
00132 const int PART_SYS_NO_Z_BUFFER_BYTE = 0;
00133 const int PART_SYS_NO_Z_BUFFER_BIT = 2;
00134
00135
00136 const int PART_SYS_SLOW_ANIM_BYTE = 0;
00137 const int PART_SYS_SLOW_ANIM_BIT = 1;
00138
00139 const int PART_SYS_FOLLOW_VEL_BYTE = 0;
00140 const int PART_SYS_FOLLOW_VEL_BIT = 4;
00141
00142 const int PART_SYS_IS_LIGHT_BYTE = 0;
00143 const int PART_SYS_IS_LIGHT_BIT = 8;
00144
00145
00146 const int PART_SYS_SPAWN_COPY_BYTE = 0;
00147 const int PART_SYS_SPAWN_COPY_BIT = 0x10;
00148
00149 const int PART_SYS_COPY_VEL_BYTE = 0;
00150 const int PART_SYS_COPY_VEL_BIT = 0x20;
00151
00152 const int PART_SYS_INVISIBLE_BYTE = 0;
00153 const int PART_SYS_INVISIBLE_BIT = 0x40;
00154
00155 const int PART_SYS_ADAPT_TO_FRAMERATE_BYTE = 0;
00156 const int PART_SYS_ADAPT_TO_FRAMERATE_BIT = 0x80;
00157
00158
00159
00160
00161 const U16 MAX_PART_SYS_PACKET_SIZE = 256;
00162
00163
00164 const U8 PART_SYS_KILL_P_MASK = 0x02;
00165 const U8 PART_SYS_BOUNCE_P_MASK = 0x04;
00166 const U8 PART_SYS_BOUNCE_B_MASK = 0x08;
00167
00168
00169 const U8 PART_SYS_VEL_OFFSET_MASK = 0x10;
00170 const U8 PART_SYS_ALPHA_SCALE_DIFF_MASK = 0x20;
00171 const U8 PART_SYS_SCALE_RANGE_MASK = 0x40;
00172 const U8 PART_SYS_M_IMAGE_UUID_MASK = 0x80;
00173 const U8 PART_SYS_BYTE_3_ALPHA_MASK = 0x01;
00174
00175 const U8 PART_SYS_BYTE_SPAWN_MASK = 0x01;
00176 const U8 PART_SYS_BYTE_ENVIRONMENT_MASK = 0x02;
00177 const U8 PART_SYS_BYTE_LIFESPAN_MASK = 0x04;
00178 const U8 PART_SYS_BYTE_DECAY_DAMP_MASK = 0x08;
00179 const U8 PART_SYS_BYTE_WIND_DIFF_MASK = 0x10;
00180
00181
00182
00183 const int PART_SYS_ACTION_BYTE = 1;
00184 const U8 PART_SYS_SPAWN = 0x01;
00185 const U8 PART_SYS_BOUNCE = 0x02;
00186 const U8 PART_SYS_AFFECTED_BY_WIND = 0x04;
00187 const U8 PART_SYS_AFFECTED_BY_GRAVITY = 0x08;
00188 const U8 PART_SYS_EVALUATE_WIND_PER_PARTICLE = 0x10;
00189 const U8 PART_SYS_DAMP_MOTION = 0x20;
00190 const U8 PART_SYS_WIND_DIFFUSION = 0x40;
00191
00192
00193 const int PART_SYS_KILL_BYTE = 2;
00194 const U8 PART_SYS_KILL_PLANE = 0x01;
00195 const U8 PART_SYS_GLOBAL_DIE = 0x02;
00196 const U8 PART_SYS_DISTANCE_DEATH = 0x04;
00197 const U8 PART_SYS_TIME_DEATH = 0x08;
00198
00199
00200
00201
00202
00203 void gSetInitDataDefaults(LLPartInitData *setMe);
00204
00205 class LLPartSysCompressedPacket
00206 {
00207 public:
00208 LLPartSysCompressedPacket();
00209 ~LLPartSysCompressedPacket();
00210 BOOL fromLLPartInitData(LLPartInitData *in, U32 &bytesUsed);
00211 BOOL toLLPartInitData(LLPartInitData *out, U32 *bytesUsed);
00212 BOOL fromUnsignedBytes(U8 *in, U32 bytesUsed);
00213 BOOL toUnsignedBytes(U8 *out);
00214 U32 bufferSize();
00215 U8 *getBytePtr();
00216
00217 protected:
00218 U8 mData[MAX_PART_SYS_PACKET_SIZE];
00219 U32 mNumBytes;
00220 LLPartInitData mDefaults;
00221
00222 LLPartInitData mWorkingCopy;
00223
00224 protected:
00225
00226 void writeFlagByte(LLPartInitData *in);
00227
00228 U32 writeKill_p(LLPartInitData *in, U32 startByte);
00229 U32 writeBounce_p(LLPartInitData *in, U32 startByte);
00230 U32 writeBounce_b(LLPartInitData *in, U32 startByte);
00231
00232
00233 U32 writeAlphaScaleDiffEqn_range(LLPartInitData *in, U32 startByte);
00234 U32 writeScale_range(LLPartInitData *in, U32 startByte);
00235 U32 writeAlpha_range(LLPartInitData *in, U32 startByte);
00236 U32 writeUUID(LLPartInitData *in, U32 startByte);
00237
00238 U32 writeVelocityOffset(LLPartInitData *in, U32 startByte);
00239 U32 writeSpawn(LLPartInitData *in, U32 startByte);
00240 U32 writeEnvironment(LLPartInitData *in, U32 startByte);
00241 U32 writeLifespan(LLPartInitData *in, U32 startByte);
00242 U32 writeDecayDamp(LLPartInitData *in, U32 startByte);
00243 U32 writeWindDiffusionFactor(LLPartInitData *in, U32 startByte);
00244
00245
00246
00247 U32 readKill_p(LLPartInitData *in, U32 startByte);
00248 U32 readBounce_p(LLPartInitData *in, U32 startByte);
00249 U32 readBounce_b(LLPartInitData *in, U32 startByte);
00250
00251
00252 U32 readAlphaScaleDiffEqn_range(LLPartInitData *in, U32 startByte);
00253 U32 readScale_range(LLPartInitData *in, U32 startByte);
00254 U32 readAlpha_range(LLPartInitData *in, U32 startByte);
00255 U32 readUUID(LLPartInitData *in, U32 startByte);
00256
00257 U32 readVelocityOffset(LLPartInitData *in, U32 startByte);
00258 U32 readSpawn(LLPartInitData *in, U32 startByte);
00259 U32 readEnvironment(LLPartInitData *in, U32 startByte);
00260 U32 readLifespan(LLPartInitData *in, U32 startByte);
00261 U32 readDecayDamp(LLPartInitData *in, U32 startByte);
00262 U32 readWindDiffusionFactor(LLPartInitData *in, U32 startByte);
00263 };
00264
00265 #endif
00266