diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llcharacter/llheadrotmotion.h | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/llcharacter/llheadrotmotion.h')
-rw-r--r-- | linden/indra/llcharacter/llheadrotmotion.h | 213 |
1 files changed, 213 insertions, 0 deletions
diff --git a/linden/indra/llcharacter/llheadrotmotion.h b/linden/indra/llcharacter/llheadrotmotion.h new file mode 100644 index 0000000..1412354 --- /dev/null +++ b/linden/indra/llcharacter/llheadrotmotion.h | |||
@@ -0,0 +1,213 @@ | |||
1 | /** | ||
2 | * @file llheadrotmotion.h | ||
3 | * @brief Implementation of LLHeadRotMotion 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_LLHEADROTMOTION_H | ||
29 | #define LL_LLHEADROTMOTION_H | ||
30 | |||
31 | //----------------------------------------------------------------------------- | ||
32 | // Header files | ||
33 | //----------------------------------------------------------------------------- | ||
34 | #include "llmotion.h" | ||
35 | #include "llframetimer.h" | ||
36 | |||
37 | #define MIN_REQUIRED_PIXEL_AREA_HEAD_ROT 500.f; | ||
38 | #define MIN_REQUIRED_PIXEL_AREA_EYE 25000.f; | ||
39 | |||
40 | //----------------------------------------------------------------------------- | ||
41 | // class LLHeadRotMotion | ||
42 | //----------------------------------------------------------------------------- | ||
43 | class LLHeadRotMotion : | ||
44 | public LLMotion | ||
45 | { | ||
46 | public: | ||
47 | // Constructor | ||
48 | LLHeadRotMotion(const LLUUID &id); | ||
49 | |||
50 | // Destructor | ||
51 | virtual ~LLHeadRotMotion(); | ||
52 | |||
53 | public: | ||
54 | //------------------------------------------------------------------------- | ||
55 | // functions to support MotionController and MotionRegistry | ||
56 | //------------------------------------------------------------------------- | ||
57 | |||
58 | // static constructor | ||
59 | // all subclasses must implement such a function and register it | ||
60 | static LLMotion *create(const LLUUID &id) { return new LLHeadRotMotion(id); } | ||
61 | |||
62 | public: | ||
63 | //------------------------------------------------------------------------- | ||
64 | // animation callbacks to be implemented by subclasses | ||
65 | //------------------------------------------------------------------------- | ||
66 | |||
67 | // motions must specify whether or not they loop | ||
68 | virtual BOOL getLoop() { return TRUE; } | ||
69 | |||
70 | // motions must report their total duration | ||
71 | virtual F32 getDuration() { return 0.0; } | ||
72 | |||
73 | // motions must report their "ease in" duration | ||
74 | virtual F32 getEaseInDuration() { return 1.f; } | ||
75 | |||
76 | // motions must report their "ease out" duration. | ||
77 | virtual F32 getEaseOutDuration() { return 1.f; } | ||
78 | |||
79 | // called to determine when a motion should be activated/deactivated based on avatar pixel coverage | ||
80 | virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_HEAD_ROT; } | ||
81 | |||
82 | // motions must report their priority | ||
83 | virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; } | ||
84 | |||
85 | virtual LLMotionBlendType getBlendType() { return NORMAL_BLEND; } | ||
86 | |||
87 | // run-time (post constructor) initialization, | ||
88 | // called after parameters have been set | ||
89 | // must return true to indicate success and be available for activation | ||
90 | virtual LLMotionInitStatus onInitialize(LLCharacter *character); | ||
91 | |||
92 | // called when a motion is activated | ||
93 | // must return TRUE to indicate success, or else | ||
94 | // it will be deactivated | ||
95 | virtual BOOL onActivate(); | ||
96 | |||
97 | // called per time step | ||
98 | // must return TRUE while it is active, and | ||
99 | // must return FALSE when the motion is completed. | ||
100 | virtual BOOL onUpdate(F32 time, U8* joint_mask); | ||
101 | |||
102 | // called when a motion is deactivated | ||
103 | virtual void onDeactivate(); | ||
104 | |||
105 | public: | ||
106 | //------------------------------------------------------------------------- | ||
107 | // joint states to be animated | ||
108 | //------------------------------------------------------------------------- | ||
109 | LLCharacter *mCharacter; | ||
110 | |||
111 | LLJoint *mTorsoJoint; | ||
112 | LLJoint *mHeadJoint; | ||
113 | LLJoint *mRootJoint; | ||
114 | LLJoint *mPelvisJoint; | ||
115 | |||
116 | LLJointState mTorsoState; | ||
117 | LLJointState mNeckState; | ||
118 | LLJointState mHeadState; | ||
119 | |||
120 | LLQuaternion mLastHeadRot; | ||
121 | }; | ||
122 | |||
123 | //----------------------------------------------------------------------------- | ||
124 | // class LLEyeMotion | ||
125 | //----------------------------------------------------------------------------- | ||
126 | class LLEyeMotion : | ||
127 | public LLMotion | ||
128 | { | ||
129 | public: | ||
130 | // Constructor | ||
131 | LLEyeMotion(const LLUUID &id); | ||
132 | |||
133 | // Destructor | ||
134 | virtual ~LLEyeMotion(); | ||
135 | |||
136 | public: | ||
137 | //------------------------------------------------------------------------- | ||
138 | // functions to support MotionController and MotionRegistry | ||
139 | //------------------------------------------------------------------------- | ||
140 | |||
141 | // static constructor | ||
142 | // all subclasses must implement such a function and register it | ||
143 | static LLMotion *create( const LLUUID &id) { return new LLEyeMotion(id); } | ||
144 | |||
145 | public: | ||
146 | //------------------------------------------------------------------------- | ||
147 | // animation callbacks to be implemented by subclasses | ||
148 | //------------------------------------------------------------------------- | ||
149 | |||
150 | // motions must specify whether or not they loop | ||
151 | virtual BOOL getLoop() { return TRUE; } | ||
152 | |||
153 | // motions must report their total duration | ||
154 | virtual F32 getDuration() { return 0.0; } | ||
155 | |||
156 | // motions must report their "ease in" duration | ||
157 | virtual F32 getEaseInDuration() { return 0.5f; } | ||
158 | |||
159 | // motions must report their "ease out" duration. | ||
160 | virtual F32 getEaseOutDuration() { return 0.5f; } | ||
161 | |||
162 | // called to determine when a motion should be activated/deactivated based on avatar pixel coverage | ||
163 | virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_EYE; } | ||
164 | |||
165 | // motions must report their priority | ||
166 | virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; } | ||
167 | |||
168 | virtual LLMotionBlendType getBlendType() { return NORMAL_BLEND; } | ||
169 | |||
170 | // run-time (post constructor) initialization, | ||
171 | // called after parameters have been set | ||
172 | // must return true to indicate success and be available for activation | ||
173 | virtual LLMotionInitStatus onInitialize(LLCharacter *character); | ||
174 | |||
175 | // called when a motion is activated | ||
176 | // must return TRUE to indicate success, or else | ||
177 | // it will be deactivated | ||
178 | virtual BOOL onActivate(); | ||
179 | |||
180 | // called per time step | ||
181 | // must return TRUE while it is active, and | ||
182 | // must return FALSE when the motion is completed. | ||
183 | virtual BOOL onUpdate(F32 time, U8* joint_mask); | ||
184 | |||
185 | // called when a motion is deactivated | ||
186 | virtual void onDeactivate(); | ||
187 | |||
188 | public: | ||
189 | //------------------------------------------------------------------------- | ||
190 | // joint states to be animated | ||
191 | //------------------------------------------------------------------------- | ||
192 | LLCharacter *mCharacter; | ||
193 | |||
194 | LLJoint *mHeadJoint; | ||
195 | LLJointState mLeftEyeState; | ||
196 | LLJointState mRightEyeState; | ||
197 | |||
198 | LLFrameTimer mEyeJitterTimer; | ||
199 | F32 mEyeJitterTime; | ||
200 | F32 mEyeJitterYaw; | ||
201 | F32 mEyeJitterPitch; | ||
202 | F32 mEyeLookAwayTime; | ||
203 | F32 mEyeLookAwayYaw; | ||
204 | F32 mEyeLookAwayPitch; | ||
205 | |||
206 | // eye blinking | ||
207 | LLFrameTimer mEyeBlinkTimer; | ||
208 | F32 mEyeBlinkTime; | ||
209 | BOOL mEyesClosed; | ||
210 | }; | ||
211 | |||
212 | #endif // LL_LLHEADROTMOTION_H | ||
213 | |||