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/llkeyframewalkmotion.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/llkeyframewalkmotion.h')
-rw-r--r-- | linden/indra/llcharacter/llkeyframewalkmotion.h | 177 |
1 files changed, 177 insertions, 0 deletions
diff --git a/linden/indra/llcharacter/llkeyframewalkmotion.h b/linden/indra/llcharacter/llkeyframewalkmotion.h new file mode 100644 index 0000000..3367b64 --- /dev/null +++ b/linden/indra/llcharacter/llkeyframewalkmotion.h | |||
@@ -0,0 +1,177 @@ | |||
1 | /** | ||
2 | * @file llkeyframewalkmotion.h | ||
3 | * @brief Implementation of LLKeframeWalkMotion 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_LLKEYFRAMEWALKMOTION_H | ||
29 | #define LL_LLKEYFRAMEWALKMOTION_H | ||
30 | |||
31 | //----------------------------------------------------------------------------- | ||
32 | // Header files | ||
33 | //----------------------------------------------------------------------------- | ||
34 | #include "llkeyframemotion.h" | ||
35 | #include "llcharacter.h" | ||
36 | #include "v3dmath.h" | ||
37 | |||
38 | #define MIN_REQUIRED_PIXEL_AREA_WALK_ADJUST (20.f) | ||
39 | #define MIN_REQUIRED_PIXEL_AREA_FLY_ADJUST (20.f) | ||
40 | |||
41 | //----------------------------------------------------------------------------- | ||
42 | // class LLKeyframeWalkMotion | ||
43 | //----------------------------------------------------------------------------- | ||
44 | class LLKeyframeWalkMotion : | ||
45 | public LLKeyframeMotion | ||
46 | { | ||
47 | friend class LLWalkAdjustMotion; | ||
48 | public: | ||
49 | // Constructor | ||
50 | LLKeyframeWalkMotion(const LLUUID &id); | ||
51 | |||
52 | // Destructor | ||
53 | virtual ~LLKeyframeWalkMotion(); | ||
54 | |||
55 | public: | ||
56 | //------------------------------------------------------------------------- | ||
57 | // functions to support MotionController and MotionRegistry | ||
58 | //------------------------------------------------------------------------- | ||
59 | |||
60 | // static constructor | ||
61 | // all subclasses must implement such a function and register it | ||
62 | static LLMotion *create(const LLUUID &id) { return new LLKeyframeWalkMotion(id); } | ||
63 | |||
64 | public: | ||
65 | //------------------------------------------------------------------------- | ||
66 | // animation callbacks to be implemented by subclasses | ||
67 | //------------------------------------------------------------------------- | ||
68 | virtual LLMotionInitStatus onInitialize(LLCharacter *character); | ||
69 | virtual BOOL onActivate(); | ||
70 | virtual void onDeactivate(); | ||
71 | virtual BOOL onUpdate(F32 time, U8* joint_mask); | ||
72 | |||
73 | public: | ||
74 | //------------------------------------------------------------------------- | ||
75 | // Member Data | ||
76 | //------------------------------------------------------------------------- | ||
77 | LLCharacter *mCharacter; | ||
78 | F32 mCyclePhase; | ||
79 | F32 mRealTimeLast; | ||
80 | F32 mAdjTimeLast; | ||
81 | S32 mDownFoot; | ||
82 | }; | ||
83 | |||
84 | class LLWalkAdjustMotion : public LLMotion | ||
85 | { | ||
86 | public: | ||
87 | // Constructor | ||
88 | LLWalkAdjustMotion(const LLUUID &id); | ||
89 | |||
90 | public: | ||
91 | //------------------------------------------------------------------------- | ||
92 | // functions to support MotionController and MotionRegistry | ||
93 | //------------------------------------------------------------------------- | ||
94 | |||
95 | // static constructor | ||
96 | // all subclasses must implement such a function and register it | ||
97 | static LLMotion *create(const LLUUID &id) { return new LLWalkAdjustMotion(id); } | ||
98 | |||
99 | public: | ||
100 | //------------------------------------------------------------------------- | ||
101 | // animation callbacks to be implemented by subclasses | ||
102 | //------------------------------------------------------------------------- | ||
103 | virtual LLMotionInitStatus onInitialize(LLCharacter *character); | ||
104 | virtual BOOL onActivate(); | ||
105 | virtual void onDeactivate(); | ||
106 | virtual BOOL onUpdate(F32 time, U8* joint_mask); | ||
107 | virtual LLJoint::JointPriority getPriority(){return LLJoint::HIGH_PRIORITY;} | ||
108 | virtual BOOL getLoop() { return TRUE; } | ||
109 | virtual F32 getDuration() { return 0.f; } | ||
110 | virtual F32 getEaseInDuration() { return 0.f; } | ||
111 | virtual F32 getEaseOutDuration() { return 0.f; } | ||
112 | virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_WALK_ADJUST; } | ||
113 | virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; } | ||
114 | |||
115 | public: | ||
116 | //------------------------------------------------------------------------- | ||
117 | // Member Data | ||
118 | //------------------------------------------------------------------------- | ||
119 | LLCharacter *mCharacter; | ||
120 | LLJoint* mLeftAnkleJoint; | ||
121 | LLJoint* mRightAnkleJoint; | ||
122 | LLJointState mPelvisState; | ||
123 | LLJoint* mPelvisJoint; | ||
124 | LLVector3d mLastLeftAnklePos; | ||
125 | LLVector3d mLastRightAnklePos; | ||
126 | F32 mLastTime; | ||
127 | F32 mAvgCorrection; | ||
128 | F32 mSpeedAdjust; | ||
129 | F32 mAnimSpeed; | ||
130 | F32 mAvgSpeed; | ||
131 | F32 mRelativeDir; | ||
132 | LLVector3 mPelvisOffset; | ||
133 | F32 mAnkleOffset; | ||
134 | }; | ||
135 | |||
136 | class LLFlyAdjustMotion : public LLMotion | ||
137 | { | ||
138 | public: | ||
139 | // Constructor | ||
140 | LLFlyAdjustMotion(const LLUUID &id) : LLMotion(id) {mName = "fly_adjust";} | ||
141 | |||
142 | public: | ||
143 | //------------------------------------------------------------------------- | ||
144 | // functions to support MotionController and MotionRegistry | ||
145 | //------------------------------------------------------------------------- | ||
146 | |||
147 | // static constructor | ||
148 | // all subclasses must implement such a function and register it | ||
149 | static LLMotion *create(const LLUUID &id) { return new LLFlyAdjustMotion(id); } | ||
150 | |||
151 | public: | ||
152 | //------------------------------------------------------------------------- | ||
153 | // animation callbacks to be implemented by subclasses | ||
154 | //------------------------------------------------------------------------- | ||
155 | virtual LLMotionInitStatus onInitialize(LLCharacter *character); | ||
156 | virtual BOOL onActivate(); | ||
157 | virtual void onDeactivate() {}; | ||
158 | virtual BOOL onUpdate(F32 time, U8* joint_mask); | ||
159 | virtual LLJoint::JointPriority getPriority(){return LLJoint::HIGHER_PRIORITY;} | ||
160 | virtual BOOL getLoop() { return TRUE; } | ||
161 | virtual F32 getDuration() { return 0.f; } | ||
162 | virtual F32 getEaseInDuration() { return 0.f; } | ||
163 | virtual F32 getEaseOutDuration() { return 0.f; } | ||
164 | virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_FLY_ADJUST; } | ||
165 | virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; } | ||
166 | |||
167 | protected: | ||
168 | //------------------------------------------------------------------------- | ||
169 | // Member Data | ||
170 | //------------------------------------------------------------------------- | ||
171 | LLCharacter *mCharacter; | ||
172 | LLJointState mPelvisState; | ||
173 | F32 mRoll; | ||
174 | }; | ||
175 | |||
176 | #endif // LL_LLKeyframeWalkMotion_H | ||
177 | |||