llviewerpartsource.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLVIEWERPARTSOURCE_H
00033 #define LL_LLVIEWERPARTSOURCE_H
00034 
00035 #include "llmemory.h"
00036 #include "llpartdata.h"
00037 #include "llquaternion.h"
00038 #include "v3math.h"
00039 
00041 //
00042 // A particle source - subclassed to generate particles with different behaviors
00043 //
00044 //
00045 
00046 class LLViewerImage;
00047 class LLViewerObject;
00048 class LLViewerPart;
00049 
00050 class LLViewerPartSource : public LLRefCount
00051 {
00052 public:
00053         enum
00054         {
00055                 LL_PART_SOURCE_NULL,
00056                 LL_PART_SOURCE_SCRIPT,
00057                 LL_PART_SOURCE_SPIRAL,
00058                 LL_PART_SOURCE_BEAM,
00059                 LL_PART_SOURCE_CHAT
00060         };
00061 
00062         LLViewerPartSource(const U32 type);
00063 
00064         virtual void update(const F32 dt); // Return FALSE if this source is dead...
00065 
00066         virtual void setDead();
00067         BOOL isDead() const                             { return mIsDead; }
00068         void setSuspended( BOOL state ) { mIsSuspended = state; }
00069         BOOL isSuspended() const                { return mIsSuspended; }
00070         U32 getType() const                             { return mType; }
00071         static void updatePart(LLViewerPart &part, const F32 dt);
00072         void setOwnerUUID(const LLUUID& owner_id) { mOwnerUUID = owner_id; }
00073         LLUUID getOwnerUUID() const { return mOwnerUUID; }
00074         U32     getID() const { return mID; }
00075         LLUUID getImageUUID() const;
00076         void  setStart() ;
00077 
00078         LLVector3       mPosAgent; // Location of the particle source
00079         LLVector3       mTargetPosAgent; // Location of the target position
00080         LLVector3       mLastUpdatePosAgent;
00081         LLPointer<LLViewerObject>       mSourceObjectp;
00082         U32 mID;
00083 
00084 protected:
00085         U32                     mType;
00086         BOOL            mIsDead;
00087         BOOL            mIsSuspended;
00088         F32                     mLastUpdateTime;
00089         F32                     mLastPartTime;
00090         LLUUID          mOwnerUUID;
00091         LLPointer<LLViewerImage>        mImagep;
00092 
00093         // Particle information
00094         U32                     mPartFlags; // Flags for the particle
00095         U32         mDelay ; //delay to start particles
00096 };
00097 
00098 
00099 
00101 //
00102 // LLViewerPartSourceScript
00103 //
00104 // Particle source that handles the "generic" script-drive particle source
00105 // attached to objects
00106 //
00107 
00108 
00109 class LLViewerPartSourceScript : public LLViewerPartSource
00110 {
00111 public:
00112         LLViewerPartSourceScript(LLViewerObject *source_objp);
00113         /*virtual*/ void update(const F32 dt);
00114 
00115         /*virtual*/ void setDead();
00116 
00117         BOOL updateFromMesg();
00118 
00119         // Returns a new particle source to attach to an object...
00120         static LLPointer<LLViewerPartSourceScript> unpackPSS(LLViewerObject *source_objp, LLPointer<LLViewerPartSourceScript> pssp, const S32 block_num);
00121         static LLPointer<LLViewerPartSourceScript> unpackPSS(LLViewerObject *source_objp, LLPointer<LLViewerPartSourceScript> pssp, LLDataPacker &dp);
00122         static LLPointer<LLViewerPartSourceScript> createPSS(LLViewerObject *source_objp, const LLPartSysData& particle_parameters);
00123 
00124         LLViewerImage *getImage() const                         { return mImagep; }
00125         void setImage(LLViewerImage *imagep);
00126         LLPartSysData                           mPartSysData;
00127 
00128         void setTargetObject(LLViewerObject *objp);
00129 
00130 protected:
00131         LLQuaternion                            mRotation;                      // Current rotation for particle source
00132         LLPointer<LLViewerObject>       mTargetObjectp;         // Target object for the particle source
00133 };
00134 
00135 
00137 //
00138 // Particle source for spiral effect (customize avatar, mostly)
00139 //
00140 
00141 class LLViewerPartSourceSpiral : public LLViewerPartSource
00142 {
00143 public:
00144         LLViewerPartSourceSpiral(const LLVector3 &pos);
00145 
00146         /*virtual*/ void setDead();
00147 
00148         /*virtual*/ void update(const F32 dt);
00149 
00150         void setSourceObject(LLViewerObject *objp);
00151         void setColor(const LLColor4 &color);
00152 
00153         static void updatePart(LLViewerPart &part, const F32 dt);
00154         LLColor4 mColor;
00155 protected:
00156         LLVector3d mLKGSourcePosGlobal;
00157 };
00158 
00159 
00161 //
00162 // Particle source for tractor(editing) beam
00163 //
00164 
00165 class LLViewerPartSourceBeam : public LLViewerPartSource
00166 {
00167 public:
00168         LLViewerPartSourceBeam();
00169 
00170         /*virtual*/ void setDead();
00171 
00172         /*virtual*/ void update(const F32 dt);
00173 
00174         void setSourceObject(LLViewerObject *objp);
00175         void setTargetObject(LLViewerObject *objp);
00176         void setSourcePosGlobal(const LLVector3d &pos_global);
00177         void setTargetPosGlobal(const LLVector3d &pos_global);
00178         void setColor(const LLColor4 &color);
00179 
00180         static void updatePart(LLViewerPart &part, const F32 dt);
00181         LLPointer<LLViewerObject>       mTargetObjectp;
00182         LLVector3d              mLKGTargetPosGlobal;
00183         LLColor4 mColor;
00184 protected:
00185         ~LLViewerPartSourceBeam();
00186 };
00187 
00188 
00189 
00191 //
00192 // Particle source for chat effect
00193 //
00194 
00195 class LLViewerPartSourceChat : public LLViewerPartSource
00196 {
00197 public:
00198         LLViewerPartSourceChat(const LLVector3 &pos);
00199 
00200         /*virtual*/ void setDead();
00201 
00202         /*virtual*/ void update(const F32 dt);
00203 
00204         void setSourceObject(LLViewerObject *objp);
00205         void setColor(const LLColor4 &color);
00206         static void updatePart(LLViewerPart &part, const F32 dt);
00207         LLColor4 mColor;
00208 protected:
00209         LLVector3d mLKGSourcePosGlobal;
00210 };
00211 
00212 
00213 #endif // LL_LLVIEWERPARTSOURCE_H

Generated on Fri May 16 08:34:16 2008 for SecondLife by  doxygen 1.5.5