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/lljoint.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/lljoint.h')
-rw-r--r-- | linden/indra/llcharacter/lljoint.h | 182 |
1 files changed, 182 insertions, 0 deletions
diff --git a/linden/indra/llcharacter/lljoint.h b/linden/indra/llcharacter/lljoint.h new file mode 100644 index 0000000..15b82c2 --- /dev/null +++ b/linden/indra/llcharacter/lljoint.h | |||
@@ -0,0 +1,182 @@ | |||
1 | /** | ||
2 | * @file lljoint.h | ||
3 | * @brief Implementation of LLJoint 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_LLJOINT_H | ||
29 | #define LL_LLJOINT_H | ||
30 | |||
31 | //----------------------------------------------------------------------------- | ||
32 | // Header Files | ||
33 | //----------------------------------------------------------------------------- | ||
34 | #include <string> | ||
35 | |||
36 | #include "linked_lists.h" | ||
37 | #include "v3math.h" | ||
38 | #include "v4math.h" | ||
39 | #include "m4math.h" | ||
40 | #include "llquaternion.h" | ||
41 | #include "xform.h" | ||
42 | #include "lldarray.h" | ||
43 | |||
44 | const S32 LL_CHARACTER_MAX_JOINTS_PER_MESH = 15; | ||
45 | const U32 LL_CHARACTER_MAX_JOINTS = 32; // must be divisible by 4! | ||
46 | const U32 LL_HAND_JOINT_NUM = 31; | ||
47 | const U32 LL_FACE_JOINT_NUM = 30; | ||
48 | const S32 LL_CHARACTER_MAX_PRIORITY = 7; | ||
49 | const F32 LL_MAX_PELVIS_OFFSET = 5.f; | ||
50 | |||
51 | //----------------------------------------------------------------------------- | ||
52 | // class LLJoint | ||
53 | //----------------------------------------------------------------------------- | ||
54 | class LLJoint | ||
55 | { | ||
56 | public: | ||
57 | // priority levels, from highest to lowest | ||
58 | enum JointPriority | ||
59 | { | ||
60 | USE_MOTION_PRIORITY = -1, | ||
61 | LOW_PRIORITY = 0, | ||
62 | MEDIUM_PRIORITY, | ||
63 | HIGH_PRIORITY, | ||
64 | HIGHER_PRIORITY, | ||
65 | HIGHEST_PRIORITY, | ||
66 | ADDITIVE_PRIORITY = LL_CHARACTER_MAX_PRIORITY | ||
67 | }; | ||
68 | |||
69 | enum DirtyFlags | ||
70 | { | ||
71 | MATRIX_DIRTY = 0x1 << 0, | ||
72 | ROTATION_DIRTY = 0x1 << 1, | ||
73 | POSITION_DIRTY = 0x1 << 2, | ||
74 | ALL_DIRTY = 0x7 | ||
75 | }; | ||
76 | protected: | ||
77 | std::string mName; | ||
78 | |||
79 | // parent joint | ||
80 | LLJoint *mParent; | ||
81 | |||
82 | // explicit transformation members | ||
83 | LLXformMatrix mXform; | ||
84 | |||
85 | public: | ||
86 | U32 mDirtyFlags; | ||
87 | BOOL mWorldRotationDirty; | ||
88 | BOOL mUpdateXform; | ||
89 | |||
90 | // describes the skin binding pose | ||
91 | LLVector3 mSkinOffset; | ||
92 | |||
93 | S32 mJointNum; | ||
94 | |||
95 | LLDynamicArray<LLVector3> mConstraintSilhouette; | ||
96 | |||
97 | // child joints | ||
98 | LLLinkedList<LLJoint> mChildren; | ||
99 | |||
100 | // debug statics | ||
101 | static S32 sNumTouches; | ||
102 | static S32 sNumUpdates; | ||
103 | |||
104 | public: | ||
105 | LLJoint(); | ||
106 | LLJoint( const std::string &name, LLJoint *parent=NULL ); | ||
107 | |||
108 | virtual ~LLJoint(); | ||
109 | |||
110 | // set name and parent | ||
111 | void setup( const std::string &name, LLJoint *parent=NULL ); | ||
112 | |||
113 | void touch(U32 flags = ALL_DIRTY); | ||
114 | |||
115 | // get/set name | ||
116 | const std::string &getName() { return mName; } | ||
117 | void setName( const std::string &name ) { mName = name; } | ||
118 | |||
119 | // getParent | ||
120 | LLJoint *getParent() { return mParent; } | ||
121 | |||
122 | // getRoot | ||
123 | LLJoint *getRoot(); | ||
124 | |||
125 | // search for child joints by name | ||
126 | LLJoint *findJoint( const std::string &name ); | ||
127 | |||
128 | // add/remove children | ||
129 | void addChild( LLJoint *joint ); | ||
130 | void removeChild( LLJoint *joint ); | ||
131 | void removeAllChildren(); | ||
132 | |||
133 | // get/set local position | ||
134 | const LLVector3& getPosition(); | ||
135 | void setPosition( const LLVector3& pos ); | ||
136 | |||
137 | // get/set world position | ||
138 | LLVector3 getWorldPosition(); | ||
139 | LLVector3 getLastWorldPosition(); | ||
140 | void setWorldPosition( const LLVector3& pos ); | ||
141 | |||
142 | // get/set local rotation | ||
143 | const LLQuaternion& getRotation(); | ||
144 | void setRotation( const LLQuaternion& rot ); | ||
145 | |||
146 | // get/set world rotation | ||
147 | LLQuaternion getWorldRotation(); | ||
148 | LLQuaternion getLastWorldRotation(); | ||
149 | void setWorldRotation( const LLQuaternion& rot ); | ||
150 | |||
151 | // get/set local scale | ||
152 | const LLVector3& getScale(); | ||
153 | void setScale( const LLVector3& scale ); | ||
154 | |||
155 | // get/set world matrix | ||
156 | const LLMatrix4 &getWorldMatrix(); | ||
157 | void setWorldMatrix( const LLMatrix4& mat ); | ||
158 | |||
159 | void updateWorldMatrixChildren(); | ||
160 | void updateWorldMatrixParent(); | ||
161 | |||
162 | void updateWorldPRSParent(); | ||
163 | |||
164 | void updateWorldMatrix(); | ||
165 | |||
166 | // get/set skin offset | ||
167 | const LLVector3 &getSkinOffset(); | ||
168 | void setSkinOffset( const LLVector3 &offset); | ||
169 | |||
170 | LLXformMatrix *getXform() { return &mXform; } | ||
171 | |||
172 | void setConstraintSilhouette(LLDynamicArray<LLVector3>& silhouette); | ||
173 | |||
174 | void clampRotation(LLQuaternion old_rot, LLQuaternion new_rot); | ||
175 | |||
176 | virtual BOOL isAnimatable() { return TRUE; } | ||
177 | |||
178 | S32 getJointNum() { return mJointNum; } | ||
179 | void setJointNum(S32 joint_num) { mJointNum = joint_num; } | ||
180 | }; | ||
181 | #endif // LL_LLJOINT_H | ||
182 | |||