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/llpose.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 '')
-rw-r--r-- | linden/indra/llcharacter/llpose.h | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/linden/indra/llcharacter/llpose.h b/linden/indra/llcharacter/llpose.h new file mode 100644 index 0000000..12d1640 --- /dev/null +++ b/linden/indra/llcharacter/llpose.h | |||
@@ -0,0 +1,139 @@ | |||
1 | /** | ||
2 | * @file llpose.h | ||
3 | * @brief Implementation of LLPose 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_LLPOSE_H | ||
29 | #define LL_LLPOSE_H | ||
30 | |||
31 | //----------------------------------------------------------------------------- | ||
32 | // Header Files | ||
33 | //----------------------------------------------------------------------------- | ||
34 | #include <string> | ||
35 | |||
36 | #include "linked_lists.h" | ||
37 | #include "llmap.h" | ||
38 | #include "lljointstate.h" | ||
39 | #include "llassoclist.h" | ||
40 | #include "lljoint.h" | ||
41 | #include <map> | ||
42 | |||
43 | |||
44 | //----------------------------------------------------------------------------- | ||
45 | // class LLPose | ||
46 | //----------------------------------------------------------------------------- | ||
47 | class LLPose | ||
48 | { | ||
49 | friend class LLPoseBlender; | ||
50 | protected: | ||
51 | typedef std::map<std::string, LLJointState*> joint_map; | ||
52 | typedef joint_map::iterator joint_map_iterator; | ||
53 | typedef joint_map::value_type joint_map_value_type; | ||
54 | |||
55 | joint_map mJointMap; | ||
56 | F32 mWeight; | ||
57 | joint_map_iterator mListIter; | ||
58 | public: | ||
59 | // Iterate through jointStates | ||
60 | LLJointState *getFirstJointState(); | ||
61 | LLJointState *getNextJointState(); | ||
62 | LLJointState *findJointState(LLJoint *joint); | ||
63 | LLJointState *findJointState(const std::string &name); | ||
64 | public: | ||
65 | // Constructor | ||
66 | LLPose() : mWeight(0.f) {} | ||
67 | // Destructor | ||
68 | ~LLPose(); | ||
69 | // add a joint state in this pose | ||
70 | BOOL addJointState(LLJointState *jointState); | ||
71 | // remove a joint state from this pose | ||
72 | BOOL removeJointState(LLJointState *jointState); | ||
73 | // removes all joint states from this pose | ||
74 | BOOL removeAllJointStates(); | ||
75 | // set weight for all joint states in this pose | ||
76 | void setWeight(F32 weight); | ||
77 | // get weight for this pose | ||
78 | F32 getWeight() const; | ||
79 | // returns number of joint states stored in this pose | ||
80 | S32 getNumJointStates() const; | ||
81 | }; | ||
82 | |||
83 | const S32 JSB_NUM_JOINT_STATES = 4; | ||
84 | |||
85 | class LLJointStateBlender | ||
86 | { | ||
87 | protected: | ||
88 | LLJointState* mJointStates[JSB_NUM_JOINT_STATES]; | ||
89 | S32 mPriorities[JSB_NUM_JOINT_STATES]; | ||
90 | BOOL mAdditiveBlends[JSB_NUM_JOINT_STATES]; | ||
91 | public: | ||
92 | LLJointStateBlender(); | ||
93 | ~LLJointStateBlender(); | ||
94 | void blendJointStates(BOOL apply_now = TRUE); | ||
95 | BOOL addJointState(LLJointState *joint_state, S32 priority, BOOL additive_blend); | ||
96 | void interpolate(F32 u); | ||
97 | void clear(); | ||
98 | void resetCachedJoint(); | ||
99 | |||
100 | public: | ||
101 | LLJoint mJointCache; | ||
102 | }; | ||
103 | |||
104 | class LLMotion; | ||
105 | |||
106 | class LLPoseBlender | ||
107 | { | ||
108 | protected: | ||
109 | LLMap<LLJoint*,LLJointStateBlender*> mJointStateBlenderPool; | ||
110 | LLLinkedList<LLJointStateBlender> mActiveBlenders; | ||
111 | |||
112 | S32 mNextPoseSlot; | ||
113 | LLPose mBlendedPose; | ||
114 | public: | ||
115 | // Constructor | ||
116 | LLPoseBlender(); | ||
117 | // Destructor | ||
118 | ~LLPoseBlender(); | ||
119 | |||
120 | // request motion joint states to be added to pose blender joint state records | ||
121 | BOOL addMotion(LLMotion* motion); | ||
122 | |||
123 | // blend all joint states and apply to skeleton | ||
124 | void blendAndApply(); | ||
125 | |||
126 | // removes all joint state blenders from last time | ||
127 | void clearBlenders(); | ||
128 | |||
129 | // blend all joint states and cache results | ||
130 | void blendAndCache(BOOL reset_cached_joints); | ||
131 | |||
132 | // interpolate all joints towards cached values | ||
133 | void interpolate(F32 u); | ||
134 | |||
135 | LLPose* getBlendedPose() { return &mBlendedPose; } | ||
136 | }; | ||
137 | |||
138 | #endif // LL_LLPOSE_H | ||
139 | |||