00001 00032 #ifndef LL_LLTARGETINGMOTION_H 00033 #define LL_LLTARGETINGMOTION_H 00034 00035 //----------------------------------------------------------------------------- 00036 // Header files 00037 //----------------------------------------------------------------------------- 00038 #include "llmotion.h" 00039 00040 #define TARGETING_EASEIN_DURATION 0.3f 00041 #define TARGETING_EASEOUT_DURATION 0.5f 00042 #define TARGETING_PRIORITY LLJoint::HIGH_PRIORITY 00043 #define MIN_REQUIRED_PIXEL_AREA_TARGETING 1000.f; 00044 00045 00046 //----------------------------------------------------------------------------- 00047 // class LLTargetingMotion 00048 //----------------------------------------------------------------------------- 00049 class LLTargetingMotion : 00050 public LLMotion 00051 { 00052 public: 00053 // Constructor 00054 LLTargetingMotion(const LLUUID &id); 00055 00056 // Destructor 00057 virtual ~LLTargetingMotion(); 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 LLTargetingMotion(id); } 00067 00068 public: 00069 //------------------------------------------------------------------------- 00070 // animation callbacks to be implemented by subclasses 00071 //------------------------------------------------------------------------- 00072 00073 // motions must specify whether or not they loop 00074 virtual BOOL getLoop() { return TRUE; } 00075 00076 // motions must report their total duration 00077 virtual F32 getDuration() { return 0.0; } 00078 00079 // motions must report their "ease in" duration 00080 virtual F32 getEaseInDuration() { return TARGETING_EASEIN_DURATION; } 00081 00082 // motions must report their "ease out" duration. 00083 virtual F32 getEaseOutDuration() { return TARGETING_EASEOUT_DURATION; } 00084 00085 // motions must report their priority 00086 virtual LLJoint::JointPriority getPriority() { return TARGETING_PRIORITY; } 00087 00088 virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; } 00089 00090 // called to determine when a motion should be activated/deactivated based on avatar pixel coverage 00091 virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_TARGETING; } 00092 00093 // run-time (post constructor) initialization, 00094 // called after parameters have been set 00095 // must return true to indicate success and be available for activation 00096 virtual LLMotionInitStatus onInitialize(LLCharacter *character); 00097 00098 // called when a motion is activated 00099 // must return TRUE to indicate success, or else 00100 // it will be deactivated 00101 virtual BOOL onActivate(); 00102 00103 // called per time step 00104 // must return TRUE while it is active, and 00105 // must return FALSE when the motion is completed. 00106 virtual BOOL onUpdate(F32 time, U8* joint_mask); 00107 00108 // called when a motion is deactivated 00109 virtual void onDeactivate(); 00110 00111 public: 00112 00113 LLCharacter *mCharacter; 00114 LLJointState mTorsoState; 00115 LLJoint* mPelvisJoint; 00116 LLJoint* mTorsoJoint; 00117 LLJoint* mRightHandJoint; 00118 }; 00119 00120 #endif // LL_LLTARGETINGMOTION_H 00121