diff options
Diffstat (limited to 'linden/indra/newview/llvoavatardefines.h')
-rw-r--r-- | linden/indra/newview/llvoavatardefines.h | 210 |
1 files changed, 210 insertions, 0 deletions
diff --git a/linden/indra/newview/llvoavatardefines.h b/linden/indra/newview/llvoavatardefines.h new file mode 100644 index 0000000..1da27b0 --- /dev/null +++ b/linden/indra/newview/llvoavatardefines.h | |||
@@ -0,0 +1,210 @@ | |||
1 | /** | ||
2 | * @file llvoavatar.h | ||
3 | * @brief Declaration of LLVOAvatar class which is a derivation fo | ||
4 | * LLViewerObject | ||
5 | * | ||
6 | * $LicenseInfo:firstyear=2001&license=viewergpl$ | ||
7 | * | ||
8 | * Copyright (c) 2001-2009, Linden Research, Inc. | ||
9 | * | ||
10 | * Second Life Viewer Source Code | ||
11 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
12 | * to you under the terms of the GNU General Public License, version 2.0 | ||
13 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
14 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
15 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
16 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
17 | * | ||
18 | * There are special exceptions to the terms and conditions of the GPL as | ||
19 | * it is applied to this Source Code. View the full text of the exception | ||
20 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
21 | * online at | ||
22 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
23 | * | ||
24 | * By copying, modifying or distributing this software, you acknowledge | ||
25 | * that you have read and understood your obligations described above, | ||
26 | * and agree to abide by those obligations. | ||
27 | * | ||
28 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
30 | * COMPLETENESS OR PERFORMANCE. | ||
31 | * $/LicenseInfo$ | ||
32 | */ | ||
33 | |||
34 | #ifndef LLVOAVATAR_DEFINES_H | ||
35 | #define LLVOAVATAR_DEFINES_H | ||
36 | |||
37 | #include <vector> | ||
38 | #include "llwearable.h" | ||
39 | #include "llviewerjoint.h" | ||
40 | |||
41 | namespace LLVOAvatarDefines | ||
42 | { | ||
43 | |||
44 | extern const S32 SCRATCH_TEX_WIDTH; | ||
45 | extern const S32 SCRATCH_TEX_HEIGHT; | ||
46 | extern const S32 IMPOSTOR_PERIOD; | ||
47 | |||
48 | //-------------------------------------------------------------------- | ||
49 | // texture entry assignment | ||
50 | //-------------------------------------------------------------------- | ||
51 | enum ETextureIndex | ||
52 | { | ||
53 | TEX_HEAD_BODYPAINT = 0, | ||
54 | TEX_UPPER_SHIRT, | ||
55 | TEX_LOWER_PANTS, | ||
56 | TEX_EYES_IRIS, | ||
57 | TEX_HAIR, | ||
58 | TEX_UPPER_BODYPAINT, | ||
59 | TEX_LOWER_BODYPAINT, | ||
60 | TEX_LOWER_SHOES, | ||
61 | TEX_HEAD_BAKED, // Pre-composited | ||
62 | TEX_UPPER_BAKED, // Pre-composited | ||
63 | TEX_LOWER_BAKED, // Pre-composited | ||
64 | TEX_EYES_BAKED, // Pre-composited | ||
65 | TEX_LOWER_SOCKS, | ||
66 | TEX_UPPER_JACKET, | ||
67 | TEX_LOWER_JACKET, | ||
68 | TEX_UPPER_GLOVES, | ||
69 | TEX_UPPER_UNDERSHIRT, | ||
70 | TEX_LOWER_UNDERPANTS, | ||
71 | TEX_SKIRT, | ||
72 | TEX_SKIRT_BAKED, // Pre-composited | ||
73 | TEX_HAIR_BAKED, // Pre-composited | ||
74 | TEX_NUM_INDICES | ||
75 | }; // "Note: if TEX_NUM_ENTRIES changes, update AGENT_TEXTURES in llagentinfo.h, mTextureIndexBaked, and BAKED_TEXTURE_COUNT" | ||
76 | // Seraph - Above comment about order is probably obsolete. | ||
77 | |||
78 | typedef std::vector<ETextureIndex> texture_vec_t; | ||
79 | |||
80 | enum EBakedTextureIndex | ||
81 | { | ||
82 | BAKED_HEAD = 0, | ||
83 | BAKED_UPPER, | ||
84 | BAKED_LOWER, | ||
85 | BAKED_EYES, | ||
86 | BAKED_SKIRT, | ||
87 | BAKED_HAIR, | ||
88 | BAKED_NUM_INDICES | ||
89 | }; | ||
90 | typedef std::vector<EBakedTextureIndex> bakedtexture_vec_t; | ||
91 | |||
92 | // Reference IDs for each mesh. Used as indices for vector of joints | ||
93 | enum EMeshIndex | ||
94 | { | ||
95 | MESH_ID_HAIR = 0, | ||
96 | MESH_ID_HEAD, | ||
97 | MESH_ID_EYELASH, | ||
98 | MESH_ID_UPPER_BODY, | ||
99 | MESH_ID_LOWER_BODY, | ||
100 | MESH_ID_EYEBALL_LEFT, | ||
101 | MESH_ID_EYEBALL_RIGHT, | ||
102 | MESH_ID_SKIRT, | ||
103 | MESH_ID_NUM_INDICES | ||
104 | }; | ||
105 | typedef std::vector<EMeshIndex> mesh_vec_t; | ||
106 | |||
107 | typedef std::vector<EWearableType> wearables_vec_t; | ||
108 | |||
109 | //-------------------------------------------------------------------------------- | ||
110 | // Convenience Functions | ||
111 | //-------------------------------------------------------------------------------- | ||
112 | |||
113 | // Convert from baked texture to associated texture; e.g. BAKED_HEAD -> TEX_HEAD_BAKED | ||
114 | ETextureIndex getTextureIndex(EBakedTextureIndex t); | ||
115 | |||
116 | |||
117 | |||
118 | //------------------------------------------------------------------------ | ||
119 | // LLVOAvatarDictionary | ||
120 | // | ||
121 | // Holds dictionary static entries for textures, baked textures, meshes, etc.; i.e. | ||
122 | // information that is common to all avatars. | ||
123 | // | ||
124 | // This holds const data - it is initialized once and the contents never change after that. | ||
125 | //------------------------------------------------------------------------ | ||
126 | class LLVOAvatarDictionary : public LLSingleton<LLVOAvatarDictionary> | ||
127 | { | ||
128 | public: | ||
129 | LLVOAvatarDictionary(); | ||
130 | virtual ~LLVOAvatarDictionary(); | ||
131 | |||
132 | struct TextureDictionaryEntry | ||
133 | { | ||
134 | TextureDictionaryEntry(const std::string &name, | ||
135 | bool is_local_texture, | ||
136 | EBakedTextureIndex baked_texture_index = BAKED_NUM_INDICES, | ||
137 | const std::string &default_image_name = "", | ||
138 | EWearableType wearable_type = WT_INVALID); | ||
139 | const std::string mName; | ||
140 | const std::string mDefaultImageName; | ||
141 | const EWearableType mWearableType; | ||
142 | // It's either a local texture xor baked | ||
143 | BOOL mIsLocalTexture; | ||
144 | BOOL mIsBakedTexture; | ||
145 | // If it's a local texture, it may be used by a baked texture | ||
146 | BOOL mIsUsedByBakedTexture; | ||
147 | EBakedTextureIndex mBakedTextureIndex; | ||
148 | }; | ||
149 | |||
150 | struct MeshDictionaryEntry | ||
151 | { | ||
152 | MeshDictionaryEntry(EBakedTextureIndex baked_index, | ||
153 | const std::string &name, | ||
154 | U8 level, | ||
155 | LLViewerJoint::PickName pick); | ||
156 | const std::string mName; // names of mesh types as they are used in avatar_lad.xml | ||
157 | // Levels of Detail for each mesh. Must match levels of detail present in avatar_lad.xml | ||
158 | // Otherwise meshes will be unable to be found, or levels of detail will be ignored | ||
159 | const U8 mLOD; | ||
160 | const EBakedTextureIndex mBakedID; | ||
161 | const LLViewerJoint::PickName mPickName; | ||
162 | }; | ||
163 | |||
164 | struct BakedDictionaryEntry | ||
165 | { | ||
166 | BakedDictionaryEntry(ETextureIndex tex_index, | ||
167 | const std::string &name, | ||
168 | U32 num_local_textures, ... ); | ||
169 | const ETextureIndex mTextureIndex; | ||
170 | const std::string mName; | ||
171 | texture_vec_t mLocalTextures; | ||
172 | }; | ||
173 | |||
174 | struct WearableDictionaryEntry | ||
175 | { | ||
176 | WearableDictionaryEntry(const std::string &hash_name, | ||
177 | U32 num_wearables, ... ); | ||
178 | const LLUUID mHashID; | ||
179 | wearables_vec_t mWearablesVec; | ||
180 | }; | ||
181 | |||
182 | typedef std::map<EBakedTextureIndex, BakedDictionaryEntry*> baked_map_t; | ||
183 | typedef std::map<ETextureIndex, TextureDictionaryEntry*> texture_map_t; | ||
184 | typedef std::map<EMeshIndex, MeshDictionaryEntry*> mesh_map_t; | ||
185 | typedef std::map<EBakedTextureIndex, WearableDictionaryEntry*> wearable_map_t; | ||
186 | |||
187 | const MeshDictionaryEntry *getMesh(EMeshIndex index) const; | ||
188 | const BakedDictionaryEntry *getBakedTexture(EBakedTextureIndex index) const; | ||
189 | const TextureDictionaryEntry *getTexture(ETextureIndex index) const; | ||
190 | const WearableDictionaryEntry *getWearable(EBakedTextureIndex index) const; | ||
191 | |||
192 | const texture_map_t &getTextures() const { return mTextureMap; } | ||
193 | const baked_map_t &getBakedTextures() const { return mBakedTextureMap; } | ||
194 | const mesh_map_t &getMeshes() const { return mMeshMap; } | ||
195 | const wearable_map_t &getWearables() const { return mWearableMap; } | ||
196 | |||
197 | private: | ||
198 | void initData(); | ||
199 | void createAssociations(); | ||
200 | |||
201 | texture_map_t mTextureMap; | ||
202 | baked_map_t mBakedTextureMap; | ||
203 | mesh_map_t mMeshMap; | ||
204 | wearable_map_t mWearableMap; | ||
205 | |||
206 | }; // End LLVOAvatarDictionary | ||
207 | |||
208 | } // End namespace LLVOAvatarDefines | ||
209 | |||
210 | #endif | ||