PageRenderTime 23ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llcharacter/lltargetingmotion.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 116 lines | 35 code | 24 blank | 57 comment | 0 complexity | e04eebd99cbec84c8ef11099a35918e9 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file lltargetingmotion.h
  3. * @brief Implementation of LLTargetingMotion class.
  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_LLTARGETINGMOTION_H
  27. #define LL_LLTARGETINGMOTION_H
  28. //-----------------------------------------------------------------------------
  29. // Header files
  30. //-----------------------------------------------------------------------------
  31. #include "llmotion.h"
  32. #define TARGETING_EASEIN_DURATION 0.3f
  33. #define TARGETING_EASEOUT_DURATION 0.5f
  34. #define TARGETING_PRIORITY LLJoint::HIGH_PRIORITY
  35. #define MIN_REQUIRED_PIXEL_AREA_TARGETING 1000.f;
  36. //-----------------------------------------------------------------------------
  37. // class LLTargetingMotion
  38. //-----------------------------------------------------------------------------
  39. class LLTargetingMotion :
  40. public LLMotion
  41. {
  42. public:
  43. // Constructor
  44. LLTargetingMotion(const LLUUID &id);
  45. // Destructor
  46. virtual ~LLTargetingMotion();
  47. public:
  48. //-------------------------------------------------------------------------
  49. // functions to support MotionController and MotionRegistry
  50. //-------------------------------------------------------------------------
  51. // static constructor
  52. // all subclasses must implement such a function and register it
  53. static LLMotion *create(const LLUUID &id) { return new LLTargetingMotion(id); }
  54. public:
  55. //-------------------------------------------------------------------------
  56. // animation callbacks to be implemented by subclasses
  57. //-------------------------------------------------------------------------
  58. // motions must specify whether or not they loop
  59. virtual BOOL getLoop() { return TRUE; }
  60. // motions must report their total duration
  61. virtual F32 getDuration() { return 0.0; }
  62. // motions must report their "ease in" duration
  63. virtual F32 getEaseInDuration() { return TARGETING_EASEIN_DURATION; }
  64. // motions must report their "ease out" duration.
  65. virtual F32 getEaseOutDuration() { return TARGETING_EASEOUT_DURATION; }
  66. // motions must report their priority
  67. virtual LLJoint::JointPriority getPriority() { return TARGETING_PRIORITY; }
  68. virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; }
  69. // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
  70. virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_TARGETING; }
  71. // run-time (post constructor) initialization,
  72. // called after parameters have been set
  73. // must return true to indicate success and be available for activation
  74. virtual LLMotionInitStatus onInitialize(LLCharacter *character);
  75. // called when a motion is activated
  76. // must return TRUE to indicate success, or else
  77. // it will be deactivated
  78. virtual BOOL onActivate();
  79. // called per time step
  80. // must return TRUE while it is active, and
  81. // must return FALSE when the motion is completed.
  82. virtual BOOL onUpdate(F32 time, U8* joint_mask);
  83. // called when a motion is deactivated
  84. virtual void onDeactivate();
  85. public:
  86. LLCharacter *mCharacter;
  87. LLPointer<LLJointState> mTorsoState;
  88. LLJoint* mPelvisJoint;
  89. LLJoint* mTorsoJoint;
  90. LLJoint* mRightHandJoint;
  91. };
  92. #endif // LL_LLTARGETINGMOTION_H