diff options
Diffstat (limited to 'linden/indra/llcharacter/llhandmotion.h')
-rw-r--r-- | linden/indra/llcharacter/llhandmotion.h | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/linden/indra/llcharacter/llhandmotion.h b/linden/indra/llcharacter/llhandmotion.h new file mode 100644 index 0000000..3f3dac6 --- /dev/null +++ b/linden/indra/llcharacter/llhandmotion.h | |||
@@ -0,0 +1,138 @@ | |||
1 | /** | ||
2 | * @file llhandmotion.h | ||
3 | * @brief Implementation of LLHandMotion class. | ||
4 | * | ||
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #ifndef LL_LLHANDMOTION_H | ||
29 | #define LL_LLHANDMOTION_H | ||
30 | |||
31 | //----------------------------------------------------------------------------- | ||
32 | // Header files | ||
33 | //----------------------------------------------------------------------------- | ||
34 | #include "llmotion.h" | ||
35 | #include "lltimer.h" | ||
36 | |||
37 | #define MIN_REQUIRED_PIXEL_AREA_HAND 10000.f; | ||
38 | |||
39 | //----------------------------------------------------------------------------- | ||
40 | // class LLHandMotion | ||
41 | //----------------------------------------------------------------------------- | ||
42 | class LLHandMotion : | ||
43 | public LLMotion | ||
44 | { | ||
45 | public: | ||
46 | typedef enum e_hand_pose | ||
47 | { | ||
48 | HAND_POSE_SPREAD, | ||
49 | HAND_POSE_RELAXED, | ||
50 | HAND_POSE_POINT, | ||
51 | HAND_POSE_FIST, | ||
52 | HAND_POSE_RELAXED_L, | ||
53 | HAND_POSE_POINT_L, | ||
54 | HAND_POSE_FIST_L, | ||
55 | HAND_POSE_RELAXED_R, | ||
56 | HAND_POSE_POINT_R, | ||
57 | HAND_POSE_FIST_R, | ||
58 | HAND_POSE_SALUTE_R, | ||
59 | HAND_POSE_TYPING, | ||
60 | HAND_POSE_PEACE_R, | ||
61 | HAND_POSE_PALM_R, | ||
62 | NUM_HAND_POSES | ||
63 | } eHandPose; | ||
64 | |||
65 | // Constructor | ||
66 | LLHandMotion(const LLUUID &id); | ||
67 | |||
68 | // Destructor | ||
69 | virtual ~LLHandMotion(); | ||
70 | |||
71 | public: | ||
72 | //------------------------------------------------------------------------- | ||
73 | // functions to support MotionController and MotionRegistry | ||
74 | //------------------------------------------------------------------------- | ||
75 | |||
76 | // static constructor | ||
77 | // all subclasses must implement such a function and register it | ||
78 | static LLMotion *create(const LLUUID &id) { return new LLHandMotion(id); } | ||
79 | |||
80 | public: | ||
81 | //------------------------------------------------------------------------- | ||
82 | // animation callbacks to be implemented by subclasses | ||
83 | //------------------------------------------------------------------------- | ||
84 | |||
85 | // motions must specify whether or not they loop | ||
86 | virtual BOOL getLoop() { return TRUE; } | ||
87 | |||
88 | // motions must report their total duration | ||
89 | virtual F32 getDuration() { return 0.0; } | ||
90 | |||
91 | // motions must report their "ease in" duration | ||
92 | virtual F32 getEaseInDuration() { return 0.0; } | ||
93 | |||
94 | // motions must report their "ease out" duration. | ||
95 | virtual F32 getEaseOutDuration() { return 0.0; } | ||
96 | |||
97 | // called to determine when a motion should be activated/deactivated based on avatar pixel coverage | ||
98 | virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_HAND; } | ||
99 | |||
100 | // motions must report their priority | ||
101 | virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; } | ||
102 | |||
103 | virtual LLMotionBlendType getBlendType() { return NORMAL_BLEND; } | ||
104 | |||
105 | // run-time (post constructor) initialization, | ||
106 | // called after parameters have been set | ||
107 | // must return true to indicate success and be available for activation | ||
108 | virtual LLMotionInitStatus onInitialize(LLCharacter *character); | ||
109 | |||
110 | // called when a motion is activated | ||
111 | // must return TRUE to indicate success, or else | ||
112 | // it will be deactivated | ||
113 | virtual BOOL onActivate(); | ||
114 | |||
115 | // called per time step | ||
116 | // must return TRUE while it is active, and | ||
117 | // must return FALSE when the motion is completed. | ||
118 | virtual BOOL onUpdate(F32 time, U8* joint_mask); | ||
119 | |||
120 | // called when a motion is deactivated | ||
121 | virtual void onDeactivate(); | ||
122 | |||
123 | static LLString getHandPoseName(eHandPose pose); | ||
124 | static eHandPose getHandPose(LLString posename); | ||
125 | |||
126 | public: | ||
127 | //------------------------------------------------------------------------- | ||
128 | // joint states to be animated | ||
129 | //------------------------------------------------------------------------- | ||
130 | |||
131 | LLCharacter *mCharacter; | ||
132 | |||
133 | F32 mLastTime; | ||
134 | eHandPose mCurrentPose; | ||
135 | eHandPose mNewPose; | ||
136 | }; | ||
137 | #endif // LL_LLHANDMOTION_H | ||
138 | |||