/indra/newview/llhudeffectlookat.h

https://bitbucket.org/lindenlab/viewer-beta/ · C Header · 95 lines · 55 code · 14 blank · 26 comment · 0 complexity · cfb0702eb18fcf43a94fb363b47848bb MD5 · raw file

  1. /**
  2. * @file llhudeffectlookat.h
  3. * @brief LLHUDEffectLookAt class definition
  4. *
  5. * $LicenseInfo:firstyear=2002&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_LLHUDEFFECTLOOKAT_H
  27. #define LL_LLHUDEFFECTLOOKAT_H
  28. #include "llhudeffect.h"
  29. class LLViewerObject;
  30. class LLVOAvatar;
  31. class LLAttentionSet;
  32. typedef enum e_lookat_type
  33. {
  34. LOOKAT_TARGET_NONE,
  35. LOOKAT_TARGET_IDLE,
  36. LOOKAT_TARGET_AUTO_LISTEN,
  37. LOOKAT_TARGET_FREELOOK,
  38. LOOKAT_TARGET_RESPOND,
  39. LOOKAT_TARGET_HOVER,
  40. LOOKAT_TARGET_CONVERSATION,
  41. LOOKAT_TARGET_SELECT,
  42. LOOKAT_TARGET_FOCUS,
  43. LOOKAT_TARGET_MOUSELOOK,
  44. LOOKAT_TARGET_CLEAR,
  45. LOOKAT_NUM_TARGETS
  46. } ELookAtType;
  47. class LLHUDEffectLookAt : public LLHUDEffect
  48. {
  49. public:
  50. friend class LLHUDObject;
  51. /*virtual*/ void markDead();
  52. /*virtual*/ void setSourceObject(LLViewerObject* objectp);
  53. BOOL setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position);
  54. void clearLookAtTarget();
  55. ELookAtType getLookAtType() { return mTargetType; }
  56. const LLVector3& getTargetPos() { return mTargetPos; }
  57. const LLVector3d& getTargetOffset() { return mTargetOffsetGlobal; }
  58. bool calcTargetPosition();
  59. protected:
  60. LLHUDEffectLookAt(const U8 type);
  61. ~LLHUDEffectLookAt();
  62. /*virtual*/ void update();
  63. /*virtual*/ void render();
  64. /*virtual*/ void packData(LLMessageSystem *mesgsys);
  65. /*virtual*/ void unpackData(LLMessageSystem *mesgsys, S32 blocknum);
  66. // lookat behavior has either target position or target object with offset
  67. void setTargetObjectAndOffset(LLViewerObject *objp, LLVector3d offset);
  68. void setTargetPosGlobal(const LLVector3d &target_pos_global);
  69. public:
  70. static BOOL sDebugLookAt;
  71. private:
  72. ELookAtType mTargetType;
  73. LLVector3d mTargetOffsetGlobal;
  74. LLVector3 mLastSentOffsetGlobal;
  75. F32 mKillTime;
  76. LLFrameTimer mTimer;
  77. LLVector3 mTargetPos;
  78. F32 mLastSendTime;
  79. LLAttentionSet* mAttentions;
  80. };
  81. #endif // LL_LLHUDEFFECTLOOKAT_H