lljointstate.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLJOINTSTATE_H
00033 #define LL_LLJOINTSTATE_H
00034 
00035 //-----------------------------------------------------------------------------
00036 // Header Files
00037 //-----------------------------------------------------------------------------
00038 #include "lljoint.h"
00039 
00040 //-----------------------------------------------------------------------------
00041 // class LLJointState
00042 //-----------------------------------------------------------------------------
00043 class LLJointState
00044 {
00045 public:
00046         enum BlendPhase
00047         {
00048                 INACTIVE,
00049                 EASE_IN,
00050                 ACTIVE,
00051                 EASE_OUT
00052         };
00053 protected:
00054         // associated joint
00055         LLJoint *mJoint;
00056 
00057         // indicates which members are used
00058         U32             mUsage;
00059 
00060         // indicates weighted effect of this joint 
00061         F32             mWeight;
00062 
00063         // transformation members
00064         LLVector3               mPosition;      // position relative to parent joint
00065         LLQuaternion    mRotation;      // joint rotation relative to parent joint
00066         LLVector3               mScale;         // scale relative to rotated frame
00067         LLJoint::JointPriority  mPriority;  // how important this joint state is relative to others
00068 public:
00069         // Constructor
00070         LLJointState()
00071         {
00072                 mUsage = 0;
00073                 mJoint = NULL;
00074                 mUsage = 0;
00075                 mWeight = 0.f;
00076                 mPriority = LLJoint::USE_MOTION_PRIORITY;
00077         }
00078 
00079         LLJointState(LLJoint* joint)
00080         {
00081                 mUsage = 0;
00082                 mJoint = joint;
00083                 mUsage = 0;
00084                 mWeight = 0.f;
00085                 mPriority = LLJoint::USE_MOTION_PRIORITY;
00086         }
00087 
00088         // Destructor
00089         virtual ~LLJointState()
00090         {
00091         }
00092 
00093         // joint that this state is applied to
00094         LLJoint *getJoint()                             { return mJoint; }
00095         BOOL setJoint( LLJoint *joint ) { mJoint = joint; return mJoint != NULL; }
00096 
00097         // transform type (bitwise flags can be combined)
00098         // Note that these are set automatically when various
00099         // member setPos/setRot/setScale functions are called.
00100         enum Usage
00101         {
00102                 POS             = 1,
00103                 ROT             = 2,
00104                 SCALE   = 4,
00105         };
00106         U32 getUsage()                  { return mUsage; }
00107         void setUsage( U32 usage )      { mUsage = usage; }
00108         F32 getWeight()                 { return mWeight; }
00109         void setWeight( F32 weight )    { mWeight = weight; }
00110 
00111         // get/set position
00112         const LLVector3& getPosition()                          { return mPosition; }
00113         void setPosition( const LLVector3& pos )        { llassert(mUsage & POS); mPosition = pos; }
00114 
00115         // get/set rotation
00116         const LLQuaternion& getRotation()                       { return mRotation; }
00117         void setRotation( const LLQuaternion& rot )     { llassert(mUsage & ROT); mRotation = rot; }
00118 
00119         // get/set scale
00120         const LLVector3& getScale()                             { return mScale; }
00121         void setScale( const LLVector3& scale ) { llassert(mUsage & SCALE); mScale = scale; }
00122 
00123         // get/set priority
00124         LLJoint::JointPriority getPriority()            { return mPriority; }
00125         void setPriority( const LLJoint::JointPriority priority ) { mPriority = priority; }
00126 };
00127 
00128 #endif // LL_LLJOINTSTATE_H
00129 

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