llkeyframemotionparam.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLKEYFRAMEMOTIONPARAM_H
00033 #define LL_LLKEYFRAMEMOTIONPARAM_H
00034 
00035 //-----------------------------------------------------------------------------
00036 // Header files
00037 //-----------------------------------------------------------------------------
00038 
00039 #include <string>
00040 
00041 #include "llmotion.h"
00042 #include "lljointstate.h"
00043 #include "v3math.h"
00044 #include "llquaternion.h"
00045 #include "linked_lists.h"
00046 #include "llkeyframemotion.h"
00047 
00048 //-----------------------------------------------------------------------------
00049 // class LLKeyframeMotionParam
00050 //-----------------------------------------------------------------------------
00051 class LLKeyframeMotionParam :
00052         public LLMotion
00053 {
00054 public:
00055         // Constructor
00056         LLKeyframeMotionParam(const LLUUID &id);
00057 
00058         // Destructor
00059         virtual ~LLKeyframeMotionParam();
00060 
00061 public:
00062         //-------------------------------------------------------------------------
00063         // functions to support MotionController and MotionRegistry
00064         //-------------------------------------------------------------------------
00065 
00066         // static constructor
00067         // all subclasses must implement such a function and register it
00068         static LLMotion *create(const LLUUID &id) { return new LLKeyframeMotionParam(id); }
00069 
00070 public:
00071         //-------------------------------------------------------------------------
00072         // animation callbacks to be implemented by subclasses
00073         //-------------------------------------------------------------------------
00074 
00075         // motions must specify whether or not they loop
00076         virtual BOOL getLoop() {
00077                 return TRUE;
00078         }
00079 
00080         // motions must report their total duration
00081         virtual F32 getDuration() { 
00082                 return mDuration;
00083         }
00084 
00085         // motions must report their "ease in" duration
00086         virtual F32 getEaseInDuration() { 
00087                 return mEaseInDuration;
00088         }
00089 
00090         // motions must report their "ease out" duration.
00091         virtual F32 getEaseOutDuration() { 
00092                 return mEaseOutDuration;
00093         }
00094 
00095         // motions must report their priority
00096         virtual LLJoint::JointPriority getPriority() { 
00097                 return mPriority;
00098         }
00099 
00100         virtual LLMotionBlendType getBlendType() { return NORMAL_BLEND; }
00101 
00102         // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
00103         virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_KEYFRAME; }
00104 
00105         // run-time (post constructor) initialization,
00106         // called after parameters have been set
00107         // must return true to indicate success and be available for activation
00108         virtual LLMotionInitStatus onInitialize(LLCharacter *character);
00109 
00110         // called when a motion is activated
00111         // must return TRUE to indicate success, or else
00112         // it will be deactivated
00113         virtual BOOL onActivate();
00114 
00115         // called per time step
00116         // must return TRUE while it is active, and
00117         // must return FALSE when the motion is completed.
00118         virtual BOOL onUpdate(F32 time, U8* joint_mask);
00119 
00120         // called when a motion is deactivated
00121         virtual void onDeactivate();
00122 
00123         virtual LLPose* getPose() { return mPoseBlender.getBlendedPose();}
00124 
00125 protected:
00126         //-------------------------------------------------------------------------
00127         // new functions defined by this subclass
00128         //-------------------------------------------------------------------------
00129         typedef std::pair<LLMotion*, F32> ParameterizedMotion;
00130         
00131         // add a motion and associated parameter triplet
00132         BOOL addKeyframeMotion(char *name, const LLUUID &id, char *param, F32 value);
00133         
00134         // set default motion for LOD and retrieving blend constants
00135         void setDefaultKeyframeMotion(char *);
00136 
00137         static BOOL sortFunc(ParameterizedMotion *new_motion, ParameterizedMotion *tested_motion);
00138 
00139         BOOL loadMotions();
00140 
00141 protected:
00142         //-------------------------------------------------------------------------
00143         // Member Data
00144         //-------------------------------------------------------------------------
00145 
00146         typedef LLLinkedList < ParameterizedMotion >    motion_list_t;
00147         LLAssocList <std::string, motion_list_t* > mParameterizedMotions;
00148         LLJointState*           mJointStates;
00149         LLMotion*                       mDefaultKeyframeMotion;
00150         LLCharacter*            mCharacter;
00151         LLPoseBlender           mPoseBlender;
00152 
00153         F32                                     mEaseInDuration;
00154         F32                                     mEaseOutDuration;
00155         F32                                     mDuration;
00156         LLJoint::JointPriority  mPriority;
00157 
00158         LLUUID                          mTransactionID;
00159 };
00160 
00161 #endif // LL_LLKEYFRAMEMOTIONPARAM_H

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