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 
00077         LLVector3       mPosAgent; // Location of the particle source
00078         LLVector3       mTargetPosAgent; // Location of the target position
00079         LLVector3       mLastUpdatePosAgent;
00080         LLPointer<LLViewerObject>       mSourceObjectp;
00081         U32 mID;
00082 
00083 protected:
00084         U32                     mType;
00085         BOOL            mIsDead;
00086         BOOL            mIsSuspended;
00087         F32                     mLastUpdateTime;
00088         F32                     mLastPartTime;
00089         LLUUID          mOwnerUUID;
00090         LLPointer<LLViewerImage>        mImagep;
00091 
00092         // Particle information
00093         U32                     mPartFlags; // Flags for the particle
00094 };
00095 
00096 
00097 
00099 //
00100 // LLViewerPartSourceScript
00101 //
00102 // Particle source that handles the "generic" script-drive particle source
00103 // attached to objects
00104 //
00105 
00106 
00107 class LLViewerPartSourceScript : public LLViewerPartSource
00108 {
00109 public:
00110         LLViewerPartSourceScript(LLViewerObject *source_objp);
00111         /*virtual*/ void update(const F32 dt);
00112 
00113         /*virtual*/ void setDead();
00114 
00115         BOOL updateFromMesg();
00116 
00117         // Returns a new particle source to attach to an object...
00118         static LLPointer<LLViewerPartSourceScript> unpackPSS(LLViewerObject *source_objp, LLPointer<LLViewerPartSourceScript> pssp, const S32 block_num);
00119         static LLPointer<LLViewerPartSourceScript> unpackPSS(LLViewerObject *source_objp, LLPointer<LLViewerPartSourceScript> pssp, LLDataPacker &dp);
00120 
00121         LLViewerImage *getImage() const                         { return mImagep; }
00122         void setImage(LLViewerImage *imagep);
00123         LLPartSysData                           mPartSysData;
00124 
00125         void setTargetObject(LLViewerObject *objp);
00126 
00127 protected:
00128         LLQuaternion                            mRotation;                      // Current rotation for particle source
00129         LLPointer<LLViewerObject>       mTargetObjectp;         // Target object for the particle source
00130 };
00131 
00132 
00134 //
00135 // Particle source for spiral effect (customize avatar, mostly)
00136 //
00137 
00138 class LLViewerPartSourceSpiral : public LLViewerPartSource
00139 {
00140 public:
00141         LLViewerPartSourceSpiral(const LLVector3 &pos);
00142 
00143         /*virtual*/ void setDead();
00144 
00145         /*virtual*/ void update(const F32 dt);
00146 
00147         void setSourceObject(LLViewerObject *objp);
00148         void setColor(const LLColor4 &color);
00149 
00150         static void updatePart(LLViewerPart &part, const F32 dt);
00151         LLColor4 mColor;
00152 protected:
00153         LLVector3d mLKGSourcePosGlobal;
00154 };
00155 
00156 
00158 //
00159 // Particle source for tractor(editing) beam
00160 //
00161 
00162 class LLViewerPartSourceBeam : public LLViewerPartSource
00163 {
00164 public:
00165         LLViewerPartSourceBeam();
00166 
00167         /*virtual*/ void setDead();
00168 
00169         /*virtual*/ void update(const F32 dt);
00170 
00171         void setSourceObject(LLViewerObject *objp);
00172         void setTargetObject(LLViewerObject *objp);
00173         void setSourcePosGlobal(const LLVector3d &pos_global);
00174         void setTargetPosGlobal(const LLVector3d &pos_global);
00175         void setColor(const LLColor4 &color);
00176 
00177         static void updatePart(LLViewerPart &part, const F32 dt);
00178         LLPointer<LLViewerObject>       mTargetObjectp;
00179         LLVector3d              mLKGTargetPosGlobal;
00180         LLColor4 mColor;
00181 protected:
00182         ~LLViewerPartSourceBeam();
00183 };
00184 
00185 
00186 
00188 //
00189 // Particle source for chat effect
00190 //
00191 
00192 class LLViewerPartSourceChat : public LLViewerPartSource
00193 {
00194 public:
00195         LLViewerPartSourceChat(const LLVector3 &pos);
00196 
00197         /*virtual*/ void setDead();
00198 
00199         /*virtual*/ void update(const F32 dt);
00200 
00201         void setSourceObject(LLViewerObject *objp);
00202         void setColor(const LLColor4 &color);
00203         static void updatePart(LLViewerPart &part, const F32 dt);
00204         LLColor4 mColor;
00205 protected:
00206         LLVector3d mLKGSourcePosGlobal;
00207 };
00208 
00209 
00210 #endif // LL_LLVIEWERPARTSOURCE_H

Generated on Thu Jul 1 06:09:33 2010 for Second Life Viewer by  doxygen 1.4.7