Annotation of /trunk/indra/llcharacter/llpose.h
Parent Directory
|
Revision Log
Revision 137 - (view) (download)
| 1 : | mjm | 135 | /** |
| 2 : | * @file llpose.h | ||
| 3 : | * @brief Implementation of LLPose class. | ||
| 4 : | * | ||
| 5 : | * $LicenseInfo:firstyear=2001&license=viewergpl$ | ||
| 6 : | * | ||
| 7 : | mjm | 137 | * Copyright (c) 2001-2010, Linden Research, Inc. |
| 8 : | mjm | 135 | * |
| 9 : | * Second Life Viewer Source Code | ||
| 10 : | * The source code in this file ("Source Code") is provided by Linden Lab | ||
| 11 : | * to you under the terms of the GNU General Public License, version 2.0 | ||
| 12 : | * ("GPL"), unless you have obtained a separate licensing agreement | ||
| 13 : | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
| 14 : | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
| 15 : | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
| 16 : | * | ||
| 17 : | * There are special exceptions to the terms and conditions of the GPL as | ||
| 18 : | * it is applied to this Source Code. View the full text of the exception | ||
| 19 : | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
| 20 : | * online at | ||
| 21 : | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
| 22 : | * | ||
| 23 : | * By copying, modifying or distributing this software, you acknowledge | ||
| 24 : | * that you have read and understood your obligations described above, | ||
| 25 : | * and agree to abide by those obligations. | ||
| 26 : | * | ||
| 27 : | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
| 28 : | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
| 29 : | * COMPLETENESS OR PERFORMANCE. | ||
| 30 : | * $/LicenseInfo$ | ||
| 31 : | */ | ||
| 32 : | |||
| 33 : | #ifndef LL_LLPOSE_H | ||
| 34 : | #define LL_LLPOSE_H | ||
| 35 : | |||
| 36 : | //----------------------------------------------------------------------------- | ||
| 37 : | // Header Files | ||
| 38 : | //----------------------------------------------------------------------------- | ||
| 39 : | #include <string> | ||
| 40 : | |||
| 41 : | #include "llmap.h" | ||
| 42 : | #include "lljointstate.h" | ||
| 43 : | #include "lljoint.h" | ||
| 44 : | #include <map> | ||
| 45 : | |||
| 46 : | |||
| 47 : | //----------------------------------------------------------------------------- | ||
| 48 : | // class LLPose | ||
| 49 : | //----------------------------------------------------------------------------- | ||
| 50 : | class LLPose | ||
| 51 : | { | ||
| 52 : | friend class LLPoseBlender; | ||
| 53 : | protected: | ||
| 54 : | typedef std::map<std::string, LLPointer<LLJointState> > joint_map; | ||
| 55 : | typedef joint_map::iterator joint_map_iterator; | ||
| 56 : | typedef joint_map::value_type joint_map_value_type; | ||
| 57 : | |||
| 58 : | joint_map mJointMap; | ||
| 59 : | F32 mWeight; | ||
| 60 : | joint_map_iterator mListIter; | ||
| 61 : | public: | ||
| 62 : | // Iterate through jointStates | ||
| 63 : | LLJointState* getFirstJointState(); | ||
| 64 : | LLJointState* getNextJointState(); | ||
| 65 : | LLJointState* findJointState(LLJoint *joint); | ||
| 66 : | LLJointState* findJointState(const std::string &name); | ||
| 67 : | public: | ||
| 68 : | // Constructor | ||
| 69 : | LLPose() : mWeight(0.f) {} | ||
| 70 : | // Destructor | ||
| 71 : | ~LLPose(); | ||
| 72 : | // add a joint state in this pose | ||
| 73 : | BOOL addJointState(const LLPointer<LLJointState>& jointState); | ||
| 74 : | // remove a joint state from this pose | ||
| 75 : | BOOL removeJointState(const LLPointer<LLJointState>& jointState); | ||
| 76 : | // removes all joint states from this pose | ||
| 77 : | BOOL removeAllJointStates(); | ||
| 78 : | // set weight for all joint states in this pose | ||
| 79 : | void setWeight(F32 weight); | ||
| 80 : | // get weight for this pose | ||
| 81 : | F32 getWeight() const; | ||
| 82 : | // returns number of joint states stored in this pose | ||
| 83 : | S32 getNumJointStates() const; | ||
| 84 : | }; | ||
| 85 : | |||
| 86 : | const S32 JSB_NUM_JOINT_STATES = 6; | ||
| 87 : | |||
| 88 : | class LLJointStateBlender | ||
| 89 : | { | ||
| 90 : | protected: | ||
| 91 : | LLPointer<LLJointState> mJointStates[JSB_NUM_JOINT_STATES]; | ||
| 92 : | S32 mPriorities[JSB_NUM_JOINT_STATES]; | ||
| 93 : | BOOL mAdditiveBlends[JSB_NUM_JOINT_STATES]; | ||
| 94 : | public: | ||
| 95 : | LLJointStateBlender(); | ||
| 96 : | ~LLJointStateBlender(); | ||
| 97 : | void blendJointStates(BOOL apply_now = TRUE); | ||
| 98 : | BOOL addJointState(const LLPointer<LLJointState>& joint_state, S32 priority, BOOL additive_blend); | ||
| 99 : | void interpolate(F32 u); | ||
| 100 : | void clear(); | ||
| 101 : | void resetCachedJoint(); | ||
| 102 : | |||
| 103 : | public: | ||
| 104 : | LLJoint mJointCache; | ||
| 105 : | }; | ||
| 106 : | |||
| 107 : | class LLMotion; | ||
| 108 : | |||
| 109 : | class LLPoseBlender | ||
| 110 : | { | ||
| 111 : | protected: | ||
| 112 : | typedef std::list<LLJointStateBlender*> blender_list_t; | ||
| 113 : | typedef std::map<LLJoint*,LLJointStateBlender*> blender_map_t; | ||
| 114 : | blender_map_t mJointStateBlenderPool; | ||
| 115 : | blender_list_t mActiveBlenders; | ||
| 116 : | |||
| 117 : | S32 mNextPoseSlot; | ||
| 118 : | LLPose mBlendedPose; | ||
| 119 : | public: | ||
| 120 : | // Constructor | ||
| 121 : | LLPoseBlender(); | ||
| 122 : | // Destructor | ||
| 123 : | ~LLPoseBlender(); | ||
| 124 : | |||
| 125 : | // request motion joint states to be added to pose blender joint state records | ||
| 126 : | BOOL addMotion(LLMotion* motion); | ||
| 127 : | |||
| 128 : | // blend all joint states and apply to skeleton | ||
| 129 : | void blendAndApply(); | ||
| 130 : | |||
| 131 : | // removes all joint state blenders from last time | ||
| 132 : | void clearBlenders(); | ||
| 133 : | |||
| 134 : | // blend all joint states and cache results | ||
| 135 : | void blendAndCache(BOOL reset_cached_joints); | ||
| 136 : | |||
| 137 : | // interpolate all joints towards cached values | ||
| 138 : | void interpolate(F32 u); | ||
| 139 : | |||
| 140 : | LLPose* getBlendedPose() { return &mBlendedPose; } | ||
| 141 : | }; | ||
| 142 : | |||
| 143 : | #endif // LL_LLPOSE_H | ||
| 144 : |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

