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

Generated on Fri May 16 08:31:57 2008 for SecondLife by  doxygen 1.5.5