llhudobject.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /**
  2. * @file llhudobject.h
  3. * @brief LLHUDObject class definition
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewergpl$
  6. *
  7. * Copyright (c) 2002-2009, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_LLHUDOBJECT_H
  33. #define LL_LLHUDOBJECT_H
  34. /**
  35. * Base class and manager for in-world 2.5D non-interactive objects
  36. */
  37. #include <list>
  38. #include "llpointer.h"
  39. #include "llrefcount.h"
  40. #include "llvector3.h"
  41. #include "llvector3d.h"
  42. #include "llcolor4.h"
  43. class LLHUDEffect;
  44. class LLViewerObject;
  45. class LLHUDObject : public LLRefCount
  46. {
  47. protected:
  48. LOG_CLASS(LLHUDObject);
  49. public:
  50. virtual void markDead();
  51. LL_INLINE virtual bool isDead() const { return mDead; }
  52. LL_INLINE virtual F32 getDistance() const { return 0.f; }
  53. virtual void setSourceObject(LLViewerObject* objectp);
  54. virtual void setTargetObject(LLViewerObject* objectp);
  55. LL_INLINE virtual LLViewerObject* getSourceObject()
  56. {
  57. return mSourceObject;
  58. }
  59. LL_INLINE virtual LLViewerObject* getTargetObject() { return mTargetObject; }
  60. void setPositionGlobal(const LLVector3d& position_global);
  61. void setPositionAgent(const LLVector3& position_agent);
  62. LL_INLINE bool isVisible() const { return mVisible; }
  63. LL_INLINE U8 getType() const { return mType; }
  64. LL_INLINE LLVector3d getPositionGlobal() const { return mPositionGlobal; }
  65. static LLHUDObject* addHUDObject(U8 type);
  66. static LLHUDEffect* addHUDEffect(U8 type);
  67. static void updateAll();
  68. static void renderAll();
  69. static void removeExpired();
  70. static void cleanupHUDObjects();
  71. enum
  72. {
  73. LL_HUD_TEXT,
  74. LL_HUD_ICON,
  75. LL_HUD_CONNECTOR,
  76. LL_HUD_FLEXIBLE_OBJECT,
  77. LL_HUD_ANIMAL_CONTROLS,
  78. LL_HUD_LOCAL_ANIMATION_OBJECT,
  79. LL_HUD_CLOTH,
  80. LL_HUD_EFFECT_BEAM,
  81. LL_HUD_EFFECT_GLOW,
  82. LL_HUD_EFFECT_POINT,
  83. LL_HUD_EFFECT_TRAIL,
  84. LL_HUD_EFFECT_SPHERE,
  85. LL_HUD_EFFECT_SPIRAL,
  86. LL_HUD_EFFECT_EDIT,
  87. LL_HUD_EFFECT_LOOKAT,
  88. LL_HUD_EFFECT_POINTAT,
  89. LL_HUD_EFFECT_VOICE_VISUALIZER
  90. };
  91. protected:
  92. static void sortObjects();
  93. LLHUDObject(U8 type);
  94. // Do not declare = default here: because of includes circular dependencies
  95. // this would cause compilation failures. HB
  96. // *TODO: solve the circular dependency issue.
  97. ~LLHUDObject() override;
  98. virtual void render() = 0;
  99. static void renderObjects();
  100. protected:
  101. LLVector3d mPositionGlobal;
  102. LLPointer<LLViewerObject> mSourceObject;
  103. LLPointer<LLViewerObject> mTargetObject;
  104. U8 mType;
  105. bool mDead;
  106. bool mVisible;
  107. bool mOnHUDAttachment;
  108. private:
  109. typedef std::list<LLPointer<LLHUDObject> > hud_object_list_t;
  110. static hud_object_list_t sHUDObjects;
  111. };
  112. #endif // LL_LLHUDOBJECT_H