llkeyframewalkmotion.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLKEYFRAMEWALKMOTION_H
00033 #define LL_LLKEYFRAMEWALKMOTION_H
00034 
00035 //-----------------------------------------------------------------------------
00036 // Header files
00037 //-----------------------------------------------------------------------------
00038 #include "llkeyframemotion.h"
00039 #include "llcharacter.h"
00040 #include "v3dmath.h"
00041 
00042 #define MIN_REQUIRED_PIXEL_AREA_WALK_ADJUST (20.f)
00043 #define MIN_REQUIRED_PIXEL_AREA_FLY_ADJUST (20.f)
00044 
00045 //-----------------------------------------------------------------------------
00046 // class LLKeyframeWalkMotion
00047 //-----------------------------------------------------------------------------
00048 class LLKeyframeWalkMotion :
00049         public LLKeyframeMotion
00050 {
00051         friend class LLWalkAdjustMotion;
00052 public:
00053         // Constructor
00054         LLKeyframeWalkMotion(const LLUUID &id);
00055 
00056         // Destructor
00057         virtual ~LLKeyframeWalkMotion();
00058 
00059 public:
00060         //-------------------------------------------------------------------------
00061         // functions to support MotionController and MotionRegistry
00062         //-------------------------------------------------------------------------
00063         
00064         // static constructor
00065         // all subclasses must implement such a function and register it
00066         static LLMotion *create(const LLUUID &id) { return new LLKeyframeWalkMotion(id); }
00067 
00068 public:
00069         //-------------------------------------------------------------------------
00070         // animation callbacks to be implemented by subclasses
00071         //-------------------------------------------------------------------------
00072         virtual LLMotionInitStatus onInitialize(LLCharacter *character);
00073         virtual BOOL onActivate();
00074         virtual void onDeactivate();
00075         virtual BOOL onUpdate(F32 time, U8* joint_mask);
00076 
00077 public:
00078         //-------------------------------------------------------------------------
00079         // Member Data
00080         //-------------------------------------------------------------------------
00081         LLCharacter     *mCharacter;
00082         F32                     mCyclePhase;
00083         F32                     mRealTimeLast;
00084         F32                     mAdjTimeLast;
00085         S32                     mDownFoot;
00086 };
00087 
00088 class LLWalkAdjustMotion : public LLMotion
00089 {
00090 public:
00091         // Constructor
00092         LLWalkAdjustMotion(const LLUUID &id);
00093 
00094 public:
00095         //-------------------------------------------------------------------------
00096         // functions to support MotionController and MotionRegistry
00097         //-------------------------------------------------------------------------
00098 
00099         // static constructor
00100         // all subclasses must implement such a function and register it
00101         static LLMotion *create(const LLUUID &id) { return new LLWalkAdjustMotion(id); }
00102 
00103 public:
00104         //-------------------------------------------------------------------------
00105         // animation callbacks to be implemented by subclasses
00106         //-------------------------------------------------------------------------
00107         virtual LLMotionInitStatus onInitialize(LLCharacter *character);
00108         virtual BOOL onActivate();
00109         virtual void onDeactivate();
00110         virtual BOOL onUpdate(F32 time, U8* joint_mask);
00111         virtual LLJoint::JointPriority getPriority(){return LLJoint::HIGH_PRIORITY;}
00112         virtual BOOL getLoop() { return TRUE; }
00113         virtual F32 getDuration() { return 0.f; }
00114         virtual F32 getEaseInDuration() { return 0.f; }
00115         virtual F32 getEaseOutDuration() { return 0.f; }
00116         virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_WALK_ADJUST; }
00117         virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; }
00118 
00119 public:
00120         //-------------------------------------------------------------------------
00121         // Member Data
00122         //-------------------------------------------------------------------------
00123         LLCharacter             *mCharacter;
00124         LLJoint*                mLeftAnkleJoint;
00125         LLJoint*                mRightAnkleJoint;
00126         LLJointState    mPelvisState;
00127         LLJoint*                mPelvisJoint;
00128         LLVector3d              mLastLeftAnklePos;
00129         LLVector3d              mLastRightAnklePos;
00130         F32                             mLastTime;
00131         F32                             mAvgCorrection;
00132         F32                             mSpeedAdjust;
00133         F32                             mAnimSpeed;
00134         F32                             mAvgSpeed;
00135         F32                             mRelativeDir;
00136         LLVector3               mPelvisOffset;
00137         F32                             mAnkleOffset;
00138 };
00139 
00140 class LLFlyAdjustMotion : public LLMotion
00141 {
00142 public:
00143         // Constructor
00144         LLFlyAdjustMotion(const LLUUID &id) : LLMotion(id) {mName = "fly_adjust";}
00145 
00146 public:
00147         //-------------------------------------------------------------------------
00148         // functions to support MotionController and MotionRegistry
00149         //-------------------------------------------------------------------------
00150 
00151         // static constructor
00152         // all subclasses must implement such a function and register it
00153         static LLMotion *create(const LLUUID &id) { return new LLFlyAdjustMotion(id); }
00154 
00155 public:
00156         //-------------------------------------------------------------------------
00157         // animation callbacks to be implemented by subclasses
00158         //-------------------------------------------------------------------------
00159         virtual LLMotionInitStatus onInitialize(LLCharacter *character);
00160         virtual BOOL onActivate();
00161         virtual void onDeactivate() {};
00162         virtual BOOL onUpdate(F32 time, U8* joint_mask);
00163         virtual LLJoint::JointPriority getPriority(){return LLJoint::HIGHER_PRIORITY;}
00164         virtual BOOL getLoop() { return TRUE; }
00165         virtual F32 getDuration() { return 0.f; }
00166         virtual F32 getEaseInDuration() { return 0.f; }
00167         virtual F32 getEaseOutDuration() { return 0.f; }
00168         virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_FLY_ADJUST; }
00169         virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; }
00170 
00171 protected:
00172         //-------------------------------------------------------------------------
00173         // Member Data
00174         //-------------------------------------------------------------------------
00175         LLCharacter             *mCharacter;
00176         LLJointState    mPelvisState;
00177         F32                             mRoll;
00178 };
00179 
00180 #endif // LL_LLKeyframeWalkMotion_H
00181 

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