00001
00032 #ifndef LL_LLPARTDATA_H
00033 #define LL_LLPARTDATA_H
00034
00035 #include "lluuid.h"
00036 #include "v3math.h"
00037 #include "v3dmath.h"
00038 #include "v2math.h"
00039 #include "v4color.h"
00040
00041 class LLMessageSystem;
00042 class LLDataPacker;
00043
00044 const S32 PS_CUR_VERSION = 18;
00045
00046
00047
00048
00049
00050 enum LLPSScriptFlags
00051 {
00052
00053 LLPS_PART_FLAGS,
00054 LLPS_PART_START_COLOR,
00055 LLPS_PART_START_ALPHA,
00056 LLPS_PART_END_COLOR,
00057 LLPS_PART_END_ALPHA,
00058 LLPS_PART_START_SCALE,
00059 LLPS_PART_END_SCALE,
00060 LLPS_PART_MAX_AGE,
00061
00062
00063 LLPS_SRC_ACCEL,
00064 LLPS_SRC_PATTERN,
00065 LLPS_SRC_INNERANGLE,
00066 LLPS_SRC_OUTERANGLE,
00067 LLPS_SRC_TEXTURE,
00068 LLPS_SRC_BURST_RATE,
00069 LLPS_SRC_BURST_DURATION,
00070 LLPS_SRC_BURST_PART_COUNT,
00071 LLPS_SRC_BURST_RADIUS,
00072 LLPS_SRC_BURST_SPEED_MIN,
00073 LLPS_SRC_BURST_SPEED_MAX,
00074 LLPS_SRC_MAX_AGE,
00075 LLPS_SRC_TARGET_UUID,
00076 LLPS_SRC_OMEGA,
00077 LLPS_SRC_ANGLE_BEGIN,
00078 LLPS_SRC_ANGLE_END
00079 };
00080
00081
00082 class LLPartData
00083 {
00084 public:
00085 LLPartData() :
00086 mFlags(0),
00087 mMaxAge(0)
00088 {
00089 }
00090 BOOL unpack(LLDataPacker &dp);
00091 BOOL pack(LLDataPacker &dp);
00092 LLSD asLLSD() const;
00093 operator LLSD() const {return asLLSD(); }
00094 bool fromLLSD(LLSD& sd);
00095
00096
00097 enum
00098 {
00099 LL_PART_INTERP_COLOR_MASK = 0x01,
00100 LL_PART_INTERP_SCALE_MASK = 0x02,
00101 LL_PART_BOUNCE_MASK = 0x04,
00102 LL_PART_WIND_MASK = 0x08,
00103 LL_PART_FOLLOW_SRC_MASK = 0x10,
00104 LL_PART_FOLLOW_VELOCITY_MASK = 0x20,
00105 LL_PART_TARGET_POS_MASK = 0x40,
00106 LL_PART_TARGET_LINEAR_MASK = 0x80,
00107 LL_PART_EMISSIVE_MASK = 0x100,
00108 LL_PART_BEAM_MASK = 0x200,
00109
00110
00111
00112
00113
00114
00115
00116 LL_PART_DEAD_MASK = 0x80000000,
00117 };
00118
00119 void setFlags(const U32 flags);
00120 void setMaxAge(const F32 max_age);
00121 void setStartScale(const F32 xs, F32 ys);
00122 void setEndScale(const F32 xs, F32 ys);
00123 void setStartColor(const LLVector3 &rgb);
00124 void setEndColor(const LLVector3 &rgb);
00125 void setStartAlpha(const F32 alpha);
00126 void setEndAlpha(const F32 alpha);
00127
00128
00129 friend class LLPartSysData;
00130 friend class LLViewerPartSourceScript;
00131
00132
00133 public:
00134 U32 mFlags;
00135 F32 mMaxAge;
00136 LLColor4 mStartColor;
00137 LLColor4 mEndColor;
00138 LLVector2 mStartScale;
00139 LLVector2 mEndScale;
00140
00141 LLVector3 mPosOffset;
00142 F32 mParameter;
00143 };
00144
00145
00146 class LLPartSysData
00147 {
00148 public:
00149 LLPartSysData();
00150
00151 BOOL unpack(LLDataPacker &dp);
00152 BOOL pack(LLDataPacker &dp);
00153
00154
00155 BOOL unpackBlock(const S32 block_num);
00156 BOOL packBlock();
00157
00158 static BOOL packNull();
00159 static BOOL isNullPS(const S32 block_num);
00160
00161
00162 enum
00163 {
00164 LL_PART_SRC_OBJ_REL_MASK = 0x01,
00165 LL_PART_USE_NEW_ANGLE = 0x02,
00166 };
00167
00168
00169 enum
00170 {
00171 LL_PART_SRC_PATTERN_DROP = 0x01,
00172 LL_PART_SRC_PATTERN_EXPLODE = 0x02,
00173
00174 LL_PART_SRC_PATTERN_ANGLE = 0x04,
00175 LL_PART_SRC_PATTERN_ANGLE_CONE = 0x08,
00176 LL_PART_SRC_PATTERN_ANGLE_CONE_EMPTY = 0x10,
00177 };
00178
00179
00180 void setBurstSpeedMin(const F32 spd) { mBurstSpeedMin = llclamp(spd, -100.f, 100.f); }
00181 void setBurstSpeedMax(const F32 spd) { mBurstSpeedMax = llclamp(spd, -100.f, 100.f); }
00182 void setBurstRadius(const F32 rad) { mBurstRadius = llclamp(rad, 0.f, 50.f); }
00183 void setPartAccel(const LLVector3 &accel);
00184 void setUseNewAngle() { mFlags |= LL_PART_USE_NEW_ANGLE; }
00185 void unsetUseNewAngle() { mFlags &= ~LL_PART_USE_NEW_ANGLE; }
00186
00187
00188
00189
00190 void clampSourceParticleRate();
00191
00192 friend std::ostream& operator<<(std::ostream& s, const LLPartSysData &data);
00193
00194 public:
00195
00196
00197
00198
00199
00200
00201
00202
00203 U32 mCRC;
00204 U32 mFlags;
00205
00206 U8 mPattern;
00207 F32 mInnerAngle;
00208 F32 mOuterAngle;
00209 LLVector3 mAngularVelocity;
00210
00211 F32 mBurstRate;
00212 U8 mBurstPartCount;
00213 F32 mBurstRadius;
00214 F32 mBurstSpeedMin;
00215 F32 mBurstSpeedMax;
00216
00217 F32 mMaxAge;
00218
00219 LLUUID mTargetUUID;
00220
00221 F32 mStartAge;
00222
00223
00224
00225
00226
00227
00228
00229 LLVector3 mPartAccel;
00230 LLUUID mPartImageID;
00231
00232
00233
00234
00235 LLPartData mPartData;
00236
00237 protected:
00238 S32 mNumParticles;
00239 };
00240
00241 #endif // LL_LLPARTDATA_H