llhandmotion.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLHANDMOTION_H
00033 #define LL_LLHANDMOTION_H
00034 
00035 //-----------------------------------------------------------------------------
00036 // Header files
00037 //-----------------------------------------------------------------------------
00038 #include "llmotion.h"
00039 #include "lltimer.h"
00040 
00041 #define MIN_REQUIRED_PIXEL_AREA_HAND 10000.f;
00042 
00043 //-----------------------------------------------------------------------------
00044 // class LLHandMotion
00045 //-----------------------------------------------------------------------------
00046 class LLHandMotion :
00047         public LLMotion
00048 {
00049 public:
00050         typedef enum e_hand_pose
00051         {
00052                 HAND_POSE_SPREAD,
00053                 HAND_POSE_RELAXED,
00054                 HAND_POSE_POINT,
00055                 HAND_POSE_FIST,
00056                 HAND_POSE_RELAXED_L,
00057                 HAND_POSE_POINT_L,
00058                 HAND_POSE_FIST_L,
00059                 HAND_POSE_RELAXED_R,
00060                 HAND_POSE_POINT_R,
00061                 HAND_POSE_FIST_R,
00062                 HAND_POSE_SALUTE_R,
00063                 HAND_POSE_TYPING,
00064                 HAND_POSE_PEACE_R,
00065                 HAND_POSE_PALM_R,
00066                 NUM_HAND_POSES
00067         } eHandPose;
00068 
00069         // Constructor
00070         LLHandMotion(const LLUUID &id);
00071 
00072         // Destructor
00073         virtual ~LLHandMotion();
00074 
00075 public:
00076         //-------------------------------------------------------------------------
00077         // functions to support MotionController and MotionRegistry
00078         //-------------------------------------------------------------------------
00079 
00080         // static constructor
00081         // all subclasses must implement such a function and register it
00082         static LLMotion *create(const LLUUID &id) { return new LLHandMotion(id); }
00083 
00084 public:
00085         //-------------------------------------------------------------------------
00086         // animation callbacks to be implemented by subclasses
00087         //-------------------------------------------------------------------------
00088 
00089         // motions must specify whether or not they loop
00090         virtual BOOL getLoop() { return TRUE; }
00091 
00092         // motions must report their total duration
00093         virtual F32 getDuration() { return 0.0; }
00094 
00095         // motions must report their "ease in" duration
00096         virtual F32 getEaseInDuration() { return 0.0; }
00097 
00098         // motions must report their "ease out" duration.
00099         virtual F32 getEaseOutDuration() { return 0.0; }
00100 
00101         // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
00102         virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_HAND; }
00103 
00104         // motions must report their priority
00105         virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
00106 
00107         virtual LLMotionBlendType getBlendType() { return NORMAL_BLEND; }
00108 
00109         // run-time (post constructor) initialization,
00110         // called after parameters have been set
00111         // must return true to indicate success and be available for activation
00112         virtual LLMotionInitStatus onInitialize(LLCharacter *character);
00113 
00114         // called when a motion is activated
00115         // must return TRUE to indicate success, or else
00116         // it will be deactivated 
00117         virtual BOOL onActivate();
00118 
00119         // called per time step
00120         // must return TRUE while it is active, and
00121         // must return FALSE when the motion is completed.
00122         virtual BOOL onUpdate(F32 time, U8* joint_mask);
00123 
00124         // called when a motion is deactivated
00125         virtual void onDeactivate();
00126 
00127         static LLString getHandPoseName(eHandPose pose);
00128         static eHandPose getHandPose(LLString posename);
00129 
00130 public:
00131         //-------------------------------------------------------------------------
00132         // joint states to be animated
00133         //-------------------------------------------------------------------------
00134 
00135         LLCharacter                     *mCharacter;
00136 
00137         F32                                     mLastTime;
00138         eHandPose                       mCurrentPose;
00139         eHandPose                       mNewPose;
00140 };
00141 #endif // LL_LLHANDMOTION_H
00142 

Generated on Thu Jul 1 06:08:41 2010 for Second Life Viewer by  doxygen 1.4.7