Annotation of /trunk/indra/llcharacter/llvisualparam.h
Parent Directory
|
Revision Log
Revision 137 - (view) (download)
| 1 : | mjm | 135 | /** |
| 2 : | * @file llvisualparam.h | ||
| 3 : | * @brief Implementation of LLPolyMesh 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_LLVisualParam_H | ||
| 34 : | #define LL_LLVisualParam_H | ||
| 35 : | |||
| 36 : | #include "v3math.h" | ||
| 37 : | #include "llstring.h" | ||
| 38 : | #include "llxmltree.h" | ||
| 39 : | |||
| 40 : | class LLPolyMesh; | ||
| 41 : | class LLXmlTreeNode; | ||
| 42 : | |||
| 43 : | enum ESex | ||
| 44 : | { | ||
| 45 : | SEX_FEMALE = 0x01, | ||
| 46 : | SEX_MALE = 0x02, | ||
| 47 : | SEX_BOTH = 0x03 // values chosen to allow use as a bit field. | ||
| 48 : | }; | ||
| 49 : | |||
| 50 : | enum EVisualParamGroup | ||
| 51 : | { | ||
| 52 : | VISUAL_PARAM_GROUP_TWEAKABLE, | ||
| 53 : | VISUAL_PARAM_GROUP_ANIMATABLE, | ||
| 54 : | NUM_VISUAL_PARAM_GROUPS | ||
| 55 : | }; | ||
| 56 : | |||
| 57 : | const S32 MAX_TRANSMITTED_VISUAL_PARAMS = 255; | ||
| 58 : | |||
| 59 : | //----------------------------------------------------------------------------- | ||
| 60 : | // LLVisualParamInfo | ||
| 61 : | // Contains shared data for VisualParams | ||
| 62 : | //----------------------------------------------------------------------------- | ||
| 63 : | class LLVisualParamInfo | ||
| 64 : | { | ||
| 65 : | friend class LLVisualParam; | ||
| 66 : | public: | ||
| 67 : | LLVisualParamInfo(); | ||
| 68 : | virtual ~LLVisualParamInfo() {}; | ||
| 69 : | |||
| 70 : | virtual BOOL parseXml(LLXmlTreeNode *node); | ||
| 71 : | |||
| 72 : | protected: | ||
| 73 : | S32 mID; // ID associated with VisualParam | ||
| 74 : | |||
| 75 : | std::string mName; // name (for internal purposes) | ||
| 76 : | std::string mDisplayName; // name displayed to the user | ||
| 77 : | std::string mMinName; // name associated with minimum value | ||
| 78 : | std::string mMaxName; // name associated with maximum value | ||
| 79 : | EVisualParamGroup mGroup; // morph group for separating UI controls | ||
| 80 : | F32 mMinWeight; // minimum weight that can be assigned to this morph target | ||
| 81 : | F32 mMaxWeight; // maximum weight that can be assigned to this morph target | ||
| 82 : | F32 mDefaultWeight; | ||
| 83 : | ESex mSex; // Which gender(s) this param applies to. | ||
| 84 : | }; | ||
| 85 : | |||
| 86 : | //----------------------------------------------------------------------------- | ||
| 87 : | // LLVisualParam | ||
| 88 : | // VIRTUAL CLASS | ||
| 89 : | // An interface class for a generalized parametric modification of the avatar mesh | ||
| 90 : | // Contains data that is specific to each Avatar | ||
| 91 : | //----------------------------------------------------------------------------- | ||
| 92 : | class LLVisualParam | ||
| 93 : | { | ||
| 94 : | public: | ||
| 95 : | LLVisualParam(); | ||
| 96 : | virtual ~LLVisualParam(); | ||
| 97 : | |||
| 98 : | // Special: These functions are overridden by child classes | ||
| 99 : | // (They can not be virtual because they use specific derived Info classes) | ||
| 100 : | LLVisualParamInfo* getInfo() const { return mInfo; } | ||
| 101 : | // This sets mInfo and calls initialization functions | ||
| 102 : | BOOL setInfo(LLVisualParamInfo *info); | ||
| 103 : | |||
| 104 : | // Virtual functions | ||
| 105 : | // Pure virtuals | ||
| 106 : | //virtual BOOL parseData( LLXmlTreeNode *node ) = 0; | ||
| 107 : | virtual void apply( ESex avatar_sex ) = 0; | ||
| 108 : | // Default functions | ||
| 109 : | virtual void setWeight(F32 weight, BOOL set_by_user); | ||
| 110 : | virtual void setAnimationTarget( F32 target_value, BOOL set_by_user ); | ||
| 111 : | virtual void animate(F32 delta, BOOL set_by_user); | ||
| 112 : | virtual void stopAnimating(BOOL set_by_user); | ||
| 113 : | |||
| 114 : | // Interface methods | ||
| 115 : | S32 getID() { return mID; } | ||
| 116 : | void setID(S32 id) { llassert(!mInfo); mID = id; } | ||
| 117 : | |||
| 118 : | const std::string& getName() const { return mInfo->mName; } | ||
| 119 : | const std::string& getDisplayName() const { return mInfo->mDisplayName; } | ||
| 120 : | const std::string& getMaxDisplayName() const { return mInfo->mMaxName; } | ||
| 121 : | const std::string& getMinDisplayName() const { return mInfo->mMinName; } | ||
| 122 : | |||
| 123 : | void setDisplayName(const std::string& s) { mInfo->mDisplayName = s; } | ||
| 124 : | void setMaxDisplayName(const std::string& s) { mInfo->mMaxName = s; } | ||
| 125 : | void setMinDisplayName(const std::string& s) { mInfo->mMinName = s; } | ||
| 126 : | |||
| 127 : | EVisualParamGroup getGroup() { return mInfo->mGroup; } | ||
| 128 : | F32 getMinWeight() { return mInfo->mMinWeight; } | ||
| 129 : | F32 getMaxWeight() { return mInfo->mMaxWeight; } | ||
| 130 : | F32 getDefaultWeight() { return mInfo->mDefaultWeight; } | ||
| 131 : | ESex getSex() { return mInfo->mSex; } | ||
| 132 : | |||
| 133 : | F32 getWeight() { return mIsAnimating ? mTargetWeight : mCurWeight; } | ||
| 134 : | F32 getCurrentWeight() { return mCurWeight; } | ||
| 135 : | F32 getLastWeight() { return mLastWeight; } | ||
| 136 : | BOOL isAnimating() { return mIsAnimating; } | ||
| 137 : | |||
| 138 : | LLVisualParam* getNextParam() { return mNext; } | ||
| 139 : | void setNextParam( LLVisualParam *next ); | ||
| 140 : | |||
| 141 : | virtual void setAnimating(BOOL is_animating) { mIsAnimating = is_animating; } | ||
| 142 : | BOOL getAnimating() { return mIsAnimating; } | ||
| 143 : | |||
| 144 : | protected: | ||
| 145 : | F32 mCurWeight; // current weight | ||
| 146 : | F32 mLastWeight; // last weight | ||
| 147 : | LLVisualParam* mNext; // next param in a shared chain | ||
| 148 : | F32 mTargetWeight; // interpolation target | ||
| 149 : | BOOL mIsAnimating; // this value has been given an interpolation target | ||
| 150 : | |||
| 151 : | S32 mID; // id for storing weight/morphtarget compares compactly | ||
| 152 : | LLVisualParamInfo *mInfo; | ||
| 153 : | }; | ||
| 154 : | |||
| 155 : | #endif // LL_LLVisualParam_H |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

