PageRenderTime 40ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llviewerpartsource.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 209 lines | 113 code | 45 blank | 51 comment | 0 complexity | dace185e46f554f38a7a72b5b130650f MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llviewerpartsource.h
  3. * @brief LLViewerPartSource class header file
  4. *
  5. * $LicenseInfo:firstyear=2003&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLVIEWERPARTSOURCE_H
  27. #define LL_LLVIEWERPARTSOURCE_H
  28. #include "llrefcount.h"
  29. #include "llpartdata.h"
  30. #include "llpointer.h"
  31. #include "llquaternion.h"
  32. #include "v3math.h"
  33. ////////////////////
  34. //
  35. // A particle source - subclassed to generate particles with different behaviors
  36. //
  37. //
  38. class LLViewerTexture;
  39. class LLViewerObject;
  40. class LLViewerPart;
  41. class LLViewerPartSource : public LLRefCount
  42. {
  43. public:
  44. enum
  45. {
  46. LL_PART_SOURCE_NULL,
  47. LL_PART_SOURCE_SCRIPT,
  48. LL_PART_SOURCE_SPIRAL,
  49. LL_PART_SOURCE_BEAM,
  50. LL_PART_SOURCE_CHAT
  51. };
  52. LLViewerPartSource(const U32 type);
  53. virtual void update(const F32 dt); // Return FALSE if this source is dead...
  54. virtual void setDead();
  55. BOOL isDead() const { return mIsDead; }
  56. void setSuspended( BOOL state ) { mIsSuspended = state; }
  57. BOOL isSuspended() const { return mIsSuspended; }
  58. U32 getType() const { return mType; }
  59. static void updatePart(LLViewerPart &part, const F32 dt);
  60. void setOwnerUUID(const LLUUID& owner_id) { mOwnerUUID = owner_id; }
  61. LLUUID getOwnerUUID() const { return mOwnerUUID; }
  62. U32 getID() const { return mID; }
  63. LLUUID getImageUUID() const;
  64. void setStart() ;
  65. LLVector3 mPosAgent; // Location of the particle source
  66. LLVector3 mTargetPosAgent; // Location of the target position
  67. LLVector3 mLastUpdatePosAgent;
  68. LLPointer<LLViewerObject> mSourceObjectp;
  69. U32 mID;
  70. protected:
  71. U32 mType;
  72. BOOL mIsDead;
  73. BOOL mIsSuspended;
  74. F32 mLastUpdateTime;
  75. F32 mLastPartTime;
  76. LLUUID mOwnerUUID;
  77. LLPointer<LLViewerTexture> mImagep;
  78. // Particle information
  79. U32 mPartFlags; // Flags for the particle
  80. U32 mDelay ; //delay to start particles
  81. };
  82. ///////////////////////////////
  83. //
  84. // LLViewerPartSourceScript
  85. //
  86. // Particle source that handles the "generic" script-drive particle source
  87. // attached to objects
  88. //
  89. class LLViewerPartSourceScript : public LLViewerPartSource
  90. {
  91. public:
  92. LLViewerPartSourceScript(LLViewerObject *source_objp);
  93. /*virtual*/ void update(const F32 dt);
  94. /*virtual*/ void setDead();
  95. BOOL updateFromMesg();
  96. // Returns a new particle source to attach to an object...
  97. static LLPointer<LLViewerPartSourceScript> unpackPSS(LLViewerObject *source_objp, LLPointer<LLViewerPartSourceScript> pssp, const S32 block_num);
  98. static LLPointer<LLViewerPartSourceScript> unpackPSS(LLViewerObject *source_objp, LLPointer<LLViewerPartSourceScript> pssp, LLDataPacker &dp);
  99. static LLPointer<LLViewerPartSourceScript> createPSS(LLViewerObject *source_objp, const LLPartSysData& particle_parameters);
  100. LLViewerTexture *getImage() const { return mImagep; }
  101. void setImage(LLViewerTexture *imagep);
  102. LLPartSysData mPartSysData;
  103. void setTargetObject(LLViewerObject *objp);
  104. protected:
  105. LLQuaternion mRotation; // Current rotation for particle source
  106. LLPointer<LLViewerObject> mTargetObjectp; // Target object for the particle source
  107. };
  108. ////////////////////////////
  109. //
  110. // Particle source for spiral effect (customize avatar, mostly)
  111. //
  112. class LLViewerPartSourceSpiral : public LLViewerPartSource
  113. {
  114. public:
  115. LLViewerPartSourceSpiral(const LLVector3 &pos);
  116. /*virtual*/ void setDead();
  117. /*virtual*/ void update(const F32 dt);
  118. void setSourceObject(LLViewerObject *objp);
  119. void setColor(const LLColor4 &color);
  120. static void updatePart(LLViewerPart &part, const F32 dt);
  121. LLColor4 mColor;
  122. protected:
  123. LLVector3d mLKGSourcePosGlobal;
  124. };
  125. ////////////////////////////
  126. //
  127. // Particle source for tractor(editing) beam
  128. //
  129. class LLViewerPartSourceBeam : public LLViewerPartSource
  130. {
  131. public:
  132. LLViewerPartSourceBeam();
  133. /*virtual*/ void setDead();
  134. /*virtual*/ void update(const F32 dt);
  135. void setSourceObject(LLViewerObject *objp);
  136. void setTargetObject(LLViewerObject *objp);
  137. void setSourcePosGlobal(const LLVector3d &pos_global);
  138. void setTargetPosGlobal(const LLVector3d &pos_global);
  139. void setColor(const LLColor4 &color);
  140. static void updatePart(LLViewerPart &part, const F32 dt);
  141. LLPointer<LLViewerObject> mTargetObjectp;
  142. LLVector3d mLKGTargetPosGlobal;
  143. LLColor4 mColor;
  144. protected:
  145. ~LLViewerPartSourceBeam();
  146. };
  147. //////////////////////////
  148. //
  149. // Particle source for chat effect
  150. //
  151. class LLViewerPartSourceChat : public LLViewerPartSource
  152. {
  153. public:
  154. LLViewerPartSourceChat(const LLVector3 &pos);
  155. /*virtual*/ void setDead();
  156. /*virtual*/ void update(const F32 dt);
  157. void setSourceObject(LLViewerObject *objp);
  158. void setColor(const LLColor4 &color);
  159. static void updatePart(LLViewerPart &part, const F32 dt);
  160. LLColor4 mColor;
  161. protected:
  162. LLVector3d mLKGSourcePosGlobal;
  163. };
  164. #endif // LL_LLVIEWERPARTSOURCE_H