/indra/llcharacter/lleditingmotion.h

https://bitbucket.org/lindenlab/viewer-beta/ · C++ Header · 133 lines · 48 code · 25 blank · 60 comment · 0 complexity · e42d13c8a31a469bc59dd82ac3e6e0a4 MD5 · raw file

  1. /**
  2. * @file lleditingmotion.h
  3. * @brief Implementation of LLEditingMotion 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_LLEDITINGMOTION_H
  27. #define LL_LLEDITINGMOTION_H
  28. //-----------------------------------------------------------------------------
  29. // Header files
  30. //-----------------------------------------------------------------------------
  31. #include "llmotion.h"
  32. #include "lljointsolverrp3.h"
  33. #include "v3dmath.h"
  34. #define EDITING_EASEIN_DURATION 0.0f
  35. #define EDITING_EASEOUT_DURATION 0.5f
  36. #define EDITING_PRIORITY LLJoint::HIGH_PRIORITY
  37. #define MIN_REQUIRED_PIXEL_AREA_EDITING 500.f
  38. //-----------------------------------------------------------------------------
  39. // class LLEditingMotion
  40. //-----------------------------------------------------------------------------
  41. class LLEditingMotion :
  42. public LLMotion
  43. {
  44. public:
  45. // Constructor
  46. LLEditingMotion(const LLUUID &id);
  47. // Destructor
  48. virtual ~LLEditingMotion();
  49. public:
  50. //-------------------------------------------------------------------------
  51. // functions to support MotionController and MotionRegistry
  52. //-------------------------------------------------------------------------
  53. // static constructor
  54. // all subclasses must implement such a function and register it
  55. static LLMotion *create(const LLUUID &id) { return new LLEditingMotion(id); }
  56. public:
  57. //-------------------------------------------------------------------------
  58. // animation callbacks to be implemented by subclasses
  59. //-------------------------------------------------------------------------
  60. // motions must specify whether or not they loop
  61. virtual BOOL getLoop() { return TRUE; }
  62. // motions must report their total duration
  63. virtual F32 getDuration() { return 0.0; }
  64. // motions must report their "ease in" duration
  65. virtual F32 getEaseInDuration() { return EDITING_EASEIN_DURATION; }
  66. // motions must report their "ease out" duration.
  67. virtual F32 getEaseOutDuration() { return EDITING_EASEOUT_DURATION; }
  68. // motions must report their priority
  69. virtual LLJoint::JointPriority getPriority() { return EDITING_PRIORITY; }
  70. virtual LLMotionBlendType getBlendType() { return NORMAL_BLEND; }
  71. // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
  72. virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_EDITING; }
  73. // run-time (post constructor) initialization,
  74. // called after parameters have been set
  75. // must return true to indicate success and be available for activation
  76. virtual LLMotionInitStatus onInitialize(LLCharacter *character);
  77. // called when a motion is activated
  78. // must return TRUE to indicate success, or else
  79. // it will be deactivated
  80. virtual BOOL onActivate();
  81. // called per time step
  82. // must return TRUE while it is active, and
  83. // must return FALSE when the motion is completed.
  84. virtual BOOL onUpdate(F32 time, U8* joint_mask);
  85. // called when a motion is deactivated
  86. virtual void onDeactivate();
  87. public:
  88. //-------------------------------------------------------------------------
  89. // joint states to be animated
  90. //-------------------------------------------------------------------------
  91. LLCharacter *mCharacter;
  92. LLVector3 mWristOffset;
  93. LLPointer<LLJointState> mParentState;
  94. LLPointer<LLJointState> mShoulderState;
  95. LLPointer<LLJointState> mElbowState;
  96. LLPointer<LLJointState> mWristState;
  97. LLPointer<LLJointState> mTorsoState;
  98. LLJoint mParentJoint;
  99. LLJoint mShoulderJoint;
  100. LLJoint mElbowJoint;
  101. LLJoint mWristJoint;
  102. LLJoint mTarget;
  103. LLJointSolverRP3 mIKSolver;
  104. static S32 sHandPose;
  105. static S32 sHandPosePriority;
  106. LLVector3 mLastSelectPt;
  107. };
  108. #endif // LL_LLKEYFRAMEMOTION_H