00001 00032 #ifndef LL_LLEDITINGMOTION_H 00033 #define LL_LLEDITINGMOTION_H 00034 00035 //----------------------------------------------------------------------------- 00036 // Header files 00037 //----------------------------------------------------------------------------- 00038 #include "llmotion.h" 00039 #include "lljointsolverrp3.h" 00040 #include "v3dmath.h" 00041 00042 #define EDITING_EASEIN_DURATION 0.0f 00043 #define EDITING_EASEOUT_DURATION 0.5f 00044 #define EDITING_PRIORITY LLJoint::HIGH_PRIORITY 00045 #define MIN_REQUIRED_PIXEL_AREA_EDITING 500.f 00046 00047 //----------------------------------------------------------------------------- 00048 // class LLEditingMotion 00049 //----------------------------------------------------------------------------- 00050 class LLEditingMotion : 00051 public LLMotion 00052 { 00053 public: 00054 // Constructor 00055 LLEditingMotion(const LLUUID &id); 00056 00057 // Destructor 00058 virtual ~LLEditingMotion(); 00059 00060 public: 00061 //------------------------------------------------------------------------- 00062 // functions to support MotionController and MotionRegistry 00063 //------------------------------------------------------------------------- 00064 00065 // static constructor 00066 // all subclasses must implement such a function and register it 00067 static LLMotion *create(const LLUUID &id) { return new LLEditingMotion(id); } 00068 00069 public: 00070 //------------------------------------------------------------------------- 00071 // animation callbacks to be implemented by subclasses 00072 //------------------------------------------------------------------------- 00073 00074 // motions must specify whether or not they loop 00075 virtual BOOL getLoop() { return TRUE; } 00076 00077 // motions must report their total duration 00078 virtual F32 getDuration() { return 0.0; } 00079 00080 // motions must report their "ease in" duration 00081 virtual F32 getEaseInDuration() { return EDITING_EASEIN_DURATION; } 00082 00083 // motions must report their "ease out" duration. 00084 virtual F32 getEaseOutDuration() { return EDITING_EASEOUT_DURATION; } 00085 00086 // motions must report their priority 00087 virtual LLJoint::JointPriority getPriority() { return EDITING_PRIORITY; } 00088 00089 virtual LLMotionBlendType getBlendType() { return NORMAL_BLEND; } 00090 00091 // called to determine when a motion should be activated/deactivated based on avatar pixel coverage 00092 virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_EDITING; } 00093 00094 // run-time (post constructor) initialization, 00095 // called after parameters have been set 00096 // must return true to indicate success and be available for activation 00097 virtual LLMotionInitStatus onInitialize(LLCharacter *character); 00098 00099 // called when a motion is activated 00100 // must return TRUE to indicate success, or else 00101 // it will be deactivated 00102 virtual BOOL onActivate(); 00103 00104 // called per time step 00105 // must return TRUE while it is active, and 00106 // must return FALSE when the motion is completed. 00107 virtual BOOL onUpdate(F32 time, U8* joint_mask); 00108 00109 // called when a motion is deactivated 00110 virtual void onDeactivate(); 00111 00112 public: 00113 //------------------------------------------------------------------------- 00114 // joint states to be animated 00115 //------------------------------------------------------------------------- 00116 LLCharacter *mCharacter; 00117 LLVector3 mWristOffset; 00118 00119 LLJointState mParentState; 00120 LLJointState mShoulderState; 00121 LLJointState mElbowState; 00122 LLJointState mWristState; 00123 LLJointState mTorsoState; 00124 00125 LLJoint mParentJoint; 00126 LLJoint mShoulderJoint; 00127 LLJoint mElbowJoint; 00128 LLJoint mWristJoint; 00129 LLJoint mTarget; 00130 LLJointSolverRP3 mIKSolver; 00131 00132 static S32 sHandPose; 00133 static S32 sHandPosePriority; 00134 LLVector3 mLastSelectPt; 00135 }; 00136 00137 #endif // LL_LLKEYFRAMEMOTION_H 00138