llhudeffectpointat.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /**
  2. * @file llhudeffectpointat.h
  3. * @brief LLHUDEffectPointAt 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_LLHUDEFFECTPOINTAT_H
  33. #define LL_LLHUDEFFECTPOINTAT_H
  34. #include "llhudeffect.h"
  35. class LLViewerObject;
  36. class LLVOAvatar;
  37. typedef enum e_pointat_type
  38. {
  39. POINTAT_TARGET_NONE,
  40. POINTAT_TARGET_SELECT,
  41. POINTAT_TARGET_GRAB,
  42. POINTAT_TARGET_CLEAR,
  43. POINTAT_NUM_TARGETS
  44. } EPointAtType;
  45. class LLHUDEffectPointAt : public LLHUDEffect
  46. {
  47. protected:
  48. LOG_CLASS(LLHUDEffectPointAt);
  49. public:
  50. friend class LLHUDObject;
  51. void markDead() override;
  52. void setSourceObject(LLViewerObject* objectp) override;
  53. bool setPointAt(EPointAtType target_type, LLViewerObject* object,
  54. LLVector3 position);
  55. void clearPointAtTarget();
  56. LL_INLINE EPointAtType getPointAtType() { return mTargetType; }
  57. LL_INLINE const LLVector3& getPointAtPosAgent() { return mTargetPos; }
  58. const LLVector3d getPointAtPosGlobal();
  59. protected:
  60. LLHUDEffectPointAt(U8 type);
  61. ~LLHUDEffectPointAt() override = default;
  62. void render() override;
  63. void packData(LLMessageSystem* mesgsys) override;
  64. void unpackData(LLMessageSystem* mesgsys, S32 blocknum) override;
  65. // Point-at behavior has either target position or target object with
  66. // offset
  67. void setTargetObjectAndOffset(LLViewerObject* objp,
  68. const LLVector3d& offset);
  69. void setTargetPosGlobal(const LLVector3d& target_pos_global);
  70. bool calcTargetPosition();
  71. void update() override;
  72. public:
  73. static bool sDebugPointAt;
  74. private:
  75. LLVector3d mTargetOffsetGlobal;
  76. LLVector3 mLastSentOffsetGlobal;
  77. LLVector3 mTargetPos;
  78. LLFrameTimer mTimer;
  79. EPointAtType mTargetType;
  80. F32 mKillTime;
  81. F32 mLastSendTime;
  82. };
  83. #endif // LL_LLHUDEFFECTPOINTAT_H