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