PageRenderTime 37ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llcharacter/llhandmotion.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 139 lines | 53 code | 26 blank | 60 comment | 0 complexity | b61a4b07675237f3c5512af39c92b2c8 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llhandmotion.h
  3. * @brief Implementation of LLHandMotion class.
  4. *
  5. * $LicenseInfo:firstyear=2001&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_LLHANDMOTION_H
  27. #define LL_LLHANDMOTION_H
  28. //-----------------------------------------------------------------------------
  29. // Header files
  30. //-----------------------------------------------------------------------------
  31. #include "llmotion.h"
  32. #include "lltimer.h"
  33. #define MIN_REQUIRED_PIXEL_AREA_HAND 10000.f;
  34. //-----------------------------------------------------------------------------
  35. // class LLHandMotion
  36. //-----------------------------------------------------------------------------
  37. class LLHandMotion :
  38. public LLMotion
  39. {
  40. public:
  41. typedef enum e_hand_pose
  42. {
  43. HAND_POSE_SPREAD,
  44. HAND_POSE_RELAXED,
  45. HAND_POSE_POINT,
  46. HAND_POSE_FIST,
  47. HAND_POSE_RELAXED_L,
  48. HAND_POSE_POINT_L,
  49. HAND_POSE_FIST_L,
  50. HAND_POSE_RELAXED_R,
  51. HAND_POSE_POINT_R,
  52. HAND_POSE_FIST_R,
  53. HAND_POSE_SALUTE_R,
  54. HAND_POSE_TYPING,
  55. HAND_POSE_PEACE_R,
  56. HAND_POSE_PALM_R,
  57. NUM_HAND_POSES
  58. } eHandPose;
  59. // Constructor
  60. LLHandMotion(const LLUUID &id);
  61. // Destructor
  62. virtual ~LLHandMotion();
  63. public:
  64. //-------------------------------------------------------------------------
  65. // functions to support MotionController and MotionRegistry
  66. //-------------------------------------------------------------------------
  67. // static constructor
  68. // all subclasses must implement such a function and register it
  69. static LLMotion *create(const LLUUID &id) { return new LLHandMotion(id); }
  70. public:
  71. //-------------------------------------------------------------------------
  72. // animation callbacks to be implemented by subclasses
  73. //-------------------------------------------------------------------------
  74. // motions must specify whether or not they loop
  75. virtual BOOL getLoop() { return TRUE; }
  76. // motions must report their total duration
  77. virtual F32 getDuration() { return 0.0; }
  78. // motions must report their "ease in" duration
  79. virtual F32 getEaseInDuration() { return 0.0; }
  80. // motions must report their "ease out" duration.
  81. virtual F32 getEaseOutDuration() { return 0.0; }
  82. // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
  83. virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_HAND; }
  84. // motions must report their priority
  85. virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
  86. virtual LLMotionBlendType getBlendType() { return NORMAL_BLEND; }
  87. // run-time (post constructor) initialization,
  88. // called after parameters have been set
  89. // must return true to indicate success and be available for activation
  90. virtual LLMotionInitStatus onInitialize(LLCharacter *character);
  91. // called when a motion is activated
  92. // must return TRUE to indicate success, or else
  93. // it will be deactivated
  94. virtual BOOL onActivate();
  95. // called per time step
  96. // must return TRUE while it is active, and
  97. // must return FALSE when the motion is completed.
  98. virtual BOOL onUpdate(F32 time, U8* joint_mask);
  99. // called when a motion is deactivated
  100. virtual void onDeactivate();
  101. virtual BOOL canDeprecate() { return FALSE; }
  102. static std::string getHandPoseName(eHandPose pose);
  103. static eHandPose getHandPose(std::string posename);
  104. public:
  105. //-------------------------------------------------------------------------
  106. // joint states to be animated
  107. //-------------------------------------------------------------------------
  108. LLCharacter *mCharacter;
  109. F32 mLastTime;
  110. eHandPose mCurrentPose;
  111. eHandPose mNewPose;
  112. };
  113. #endif // LL_LLHANDMOTION_H