llemote.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLEMOTE_H
00033 #define LL_LLEMOTE_H
00034 
00035 //-----------------------------------------------------------------------------
00036 // Header files
00037 //-----------------------------------------------------------------------------
00038 #include "llmotion.h"
00039 #include "lltimer.h"
00040 
00041 #define MIN_REQUIRED_PIXEL_AREA_EMOTE 2000.f
00042 
00043 #define EMOTE_MORPH_FADEIN_TIME 0.3f
00044 #define EMOTE_MORPH_IN_TIME 1.1f
00045 #define EMOTE_MORPH_FADEOUT_TIME 1.4f
00046 
00047 class LLVisualParam;
00048 
00049 //-----------------------------------------------------------------------------
00050 // class LLEmote
00051 //-----------------------------------------------------------------------------
00052 class LLEmote :
00053         public LLMotion
00054 {
00055 public:
00056         // Constructor
00057         LLEmote(const LLUUID &id);
00058 
00059         // Destructor
00060         virtual ~LLEmote();
00061 
00062 public:
00063         //-------------------------------------------------------------------------
00064         // functions to support MotionController and MotionRegistry
00065         //-------------------------------------------------------------------------
00066 
00067         // static constructor
00068         // all subclasses must implement such a function and register it
00069         static LLMotion *create(const LLUUID &id) { return new LLEmote(id); }
00070 
00071 public:
00072         //-------------------------------------------------------------------------
00073         // animation callbacks to be implemented by subclasses
00074         //-------------------------------------------------------------------------
00075 
00076         // motions must specify whether or not they loop
00077         virtual BOOL getLoop() { return FALSE; }
00078 
00079         // motions must report their total duration
00080         virtual F32 getDuration() { return EMOTE_MORPH_FADEIN_TIME + EMOTE_MORPH_IN_TIME + EMOTE_MORPH_FADEOUT_TIME; }
00081 
00082         // motions must report their "ease in" duration
00083         virtual F32 getEaseInDuration() { return EMOTE_MORPH_FADEIN_TIME; }
00084 
00085         // motions must report their "ease out" duration.
00086         virtual F32 getEaseOutDuration() { return EMOTE_MORPH_FADEOUT_TIME; }
00087 
00088         // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
00089         virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_EMOTE; }
00090 
00091         // motions must report their priority
00092         virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
00093 
00094         virtual LLMotionBlendType getBlendType() { return NORMAL_BLEND; }
00095 
00096         // run-time (post constructor) initialization,
00097         // called after parameters have been set
00098         // must return true to indicate success and be available for activation
00099         virtual LLMotionInitStatus onInitialize(LLCharacter *character);
00100 
00101         // called when a motion is activated
00102         // must return TRUE to indicate success, or else
00103         // it will be deactivated 
00104         virtual BOOL onActivate();
00105 
00106         // called per time step
00107         // must return TRUE while it is active, and
00108         // must return FALSE when the motion is completed.
00109         virtual BOOL onUpdate(F32 time, U8* joint_mask);
00110 
00111         // called when a motion is deactivated
00112         virtual void onDeactivate();
00113 
00114         virtual BOOL canDeprecate() { return FALSE; }
00115 
00116         static BOOL      getIndexFromName( const char* name, U32* index );
00117 
00118 protected:
00119 
00120         LLCharacter*            mCharacter;
00121 
00122         LLVisualParam*          mParam;
00123 };
00124 
00125 
00126 
00127 #endif // LL_LLEMOTE_H
00128 
00129 

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