diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/newview/llvoavatar.cpp | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llvoavatar.cpp | 4079 |
1 files changed, 1563 insertions, 2516 deletions
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp index e29ea78..b06652a 100644 --- a/linden/indra/newview/llvoavatar.cpp +++ b/linden/indra/newview/llvoavatar.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 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 | 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 | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -31,175 +32,116 @@ | |||
31 | 32 | ||
32 | #include "llviewerprecompiledheaders.h" | 33 | #include "llviewerprecompiledheaders.h" |
33 | 34 | ||
34 | #include <algorithm> | ||
35 | #include <vector> | ||
36 | #include "llstl.h" | ||
37 | |||
38 | #include "llvoavatar.h" | 35 | #include "llvoavatar.h" |
39 | 36 | ||
40 | #include "llrender.h" | 37 | #include <stdio.h> |
38 | #include <ctype.h> | ||
39 | |||
41 | #include "audioengine.h" | 40 | #include "audioengine.h" |
42 | #include "imageids.h" | ||
43 | #include "indra_constants.h" | ||
44 | #include "llchat.h" | ||
45 | #include "llfontgl.h" | ||
46 | #include "llprimitive.h" | ||
47 | #include "lltextureentry.h" | ||
48 | #include "message.h" | ||
49 | #include "noise.h" | 41 | #include "noise.h" |
50 | #include "sound_ids.h" | ||
51 | #include "lltimer.h" | ||
52 | #include "timing.h" | ||
53 | 42 | ||
54 | #include "llagent.h" // Get state values from here | 43 | #include "llagent.h" // Get state values from here |
55 | #include "llviewercontrol.h" | 44 | #include "llviewercontrol.h" |
56 | #include "llcriticaldamp.h" | ||
57 | #include "lldir.h" | ||
58 | #include "lldrawable.h" | ||
59 | #include "lldrawpoolavatar.h" | 45 | #include "lldrawpoolavatar.h" |
60 | #include "lldrawpoolalpha.h" | ||
61 | #include "lldrawpoolbump.h" | ||
62 | #include "lldriverparam.h" | 46 | #include "lldriverparam.h" |
63 | #include "lleditingmotion.h" | 47 | #include "lleditingmotion.h" |
64 | #include "llemote.h" | 48 | #include "llemote.h" |
65 | #include "llface.h" | ||
66 | #include "llfasttimer.h" | ||
67 | #include "llfirstuse.h" | 49 | #include "llfirstuse.h" |
68 | #include "llfloatercustomize.h" | ||
69 | #include "llfloatertools.h" | ||
70 | #include "llgldbg.h" | ||
71 | #include "llhandmotion.h" | ||
72 | #include "llheadrotmotion.h" | 50 | #include "llheadrotmotion.h" |
73 | #include "llhudeffectbeam.h" | ||
74 | #include "llhudeffectlookat.h" | ||
75 | #include "llhudeffecttrail.h" | 51 | #include "llhudeffecttrail.h" |
76 | #include "llhudmanager.h" | 52 | #include "llhudmanager.h" |
77 | #include "llhudtext.h" | ||
78 | #include "llinventorymodel.h" | ||
79 | #include "llinventoryview.h" | 53 | #include "llinventoryview.h" |
80 | #include "llkeyframefallmotion.h" | 54 | #include "llkeyframefallmotion.h" |
81 | #include "llkeyframemotion.h" | ||
82 | #include "llkeyframemotionparam.h" | ||
83 | #include "llkeyframestandmotion.h" | 55 | #include "llkeyframestandmotion.h" |
84 | #include "llkeyframewalkmotion.h" | 56 | #include "llkeyframewalkmotion.h" |
85 | #include "llmenugl.h" | ||
86 | #include "llmutelist.h" | 57 | #include "llmutelist.h" |
87 | #include "llnetmap.h" | ||
88 | #include "llnotify.h" | 58 | #include "llnotify.h" |
89 | #include "llquantize.h" | 59 | #include "llquantize.h" |
90 | #include "llregionhandle.h" | 60 | #include "llregionhandle.h" |
91 | #include "llresmgr.h" | 61 | #include "llresmgr.h" |
92 | #include "llselectmgr.h" | 62 | #include "llselectmgr.h" |
93 | #include "llsky.h" | ||
94 | #include "llsprite.h" | 63 | #include "llsprite.h" |
95 | #include "llstatusbar.h" | ||
96 | #include "lltargetingmotion.h" | 64 | #include "lltargetingmotion.h" |
97 | #include "lltexlayer.h" | 65 | #include "lltexlayer.h" |
98 | #include "lltoolgrab.h" // for needsRenderBeam | 66 | #include "lltoolgrab.h" // for needsRenderBeam |
99 | #include "lltoolmgr.h" // for needsRenderBeam | 67 | #include "lltoolmgr.h" // for needsRenderBeam |
100 | #include "lltoolmorph.h" | 68 | #include "lltoolmorph.h" |
101 | #include "llviewercamera.h" | 69 | #include "llviewercamera.h" |
102 | #include "llviewerimagelist.h" | 70 | #include "llviewerimagelist.h" |
103 | #include "llviewerinventory.h" | ||
104 | #include "llviewermenu.h" | 71 | #include "llviewermenu.h" |
105 | #include "llviewerobjectlist.h" | 72 | #include "llviewerobjectlist.h" |
106 | #include "llviewerparcelmgr.h" | 73 | #include "llviewerparcelmgr.h" |
107 | #include "llviewerregion.h" | ||
108 | #include "llviewerstats.h" | 74 | #include "llviewerstats.h" |
109 | #include "llviewerwindow.h" | ||
110 | #include "llvosky.h" | ||
111 | #include "llvovolume.h" | 75 | #include "llvovolume.h" |
112 | #include "llwearable.h" | ||
113 | #include "llwearablelist.h" | ||
114 | #include "llworld.h" | 76 | #include "llworld.h" |
115 | #include "pipeline.h" | 77 | #include "pipeline.h" |
116 | #include "llspatialpartition.h" | ||
117 | #include "llviewershadermgr.h" | 78 | #include "llviewershadermgr.h" |
118 | #include "llappviewer.h" | ||
119 | #include "llsky.h" | 79 | #include "llsky.h" |
120 | #include "llanimstatelabels.h" | 80 | #include "llanimstatelabels.h" |
121 | |||
122 | //#include "vtune/vtuneapi.h" | ||
123 | |||
124 | #include "llgesturemgr.h" //needed to trigger the voice gesticulations | 81 | #include "llgesturemgr.h" //needed to trigger the voice gesticulations |
125 | #include "llvoicevisualizer.h" | ||
126 | #include "llvoiceclient.h" | 82 | #include "llvoiceclient.h" |
83 | #include "llvoicevisualizer.h" // Ventrella | ||
127 | 84 | ||
128 | LLXmlTree LLVOAvatar::sXMLTree; | 85 | #include "boost/lexical_cast.hpp" |
129 | LLXmlTree LLVOAvatar::sSkeletonXMLTree; | ||
130 | LLVOAvatarSkeletonInfo* LLVOAvatar::sSkeletonInfo = NULL; | ||
131 | LLVOAvatarInfo* LLVOAvatar::sAvatarInfo = NULL; | ||
132 | 86 | ||
133 | BOOL gDebugAvatarRotation = FALSE; | 87 | using namespace LLVOAvatarDefines; |
134 | S32 LLVOAvatar::sFreezeCounter = 0 ; | 88 | |
89 | //----------------------------------------------------------------------------- | ||
90 | // Global constants | ||
91 | //----------------------------------------------------------------------------- | ||
92 | const LLUUID ANIM_AGENT_BODY_NOISE = LLUUID("9aa8b0a6-0c6f-9518-c7c3-4f41f2c001ad"); //"body_noise" | ||
93 | const LLUUID ANIM_AGENT_BREATHE_ROT = LLUUID("4c5a103e-b830-2f1c-16bc-224aa0ad5bc8"); //"breathe_rot" | ||
94 | const LLUUID ANIM_AGENT_EDITING = LLUUID("2a8eba1d-a7f8-5596-d44a-b4977bf8c8bb"); //"editing" | ||
95 | const LLUUID ANIM_AGENT_EYE = LLUUID("5c780ea8-1cd1-c463-a128-48c023f6fbea"); //"eye" | ||
96 | const LLUUID ANIM_AGENT_FLY_ADJUST = LLUUID("db95561f-f1b0-9f9a-7224-b12f71af126e"); //"fly_adjust" | ||
97 | const LLUUID ANIM_AGENT_HAND_MOTION = LLUUID("ce986325-0ba7-6e6e-cc24-b17c4b795578"); //"hand_motion" | ||
98 | const LLUUID ANIM_AGENT_HEAD_ROT = LLUUID("e6e8d1dd-e643-fff7-b238-c6b4b056a68d"); //"head_rot" | ||
99 | const LLUUID ANIM_AGENT_PELVIS_FIX = LLUUID("0c5dd2a2-514d-8893-d44d-05beffad208b"); //"pelvis_fix" | ||
100 | const LLUUID ANIM_AGENT_TARGET = LLUUID("0e4896cb-fba4-926c-f355-8720189d5b55"); //"target" | ||
101 | const LLUUID ANIM_AGENT_WALK_ADJUST = LLUUID("829bc85b-02fc-ec41-be2e-74cc6dd7215d"); //"walk_adjust" | ||
135 | 102 | ||
136 | //extern BOOL gVelocityInterpolate; | ||
137 | 103 | ||
138 | //----------------------------------------------------------------------------- | 104 | //----------------------------------------------------------------------------- |
139 | // Constants | 105 | // Constants |
140 | //----------------------------------------------------------------------------- | 106 | //----------------------------------------------------------------------------- |
141 | const F32 MIN_PIXEL_AREA_FOR_COMPOSITE = 1024; | 107 | const std::string AVATAR_DEFAULT_CHAR = "avatar"; |
142 | 108 | ||
143 | F32 SHADOW_OFFSET_AMT = 0.03f; | 109 | const S32 MIN_PIXEL_AREA_FOR_COMPOSITE = 1024; |
110 | const F32 SHADOW_OFFSET_AMT = 0.03f; | ||
144 | 111 | ||
145 | #define DELTA_TIME_MIN 0.01f // we clamp measured deltaTime to this | 112 | const F32 DELTA_TIME_MIN = 0.01f; // we clamp measured deltaTime to this |
146 | #define DELTA_TIME_MAX 0.2f // range to insure stability of computations. | 113 | const F32 DELTA_TIME_MAX = 0.2f; // range to insure stability of computations. |
147 | 114 | ||
148 | const F32 PELVIS_LAG_FLYING = 0.22f;// pelvis follow half life while flying | 115 | const F32 PELVIS_LAG_FLYING = 0.22f;// pelvis follow half life while flying |
149 | |||
150 | const F32 PELVIS_LAG_WALKING = 0.4f; // ...while walking | 116 | const F32 PELVIS_LAG_WALKING = 0.4f; // ...while walking |
151 | |||
152 | const F32 PELVIS_LAG_MOUSELOOK = 0.15f; | 117 | const F32 PELVIS_LAG_MOUSELOOK = 0.15f; |
153 | const F32 MOUSELOOK_PELVIS_FOLLOW_FACTOR = 0.5f; | 118 | const F32 MOUSELOOK_PELVIS_FOLLOW_FACTOR = 0.5f; |
154 | |||
155 | const F32 PELVIS_LAG_WHEN_FOLLOW_CAM_IS_ON = 0.0001f; // not zero! - something gets divided by this! | 119 | const F32 PELVIS_LAG_WHEN_FOLLOW_CAM_IS_ON = 0.0001f; // not zero! - something gets divided by this! |
156 | 120 | ||
157 | #define PELVIS_ROT_THRESHOLD_SLOW 60.0f // amount of deviation allowed between | 121 | const F32 PELVIS_ROT_THRESHOLD_SLOW = 60.0f; // amount of deviation allowed between |
158 | #define PELVIS_ROT_THRESHOLD_FAST 2.0f // the pelvis and the view direction | 122 | const F32 PELVIS_ROT_THRESHOLD_FAST = 2.0f; // the pelvis and the view direction |
159 | // when moving fast & slow | 123 | // when moving fast & slow |
160 | 124 | const F32 TORSO_NOISE_AMOUNT = 1.0f; // Amount of deviation from up-axis, in degrees | |
161 | const F32 MIN_SPEED_PELVIS_FOLLOW = 0.1f; | 125 | const F32 TORSO_NOISE_SPEED = 0.2f; // Time scale factor on torso noise. |
162 | |||
163 | #define TORSO_NOISE_AMOUNT 1.f // Amount of deviation from up-axis, in degrees | ||
164 | #define TORSO_NOISE_SPEED 0.2f // Time scale factor on torso noise. | ||
165 | 126 | ||
166 | const F32 BREATHE_ROT_MOTION_STRENGTH = 0.05f; | 127 | const F32 BREATHE_ROT_MOTION_STRENGTH = 0.05f; |
167 | |||
168 | const F32 BREATHE_SCALE_MOTION_STRENGTH = 0.005f; | 128 | const F32 BREATHE_SCALE_MOTION_STRENGTH = 0.005f; |
169 | 129 | ||
170 | #define PELVIS_NOISE_FACTOR 0.5f // amount of random noise | ||
171 | |||
172 | #define AUDIO_STEP_PRI 0xC0000000 | ||
173 | #define AUDIO_STEP_LO_SPEED 0.01f // as average speed goes from lo to hi, | ||
174 | #define AUDIO_STEP_HI_SPEED 3.0f // from lo to hi | ||
175 | #define AUDIO_STEP_LO_GAIN 0.15f // the resulting gain will ramp linearly | ||
176 | #define AUDIO_STEP_HI_GAIN 0.15f | ||
177 | |||
178 | const F32 DAMPED_MOTION_TIME_SCALE = 0.15f; | ||
179 | |||
180 | const F32 LOOKAT_CAMERA_DIST_SQUARED = 25.f; | ||
181 | |||
182 | #define AVATAR_HEADER "Linden Avatar 1.0" | ||
183 | #define AVATAR_SECTION "[avatar]" | ||
184 | |||
185 | #define AVATAR_DEFAULT_CHAR "avatar" | ||
186 | |||
187 | const F32 MIN_SHADOW_HEIGHT = 0.f; | 130 | const F32 MIN_SHADOW_HEIGHT = 0.f; |
188 | const F32 MAX_SHADOW_HEIGHT = 0.3f; | 131 | const F32 MAX_SHADOW_HEIGHT = 0.3f; |
189 | 132 | ||
190 | #define MIN_REQUIRED_PIXEL_AREA_BODY_NOISE (10000.f) | 133 | const S32 MIN_REQUIRED_PIXEL_AREA_BODY_NOISE = 10000; |
191 | #define MIN_REQUIRED_PIXEL_AREA_BREATHE (10000.f) | 134 | const S32 MIN_REQUIRED_PIXEL_AREA_BREATHE = 10000; |
192 | #define MIN_REQUIRED_PIXEL_AREA_PELVIS_FIX (40.f) | 135 | const S32 MIN_REQUIRED_PIXEL_AREA_PELVIS_FIX = 40; |
193 | 136 | ||
194 | const S32 LOCTEX_IMAGE_SIZE_SELF = 512; | 137 | const S32 TEX_IMAGE_SIZE_SELF = 512; |
195 | const S32 LOCTEX_IMAGE_AREA_SELF = LOCTEX_IMAGE_SIZE_SELF * LOCTEX_IMAGE_SIZE_SELF; | 138 | const S32 TEX_IMAGE_AREA_SELF = TEX_IMAGE_SIZE_SELF * TEX_IMAGE_SIZE_SELF; |
196 | const S32 LOCTEX_IMAGE_SIZE_OTHER = LOCTEX_IMAGE_SIZE_SELF / 4; // The size of local textures for other (!mIsSelf) avatars | 139 | const S32 TEX_IMAGE_SIZE_OTHER = TEX_IMAGE_SIZE_SELF / 4; // The size of local textures for other (!mIsSelf) avatars |
197 | const S32 LOCTEX_IMAGE_AREA_OTHER = LOCTEX_IMAGE_SIZE_OTHER * LOCTEX_IMAGE_SIZE_OTHER; | 140 | const S32 TEX_IMAGE_AREA_OTHER = TEX_IMAGE_SIZE_OTHER * TEX_IMAGE_SIZE_OTHER; |
198 | 141 | ||
199 | const F32 HEAD_MOVEMENT_AVG_TIME = 0.9f; | 142 | const F32 HEAD_MOVEMENT_AVG_TIME = 0.9f; |
200 | 143 | ||
201 | const S32 MORPH_MASK_REQUESTED_DISCARD = 0; | 144 | const S32 MORPH_MASK_REQUESTED_DISCARD = 0; |
202 | const S32 MIN_PIXEL_AREA_BUMP = 500; | ||
203 | 145 | ||
204 | // Discard level at which to switch to baked textures | 146 | // Discard level at which to switch to baked textures |
205 | // Should probably be 4 or 3, but didn't want to change it while change other logic - SJB | 147 | // Should probably be 4 or 3, but didn't want to change it while change other logic - SJB |
@@ -209,95 +151,36 @@ const F32 FOOT_COLLIDE_FUDGE = 0.04f; | |||
209 | 151 | ||
210 | const F32 HOVER_EFFECT_MAX_SPEED = 3.f; | 152 | const F32 HOVER_EFFECT_MAX_SPEED = 3.f; |
211 | const F32 HOVER_EFFECT_STRENGTH = 0.f; | 153 | const F32 HOVER_EFFECT_STRENGTH = 0.f; |
212 | F32 UNDERWATER_EFFECT_STRENGTH = 0.1f; | 154 | const F32 UNDERWATER_EFFECT_STRENGTH = 0.1f; |
213 | const F32 UNDERWATER_FREQUENCY_DAMP = 0.33f; | 155 | const F32 UNDERWATER_FREQUENCY_DAMP = 0.33f; |
214 | const F32 APPEARANCE_MORPH_TIME = 0.65f; | 156 | const F32 APPEARANCE_MORPH_TIME = 0.65f; |
215 | const F32 CAMERA_SHAKE_ACCEL_THRESHOLD_SQUARED = 5.f * 5.f; | ||
216 | const F32 TIME_BEFORE_MESH_CLEANUP = 5.f; // seconds | 157 | const F32 TIME_BEFORE_MESH_CLEANUP = 5.f; // seconds |
217 | const S32 AVATAR_RELEASE_THRESHOLD = 10; // number of avatar instances before releasing memory | 158 | const S32 AVATAR_RELEASE_THRESHOLD = 10; // number of avatar instances before releasing memory |
218 | const F32 FOOT_GROUND_COLLISION_TOLERANCE = 0.25f; | 159 | const F32 FOOT_GROUND_COLLISION_TOLERANCE = 0.25f; |
219 | const F32 AVATAR_LOD_TWEAK_RANGE = 0.7f; | 160 | const F32 AVATAR_LOD_TWEAK_RANGE = 0.7f; |
220 | const S32 MAX_LOD_CHANGES_PER_FRAME = 2; | ||
221 | const S32 MAX_BUBBLE_CHAT_LENGTH = 1023; | 161 | const S32 MAX_BUBBLE_CHAT_LENGTH = 1023; |
222 | const S32 MAX_BUBBLE_CHAT_UTTERANCES = 12; | 162 | const S32 MAX_BUBBLE_CHAT_UTTERANCES = 12; |
223 | const F32 CHAT_FADE_TIME = 8.0; | 163 | const F32 CHAT_FADE_TIME = 8.0; |
224 | const F32 BUBBLE_CHAT_TIME = CHAT_FADE_TIME * 3.f; | 164 | const F32 BUBBLE_CHAT_TIME = CHAT_FADE_TIME * 3.f; |
225 | const S32 MAX_BUBBLES = 7; | ||
226 | 165 | ||
227 | S32 LLVOAvatar::sMaxVisible = 50; | 166 | const LLColor4 DUMMY_COLOR = LLColor4(0.5,0.5,0.5,1.0); |
228 | 167 | ||
229 | LLVOAvatar::ETextureIndex LLVOAvatar::sBakedTextureIndices[BAKED_TEXTURE_COUNT] = | 168 | enum ERenderName |
230 | { | 169 | { |
231 | LLVOAvatar::TEX_HEAD_BAKED, | 170 | RENDER_NAME_NEVER, |
232 | LLVOAvatar::TEX_UPPER_BAKED, | 171 | RENDER_NAME_FADE, |
233 | LLVOAvatar::TEX_LOWER_BAKED, | 172 | RENDER_NAME_ALWAYS |
234 | LLVOAvatar::TEX_EYES_BAKED, | ||
235 | LLVOAvatar::TEX_SKIRT_BAKED | ||
236 | }; | 173 | }; |
237 | 174 | ||
238 | //----------------------------------------------------------------------------- | 175 | //----------------------------------------------------------------------------- |
239 | // Utility functions | 176 | // Callback data |
240 | //----------------------------------------------------------------------------- | ||
241 | |||
242 | static F32 calc_bouncy_animation(F32 x) | ||
243 | { | ||
244 | return -(cosf(x * F_PI * 2.5f - F_PI_BY_TWO))*(0.4f + x * -0.1f) + x * 1.3f; | ||
245 | } | ||
246 | |||
247 | BOOL LLLineSegmentCapsuleIntersect(const LLVector3& start, const LLVector3& end, const LLVector3& p1, const LLVector3& p2, const F32& radius, LLVector3& result) | ||
248 | { | ||
249 | return FALSE; | ||
250 | } | ||
251 | |||
252 | //----------------------------------------------------------------------------- | ||
253 | // Static Data | ||
254 | //----------------------------------------------------------------------------- | 177 | //----------------------------------------------------------------------------- |
255 | S32 LLVOAvatar::sMaxOtherAvatarsToComposite = 1; // Only this many avatars (other than yourself) can be composited at a time. Set in initClass(). | ||
256 | LLMap< LLGLenum, LLGLuint*> LLVOAvatar::sScratchTexNames; | ||
257 | LLMap< LLGLenum, F32*> LLVOAvatar::sScratchTexLastBindTime; | ||
258 | S32 LLVOAvatar::sScratchTexBytes = 0; | ||
259 | F32 LLVOAvatar::sRenderDistance = 256.f; | ||
260 | S32 LLVOAvatar::sNumVisibleAvatars = 0; | ||
261 | S32 LLVOAvatar::sNumLODChangesThisFrame = 0; | ||
262 | |||
263 | LLUUID LLVOAvatar::sStepSoundOnLand = LLUUID("e8af4a28-aa83-4310-a7c4-c047e15ea0df"); | ||
264 | LLUUID LLVOAvatar::sStepSounds[LL_MCODE_END] = | ||
265 | { | ||
266 | LLUUID(SND_STONE_RUBBER), | ||
267 | LLUUID(SND_METAL_RUBBER), | ||
268 | LLUUID(SND_GLASS_RUBBER), | ||
269 | LLUUID(SND_WOOD_RUBBER), | ||
270 | LLUUID(SND_FLESH_RUBBER), | ||
271 | LLUUID(SND_RUBBER_PLASTIC), | ||
272 | LLUUID(SND_RUBBER_RUBBER) | ||
273 | }; | ||
274 | |||
275 | // static | ||
276 | S32 LLVOAvatar::sRenderName = RENDER_NAME_ALWAYS; | ||
277 | BOOL LLVOAvatar::sRenderGroupTitles = TRUE; | ||
278 | S32 LLVOAvatar::sNumVisibleChatBubbles = 0; | ||
279 | BOOL LLVOAvatar::sDebugInvisible = FALSE; | ||
280 | BOOL LLVOAvatar::sShowAttachmentPoints = FALSE; | ||
281 | BOOL LLVOAvatar::sShowAnimationDebug = FALSE; | ||
282 | BOOL LLVOAvatar::sShowFootPlane = FALSE; | ||
283 | BOOL LLVOAvatar::sShowCollisionVolumes = FALSE; | ||
284 | BOOL LLVOAvatar::sVisibleInFirstPerson = FALSE; | ||
285 | F32 LLVOAvatar::sLODFactor = 1.f; | ||
286 | BOOL LLVOAvatar::sUseImpostors = FALSE; | ||
287 | BOOL LLVOAvatar::sJointDebug = FALSE; | ||
288 | S32 LLVOAvatar::sCurJoint = 0; | ||
289 | S32 LLVOAvatar::sCurVolume = 0; | ||
290 | F32 LLVOAvatar::sUnbakedTime = 0.f; | ||
291 | F32 LLVOAvatar::sUnbakedUpdateTime = 0.f; | ||
292 | F32 LLVOAvatar::sGreyTime = 0.f; | ||
293 | F32 LLVOAvatar::sGreyUpdateTime = 0.f; | ||
294 | |||
295 | struct LLAvatarTexData | 178 | struct LLAvatarTexData |
296 | { | 179 | { |
297 | LLAvatarTexData( const LLUUID& id, LLVOAvatar::ELocTexIndex index ) | 180 | LLAvatarTexData( const LLUUID& id, ETextureIndex index ) |
298 | : mAvatarID(id), mIndex(index) {} | 181 | : mAvatarID(id), mIndex(index) {} |
299 | LLUUID mAvatarID; | 182 | LLUUID mAvatarID; |
300 | LLVOAvatar::ELocTexIndex mIndex; | 183 | ETextureIndex mIndex; |
301 | }; | 184 | }; |
302 | 185 | ||
303 | struct LLTextureMaskData | 186 | struct LLTextureMaskData |
@@ -308,6 +191,142 @@ struct LLTextureMaskData | |||
308 | S32 mLastDiscardLevel; | 191 | S32 mLastDiscardLevel; |
309 | }; | 192 | }; |
310 | 193 | ||
194 | /********************************************************************************* | ||
195 | ** ** | ||
196 | ** Begin LLVOAvatar Support classes | ||
197 | ** | ||
198 | **/ | ||
199 | |||
200 | //------------------------------------------------------------------------ | ||
201 | // LLVOBoneInfo | ||
202 | // Trans/Scale/Rot etc. info about each avatar bone. Used by LLVOAvatarSkeleton. | ||
203 | //------------------------------------------------------------------------ | ||
204 | class LLVOAvatarBoneInfo | ||
205 | { | ||
206 | friend class LLVOAvatar; | ||
207 | friend class LLVOAvatarSkeletonInfo; | ||
208 | public: | ||
209 | LLVOAvatarBoneInfo() : mIsJoint(FALSE) {} | ||
210 | ~LLVOAvatarBoneInfo() | ||
211 | { | ||
212 | std::for_each(mChildList.begin(), mChildList.end(), DeletePointer()); | ||
213 | } | ||
214 | BOOL parseXml(LLXmlTreeNode* node); | ||
215 | |||
216 | private: | ||
217 | std::string mName; | ||
218 | BOOL mIsJoint; | ||
219 | LLVector3 mPos; | ||
220 | LLVector3 mRot; | ||
221 | LLVector3 mScale; | ||
222 | LLVector3 mPivot; | ||
223 | typedef std::vector<LLVOAvatarBoneInfo*> child_list_t; | ||
224 | child_list_t mChildList; | ||
225 | }; | ||
226 | |||
227 | //------------------------------------------------------------------------ | ||
228 | // LLVOAvatarSkeletonInfo | ||
229 | // Overall avatar skeleton | ||
230 | //------------------------------------------------------------------------ | ||
231 | class LLVOAvatarSkeletonInfo | ||
232 | { | ||
233 | friend class LLVOAvatar; | ||
234 | public: | ||
235 | LLVOAvatarSkeletonInfo() : | ||
236 | mNumBones(0), mNumCollisionVolumes(0) {} | ||
237 | ~LLVOAvatarSkeletonInfo() | ||
238 | { | ||
239 | std::for_each(mBoneInfoList.begin(), mBoneInfoList.end(), DeletePointer()); | ||
240 | } | ||
241 | BOOL parseXml(LLXmlTreeNode* node); | ||
242 | S32 getNumBones() const { return mNumBones; } | ||
243 | S32 getNumCollisionVolumes() const { return mNumCollisionVolumes; } | ||
244 | |||
245 | private: | ||
246 | S32 mNumBones; | ||
247 | S32 mNumCollisionVolumes; | ||
248 | typedef std::vector<LLVOAvatarBoneInfo*> bone_info_list_t; | ||
249 | bone_info_list_t mBoneInfoList; | ||
250 | }; | ||
251 | |||
252 | |||
253 | //------------------------------------------------------------------------ | ||
254 | // LLVOAvatarXmlInfo | ||
255 | // One instance (in LLVOAvatar) with common data parsed from the XML files | ||
256 | //------------------------------------------------------------------------ | ||
257 | class LLVOAvatarXmlInfo | ||
258 | { | ||
259 | friend class LLVOAvatar; | ||
260 | public: | ||
261 | LLVOAvatarXmlInfo(); | ||
262 | ~LLVOAvatarXmlInfo(); | ||
263 | |||
264 | private: | ||
265 | BOOL parseXmlSkeletonNode(LLXmlTreeNode* root); | ||
266 | BOOL parseXmlMeshNodes(LLXmlTreeNode* root); | ||
267 | BOOL parseXmlColorNodes(LLXmlTreeNode* root); | ||
268 | BOOL parseXmlLayerNodes(LLXmlTreeNode* root); | ||
269 | BOOL parseXmlDriverNodes(LLXmlTreeNode* root); | ||
270 | |||
271 | struct LLVOAvatarMeshInfo | ||
272 | { | ||
273 | typedef std::pair<LLPolyMorphTargetInfo*,BOOL> morph_info_pair_t; | ||
274 | typedef std::vector<morph_info_pair_t> morph_info_list_t; | ||
275 | |||
276 | LLVOAvatarMeshInfo() : mLOD(0), mMinPixelArea(.1f) {} | ||
277 | ~LLVOAvatarMeshInfo() | ||
278 | { | ||
279 | morph_info_list_t::iterator iter; | ||
280 | for (iter = mPolyMorphTargetInfoList.begin(); iter != mPolyMorphTargetInfoList.end(); iter++) | ||
281 | { | ||
282 | delete iter->first; | ||
283 | } | ||
284 | mPolyMorphTargetInfoList.clear(); | ||
285 | } | ||
286 | |||
287 | std::string mType; | ||
288 | S32 mLOD; | ||
289 | std::string mMeshFileName; | ||
290 | std::string mReferenceMeshName; | ||
291 | F32 mMinPixelArea; | ||
292 | morph_info_list_t mPolyMorphTargetInfoList; | ||
293 | }; | ||
294 | typedef std::vector<LLVOAvatarMeshInfo*> mesh_info_list_t; | ||
295 | mesh_info_list_t mMeshInfoList; | ||
296 | |||
297 | typedef std::vector<LLPolySkeletalDistortionInfo*> skeletal_distortion_info_list_t; | ||
298 | skeletal_distortion_info_list_t mSkeletalDistortionInfoList; | ||
299 | |||
300 | struct LLVOAvatarAttachmentInfo | ||
301 | { | ||
302 | LLVOAvatarAttachmentInfo() | ||
303 | : mGroup(-1), mAttachmentID(-1), mPieMenuSlice(-1), mVisibleFirstPerson(FALSE), | ||
304 | mIsHUDAttachment(FALSE), mHasPosition(FALSE), mHasRotation(FALSE) {} | ||
305 | std::string mName; | ||
306 | std::string mJointName; | ||
307 | LLVector3 mPosition; | ||
308 | LLVector3 mRotationEuler; | ||
309 | S32 mGroup; | ||
310 | S32 mAttachmentID; | ||
311 | S32 mPieMenuSlice; | ||
312 | BOOL mVisibleFirstPerson; | ||
313 | BOOL mIsHUDAttachment; | ||
314 | BOOL mHasPosition; | ||
315 | BOOL mHasRotation; | ||
316 | }; | ||
317 | typedef std::vector<LLVOAvatarAttachmentInfo*> attachment_info_list_t; | ||
318 | attachment_info_list_t mAttachmentInfoList; | ||
319 | |||
320 | LLTexGlobalColorInfo *mTexSkinColorInfo; | ||
321 | LLTexGlobalColorInfo *mTexHairColorInfo; | ||
322 | LLTexGlobalColorInfo *mTexEyeColorInfo; | ||
323 | |||
324 | typedef std::vector<LLTexLayerSetInfo*> layer_info_list_t; | ||
325 | layer_info_list_t mLayerInfoList; | ||
326 | |||
327 | typedef std::vector<LLDriverParamInfo*> driver_info_list_t; | ||
328 | driver_info_list_t mDriverInfoList; | ||
329 | }; | ||
311 | 330 | ||
312 | //----------------------------------------------------------------------------- | 331 | //----------------------------------------------------------------------------- |
313 | // class LLBodyNoiseMotion | 332 | // class LLBodyNoiseMotion |
@@ -321,7 +340,6 @@ public: | |||
321 | : LLMotion(id) | 340 | : LLMotion(id) |
322 | { | 341 | { |
323 | mName = "body_noise"; | 342 | mName = "body_noise"; |
324 | |||
325 | mTorsoState = new LLJointState; | 343 | mTorsoState = new LLJointState; |
326 | } | 344 | } |
327 | 345 | ||
@@ -408,7 +426,7 @@ public: | |||
408 | // called when a motion is deactivated | 426 | // called when a motion is deactivated |
409 | virtual void onDeactivate() {} | 427 | virtual void onDeactivate() {} |
410 | 428 | ||
411 | public: | 429 | private: |
412 | //------------------------------------------------------------------------- | 430 | //------------------------------------------------------------------------- |
413 | // joint states to be animated | 431 | // joint states to be animated |
414 | //------------------------------------------------------------------------- | 432 | //------------------------------------------------------------------------- |
@@ -429,12 +447,11 @@ public: | |||
429 | mCharacter(NULL) | 447 | mCharacter(NULL) |
430 | { | 448 | { |
431 | mName = "breathe_rot"; | 449 | mName = "breathe_rot"; |
432 | |||
433 | mChestState = new LLJointState; | 450 | mChestState = new LLJointState; |
434 | } | 451 | } |
435 | 452 | ||
436 | // Destructor | 453 | // Destructor |
437 | virtual ~LLBreatheMotionRot() { } | 454 | virtual ~LLBreatheMotionRot() {} |
438 | 455 | ||
439 | public: | 456 | public: |
440 | //------------------------------------------------------------------------- | 457 | //------------------------------------------------------------------------- |
@@ -517,7 +534,7 @@ public: | |||
517 | // called when a motion is deactivated | 534 | // called when a motion is deactivated |
518 | virtual void onDeactivate() {} | 535 | virtual void onDeactivate() {} |
519 | 536 | ||
520 | public: | 537 | private: |
521 | //------------------------------------------------------------------------- | 538 | //------------------------------------------------------------------------- |
522 | // joint states to be animated | 539 | // joint states to be animated |
523 | //------------------------------------------------------------------------- | 540 | //------------------------------------------------------------------------- |
@@ -614,7 +631,7 @@ public: | |||
614 | // called when a motion is deactivated | 631 | // called when a motion is deactivated |
615 | virtual void onDeactivate() {} | 632 | virtual void onDeactivate() {} |
616 | 633 | ||
617 | public: | 634 | private: |
618 | //------------------------------------------------------------------------- | 635 | //------------------------------------------------------------------------- |
619 | // joint states to be animated | 636 | // joint states to be animated |
620 | //------------------------------------------------------------------------- | 637 | //------------------------------------------------------------------------- |
@@ -622,20 +639,73 @@ public: | |||
622 | LLCharacter* mCharacter; | 639 | LLCharacter* mCharacter; |
623 | }; | 640 | }; |
624 | 641 | ||
642 | /** | ||
643 | ** | ||
644 | ** End LLVOAvatar Support classes | ||
645 | ** ** | ||
646 | *********************************************************************************/ | ||
647 | |||
648 | |||
649 | //----------------------------------------------------------------------------- | ||
650 | // Static Data | ||
651 | //----------------------------------------------------------------------------- | ||
652 | LLXmlTree LLVOAvatar::sXMLTree; | ||
653 | LLXmlTree LLVOAvatar::sSkeletonXMLTree; | ||
654 | BOOL LLVOAvatar::sDebugAvatarRotation = FALSE; | ||
655 | LLVOAvatarSkeletonInfo* LLVOAvatar::sAvatarSkeletonInfo = NULL; | ||
656 | LLVOAvatarXmlInfo* LLVOAvatar::sAvatarXmlInfo = NULL; | ||
657 | LLVOAvatarDictionary *LLVOAvatar::sAvatarDictionary = NULL; | ||
658 | S32 LLVOAvatar::sFreezeCounter = 0; | ||
659 | S32 LLVOAvatar::sMaxVisible = 50; | ||
660 | LLMap< LLGLenum, LLGLuint*> LLVOAvatar::sScratchTexNames; | ||
661 | LLMap< LLGLenum, F32*> LLVOAvatar::sScratchTexLastBindTime; | ||
662 | S32 LLVOAvatar::sScratchTexBytes = 0; | ||
663 | F32 LLVOAvatar::sRenderDistance = 256.f; | ||
664 | S32 LLVOAvatar::sNumVisibleAvatars = 0; | ||
665 | S32 LLVOAvatar::sNumLODChangesThisFrame = 0; | ||
666 | |||
667 | const LLUUID LLVOAvatar::sStepSoundOnLand = LLUUID("e8af4a28-aa83-4310-a7c4-c047e15ea0df"); | ||
668 | const LLUUID LLVOAvatar::sStepSounds[LL_MCODE_END] = | ||
669 | { | ||
670 | LLUUID(SND_STONE_RUBBER), | ||
671 | LLUUID(SND_METAL_RUBBER), | ||
672 | LLUUID(SND_GLASS_RUBBER), | ||
673 | LLUUID(SND_WOOD_RUBBER), | ||
674 | LLUUID(SND_FLESH_RUBBER), | ||
675 | LLUUID(SND_RUBBER_PLASTIC), | ||
676 | LLUUID(SND_RUBBER_RUBBER) | ||
677 | }; | ||
678 | |||
679 | S32 LLVOAvatar::sRenderName = RENDER_NAME_ALWAYS; | ||
680 | BOOL LLVOAvatar::sRenderGroupTitles = TRUE; | ||
681 | S32 LLVOAvatar::sNumVisibleChatBubbles = 0; | ||
682 | BOOL LLVOAvatar::sDebugInvisible = FALSE; | ||
683 | BOOL LLVOAvatar::sShowAttachmentPoints = FALSE; | ||
684 | BOOL LLVOAvatar::sShowAnimationDebug = FALSE; | ||
685 | BOOL LLVOAvatar::sShowFootPlane = FALSE; | ||
686 | BOOL LLVOAvatar::sVisibleInFirstPerson = FALSE; | ||
687 | F32 LLVOAvatar::sLODFactor = 1.f; | ||
688 | BOOL LLVOAvatar::sUseImpostors = FALSE; | ||
689 | BOOL LLVOAvatar::sJointDebug = FALSE; | ||
690 | |||
691 | F32 LLVOAvatar::sUnbakedTime = 0.f; | ||
692 | F32 LLVOAvatar::sUnbakedUpdateTime = 0.f; | ||
693 | F32 LLVOAvatar::sGreyTime = 0.f; | ||
694 | F32 LLVOAvatar::sGreyUpdateTime = 0.f; | ||
695 | |||
696 | //----------------------------------------------------------------------------- | ||
697 | // Helper functions | ||
698 | //----------------------------------------------------------------------------- | ||
699 | static F32 calc_bouncy_animation(F32 x); | ||
700 | static U32 calc_shame(LLVOVolume* volume, std::set<LLUUID> &textures); | ||
701 | |||
625 | //----------------------------------------------------------------------------- | 702 | //----------------------------------------------------------------------------- |
626 | // LLVOAvatar() | 703 | // LLVOAvatar() |
627 | //----------------------------------------------------------------------------- | 704 | //----------------------------------------------------------------------------- |
628 | LLVOAvatar::LLVOAvatar( | 705 | LLVOAvatar::LLVOAvatar(const LLUUID& id, |
629 | const LLUUID& id, | 706 | const LLPCode pcode, |
630 | const LLPCode pcode, | 707 | LLViewerRegion* regionp) : |
631 | LLViewerRegion* regionp) | ||
632 | : | ||
633 | LLViewerObject(id, pcode, regionp), | 708 | LLViewerObject(id, pcode, regionp), |
634 | mLastHeadBakedID( IMG_DEFAULT_AVATAR ), | ||
635 | mLastUpperBodyBakedID( IMG_DEFAULT_AVATAR ), | ||
636 | mLastLowerBodyBakedID( IMG_DEFAULT_AVATAR ), | ||
637 | mLastEyesBakedID( IMG_DEFAULT_AVATAR ), | ||
638 | mLastSkirtBakedID( IMG_DEFAULT_AVATAR ), | ||
639 | mIsDummy(FALSE), | 709 | mIsDummy(FALSE), |
640 | mSpecialRenderMode(0), | 710 | mSpecialRenderMode(0), |
641 | mTurning(FALSE), | 711 | mTurning(FALSE), |
@@ -653,12 +723,6 @@ LLVOAvatar::LLVOAvatar( | |||
653 | mAppearanceAnimSetByUser(FALSE), | 723 | mAppearanceAnimSetByUser(FALSE), |
654 | mLastAppearanceBlendTime(0.f), | 724 | mLastAppearanceBlendTime(0.f), |
655 | mAppearanceAnimating(FALSE), | 725 | mAppearanceAnimating(FALSE), |
656 | mHeadLayerSet( NULL ), | ||
657 | mUpperBodyLayerSet( NULL ), | ||
658 | mLowerBodyLayerSet( NULL ), | ||
659 | mEyesLayerSet( NULL ), | ||
660 | mSkirtLayerSet( NULL ), | ||
661 | mRenderPriority(1.0f), | ||
662 | mNameString(), | 726 | mNameString(), |
663 | mTitle(), | 727 | mTitle(), |
664 | mNameAway(FALSE), | 728 | mNameAway(FALSE), |
@@ -670,45 +734,43 @@ LLVOAvatar::LLVOAvatar( | |||
670 | mRegionCrossingCount(0), | 734 | mRegionCrossingCount(0), |
671 | mFirstTEMessageReceived( FALSE ), | 735 | mFirstTEMessageReceived( FALSE ), |
672 | mFirstAppearanceMessageReceived( FALSE ), | 736 | mFirstAppearanceMessageReceived( FALSE ), |
673 | mHeadBakedLoaded(FALSE), | ||
674 | mHeadMaskDiscard(-1), | ||
675 | mUpperBakedLoaded(FALSE), | ||
676 | mUpperMaskDiscard(-1), | ||
677 | mLowerBakedLoaded(FALSE), | ||
678 | mLowerMaskDiscard(-1), | ||
679 | mEyesBakedLoaded(FALSE), | ||
680 | mSkirtBakedLoaded(FALSE), | ||
681 | mHeadMaskTexName(0), | ||
682 | mUpperMaskTexName(0), | ||
683 | mLowerMaskTexName(0), | ||
684 | mCulled( FALSE ), | 737 | mCulled( FALSE ), |
685 | mVisibilityRank(0), | 738 | mVisibilityRank(0), |
686 | mFadeTime(0.f), | ||
687 | mLastFadeTime(0.f), | ||
688 | mLastFadeDistance(1.f), | ||
689 | mTexSkinColor( NULL ), | 739 | mTexSkinColor( NULL ), |
690 | mTexHairColor( NULL ), | 740 | mTexHairColor( NULL ), |
691 | mTexEyeColor( NULL ), | 741 | mTexEyeColor( NULL ), |
692 | mNeedsSkin(FALSE), | 742 | mNeedsSkin(FALSE), |
693 | mUpdatePeriod(1), | 743 | mUpdatePeriod(1), |
694 | mFullyLoadedInitialized(FALSE) | 744 | mFullyLoadedInitialized(FALSE), |
745 | mHasBakedHair( FALSE ) | ||
695 | { | 746 | { |
696 | LLMemType mt(LLMemType::MTYPE_AVATAR); | 747 | LLMemType mt(LLMemType::MTYPE_AVATAR); |
697 | |||
698 | //VTResume(); // VTune | 748 | //VTResume(); // VTune |
699 | 749 | ||
700 | // mVoiceVisualizer is created by the hud effects manager and uses the HUD Effects pipeline | 750 | // mVoiceVisualizer is created by the hud effects manager and uses the HUD Effects pipeline |
701 | bool needsSendToSim = false; // currently, this HUD effect doesn't need to pack and unpack data to do its job | 751 | const bool needsSendToSim = false; // currently, this HUD effect doesn't need to pack and unpack data to do its job |
702 | mVoiceVisualizer = ( LLVoiceVisualizer *)LLHUDManager::getInstance()->createViewerEffect( LLHUDObject::LL_HUD_EFFECT_VOICE_VISUALIZER, needsSendToSim ); | 752 | mVoiceVisualizer = ( LLVoiceVisualizer *)LLHUDManager::getInstance()->createViewerEffect( LLHUDObject::LL_HUD_EFFECT_VOICE_VISUALIZER, needsSendToSim ); |
703 | 753 | ||
704 | lldebugs << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << llendl; | 754 | lldebugs << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << llendl; |
705 | 755 | ||
706 | mPelvisp = NULL; | 756 | mPelvisp = NULL; |
707 | 757 | ||
708 | for( S32 i=0; i<LOCTEX_NUM_ENTRIES; i++ ) | 758 | for( S32 i=0; i<TEX_NUM_INDICES; i++ ) |
759 | { | ||
760 | if (isIndexLocalTexture((ETextureIndex)i)) | ||
761 | { | ||
762 | mLocalTextureData[(ETextureIndex)i] = LocalTextureData(); | ||
763 | } | ||
764 | } | ||
765 | |||
766 | mBakedTextureData.resize(BAKED_NUM_INDICES); | ||
767 | for (U32 i = 0; i < mBakedTextureData.size(); i++ ) | ||
709 | { | 768 | { |
710 | mLocalTextureBaked[i] = FALSE; | 769 | mBakedTextureData[i].mLastTextureIndex = IMG_DEFAULT_AVATAR; |
711 | mLocalTextureDiscard[i] = MAX_DISCARD_LEVEL+1; | 770 | mBakedTextureData[i].mTexLayerSet = NULL; |
771 | mBakedTextureData[i].mIsLoaded = false; | ||
772 | mBakedTextureData[i].mMaskTexName = 0; | ||
773 | mBakedTextureData[i].mTextureIndex = getTextureIndex((EBakedTextureIndex)i); | ||
712 | } | 774 | } |
713 | 775 | ||
714 | mDirtyMesh = TRUE; // Dirty geometry, need to regenerate. | 776 | mDirtyMesh = TRUE; // Dirty geometry, need to regenerate. |
@@ -746,7 +808,7 @@ LLVOAvatar::LLVOAvatar( | |||
746 | mImpostorDistance = 0; | 808 | mImpostorDistance = 0; |
747 | mImpostorPixelArea = 0; | 809 | mImpostorPixelArea = 0; |
748 | 810 | ||
749 | setNumTEs(TEX_NUM_ENTRIES); | 811 | setNumTEs(TEX_NUM_INDICES); |
750 | 812 | ||
751 | mbCanSelect = TRUE; | 813 | mbCanSelect = TRUE; |
752 | 814 | ||
@@ -763,7 +825,7 @@ LLVOAvatar::LLVOAvatar( | |||
763 | 825 | ||
764 | mShadowImagep = gImageList.getImageFromFile("foot_shadow.j2c"); | 826 | mShadowImagep = gImageList.getImageFromFile("foot_shadow.j2c"); |
765 | gGL.getTexUnit(0)->bind(mShadowImagep.get()); | 827 | gGL.getTexUnit(0)->bind(mShadowImagep.get()); |
766 | mShadowImagep->setClamp(TRUE, TRUE); | 828 | mShadowImagep->setAddressMode(LLTexUnit::TAM_CLAMP); |
767 | 829 | ||
768 | mInAir = FALSE; | 830 | mInAir = FALSE; |
769 | 831 | ||
@@ -779,118 +841,71 @@ LLVOAvatar::LLVOAvatar( | |||
779 | //------------------------------------------------------------------------- | 841 | //------------------------------------------------------------------------- |
780 | mRoot.setName( "mRoot" ); | 842 | mRoot.setName( "mRoot" ); |
781 | 843 | ||
782 | // skinned mesh objects | 844 | for (LLVOAvatarDictionary::mesh_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); |
783 | mHairLOD.setName("mHairLOD"); | 845 | iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); |
784 | mHairMesh0.setName("mHairMesh0"); | 846 | iter++) |
785 | mHairMesh0.setMeshID(MESH_ID_HAIR); | 847 | { |
786 | mHairMesh1.setName("mHairMesh1"); | 848 | const EMeshIndex mesh_index = iter->first; |
787 | mHairMesh2.setName("mHairMesh2"); | 849 | const LLVOAvatarDictionary::MeshDictionaryEntry *mesh_dict = iter->second; |
788 | mHairMesh3.setName("mHairMesh3"); | 850 | |
789 | mHairMesh4.setName("mHairMesh4"); | 851 | LLViewerJoint* joint = new LLViewerJoint(); |
790 | mHairMesh5.setName("mHairMesh5"); | 852 | joint->setName(mesh_dict->mName); |
791 | 853 | joint->setMeshID(mesh_index); | |
792 | mHairMesh0.setIsTransparent(TRUE); | 854 | mMeshLOD.push_back(joint); |
793 | mHairMesh1.setIsTransparent(TRUE); | 855 | |
794 | mHairMesh2.setIsTransparent(TRUE); | 856 | /* mHairLOD.setName("mHairLOD"); |
795 | mHairMesh3.setIsTransparent(TRUE); | 857 | mHairMesh0.setName("mHairMesh0"); |
796 | mHairMesh4.setIsTransparent(TRUE); | 858 | mHairMesh0.setMeshID(MESH_ID_HAIR); |
797 | mHairMesh5.setIsTransparent(TRUE); | 859 | mHairMesh1.setName("mHairMesh1"); */ |
798 | 860 | for (U32 lod = 0; lod < mesh_dict->mLOD; lod++) | |
799 | mHeadLOD.setName("mHeadLOD"); | 861 | { |
800 | mHeadMesh0.setName("mHeadMesh0"); | 862 | LLViewerJointMesh* mesh = new LLViewerJointMesh(); |
801 | mHeadMesh0.setMeshID(MESH_ID_HEAD); | 863 | std::string mesh_name = "m" + mesh_dict->mName + boost::lexical_cast<std::string>(lod); |
802 | mHeadMesh1.setName("mHeadMesh1"); | 864 | // We pre-pended an m - need to capitalize first character for camelCase |
803 | mHeadMesh2.setName("mHeadMesh2"); | 865 | mesh_name[1] = toupper(mesh_name[1]); |
804 | mHeadMesh3.setName("mHeadMesh3"); | 866 | mesh->setName(mesh_name); |
805 | mHeadMesh4.setName("mHeadMesh4"); | 867 | mesh->setMeshID(mesh_index); |
806 | 868 | mesh->setPickName(mesh_dict->mPickName); | |
807 | mEyeLashLOD.setName("mEyeLashLOD"); | 869 | switch((int)mesh_index) |
808 | mEyeLashMesh0.setName("mEyeLashMesh0"); | 870 | { |
809 | mEyeLashMesh0.setMeshID(MESH_ID_HEAD); | 871 | case MESH_ID_HAIR: |
810 | mEyeLashMesh0.setIsTransparent(TRUE); | 872 | mesh->setIsTransparent(TRUE); |
811 | 873 | break; | |
812 | mUpperBodyLOD.setName("mUpperBodyLOD"); | 874 | case MESH_ID_SKIRT: |
813 | mUpperBodyMesh0.setName("mUpperBodyMesh0"); | 875 | mesh->setIsTransparent(TRUE); |
814 | mUpperBodyMesh0.setMeshID(MESH_ID_UPPER_BODY); | 876 | break; |
815 | mUpperBodyMesh1.setName("mUpperBodyMesh1"); | 877 | case MESH_ID_EYEBALL_LEFT: |
816 | mUpperBodyMesh2.setName("mUpperBodyMesh2"); | 878 | case MESH_ID_EYEBALL_RIGHT: |
817 | mUpperBodyMesh3.setName("mUpperBodyMesh3"); | 879 | mesh->setSpecular( LLColor4( 1.0f, 1.0f, 1.0f, 1.0f ), 1.f ); |
818 | mUpperBodyMesh4.setName("mUpperBodyMesh4"); | 880 | break; |
819 | 881 | } | |
820 | mLowerBodyLOD.setName("mLowerBodyLOD"); | 882 | |
821 | mLowerBodyMesh0.setName("mLowerBodyMesh0"); | 883 | joint->mMeshParts.push_back(mesh); |
822 | mLowerBodyMesh0.setMeshID(MESH_ID_LOWER_BODY); | 884 | } |
823 | mLowerBodyMesh1.setName("mLowerBodyMesh1"); | 885 | } |
824 | mLowerBodyMesh2.setName("mLowerBodyMesh2"); | 886 | |
825 | mLowerBodyMesh3.setName("mLowerBodyMesh3"); | 887 | //------------------------------------------------------------------------- |
826 | mLowerBodyMesh4.setName("mLowerBodyMesh4"); | 888 | // associate baked textures with meshes |
827 | 889 | //------------------------------------------------------------------------- | |
828 | mEyeBallLeftLOD.setName("mEyeBallLeftLOD"); | 890 | for (LLVOAvatarDictionary::mesh_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); |
829 | mEyeBallLeftMesh0.setName("mEyeBallLeftMesh0"); | 891 | iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); |
830 | mEyeBallLeftMesh1.setName("mEyeBallLeftMesh1"); | 892 | iter++) |
831 | 893 | { | |
832 | mEyeBallRightLOD.setName("mEyeBallRightLOD"); | 894 | const EMeshIndex mesh_index = iter->first; |
833 | mEyeBallRightMesh0.setName("mEyeBallRightMesh0"); | 895 | const LLVOAvatarDictionary::MeshDictionaryEntry *mesh_dict = iter->second; |
834 | mEyeBallRightMesh1.setName("mEyeBallRightMesh1"); | 896 | const EBakedTextureIndex baked_texture_index = mesh_dict->mBakedID; |
835 | 897 | ||
836 | mSkirtLOD.setName("mSkirtLOD"); | 898 | // Skip it if there's no associated baked texture. |
837 | mSkirtMesh0.setName("mSkirtMesh0"); | 899 | if (baked_texture_index == BAKED_NUM_INDICES) continue; |
838 | mSkirtMesh0.setMeshID(MESH_ID_SKIRT); | 900 | |
839 | mSkirtMesh1.setName("mSkirtMesh1"); | 901 | for (std::vector<LLViewerJointMesh* >::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin(); |
840 | mSkirtMesh2.setName("mSkirtMesh2"); | 902 | iter != mMeshLOD[mesh_index]->mMeshParts.end(); iter++) |
841 | mSkirtMesh3.setName("mSkirtMesh3"); | 903 | { |
842 | mSkirtMesh4.setName("mSkirtMesh4"); | 904 | LLViewerJointMesh* mesh = (LLViewerJointMesh*) *iter; |
843 | 905 | mBakedTextureData[(int)baked_texture_index].mMeshes.push_back(mesh); | |
844 | mSkirtMesh0.setIsTransparent(TRUE); | 906 | } |
845 | mSkirtMesh1.setIsTransparent(TRUE); | 907 | } |
846 | mSkirtMesh2.setIsTransparent(TRUE); | 908 | |
847 | mSkirtMesh3.setIsTransparent(TRUE); | ||
848 | mSkirtMesh4.setIsTransparent(TRUE); | ||
849 | |||
850 | // set the pick names for the avatar | ||
851 | mHeadMesh0.setPickName( LLViewerJoint::PN_0 ); | ||
852 | mHeadMesh1.setPickName( LLViewerJoint::PN_0 ); | ||
853 | mHeadMesh2.setPickName( LLViewerJoint::PN_0 ); | ||
854 | mHeadMesh3.setPickName( LLViewerJoint::PN_0 ); | ||
855 | mHeadMesh4.setPickName( LLViewerJoint::PN_0 ); | ||
856 | mEyeLashMesh0.setPickName( LLViewerJoint::PN_0 ); | ||
857 | |||
858 | mUpperBodyMesh0.setPickName( LLViewerJoint::PN_1 ); | ||
859 | mUpperBodyMesh1.setPickName( LLViewerJoint::PN_1 ); | ||
860 | mUpperBodyMesh2.setPickName( LLViewerJoint::PN_1 ); | ||
861 | mUpperBodyMesh3.setPickName( LLViewerJoint::PN_1 ); | ||
862 | mUpperBodyMesh4.setPickName( LLViewerJoint::PN_1 ); | ||
863 | |||
864 | mLowerBodyMesh0.setPickName( LLViewerJoint::PN_2 ); | ||
865 | mLowerBodyMesh1.setPickName( LLViewerJoint::PN_2 ); | ||
866 | mLowerBodyMesh2.setPickName( LLViewerJoint::PN_2 ); | ||
867 | mLowerBodyMesh3.setPickName( LLViewerJoint::PN_2 ); | ||
868 | mLowerBodyMesh4.setPickName( LLViewerJoint::PN_2 ); | ||
869 | |||
870 | mEyeBallLeftMesh0.setPickName( LLViewerJoint::PN_3 ); | ||
871 | mEyeBallLeftMesh1.setPickName( LLViewerJoint::PN_3 ); | ||
872 | mEyeBallRightMesh0.setPickName( LLViewerJoint::PN_3 ); | ||
873 | mEyeBallRightMesh1.setPickName( LLViewerJoint::PN_3 ); | ||
874 | |||
875 | mHairMesh0.setPickName( LLViewerJoint::PN_4); | ||
876 | mHairMesh1.setPickName( LLViewerJoint::PN_4); | ||
877 | mHairMesh2.setPickName( LLViewerJoint::PN_4); | ||
878 | mHairMesh3.setPickName( LLViewerJoint::PN_4); | ||
879 | mHairMesh4.setPickName( LLViewerJoint::PN_4); | ||
880 | mHairMesh5.setPickName( LLViewerJoint::PN_4); | ||
881 | |||
882 | mSkirtMesh0.setPickName( LLViewerJoint::PN_5 ); | ||
883 | mSkirtMesh1.setPickName( LLViewerJoint::PN_5 ); | ||
884 | mSkirtMesh2.setPickName( LLViewerJoint::PN_5 ); | ||
885 | mSkirtMesh3.setPickName( LLViewerJoint::PN_5 ); | ||
886 | mSkirtMesh4.setPickName( LLViewerJoint::PN_5 ); | ||
887 | |||
888 | // material settings | ||
889 | |||
890 | mEyeBallLeftMesh0.setSpecular( LLColor4( 1.0f, 1.0f, 1.0f, 1.0f ), 1.f ); | ||
891 | mEyeBallLeftMesh1.setSpecular( LLColor4( 1.0f, 1.0f, 1.0f, 1.0f ), 1.f ); | ||
892 | mEyeBallRightMesh0.setSpecular( LLColor4( 1.0f, 1.0f, 1.0f, 1.0f ), 1.f ); | ||
893 | mEyeBallRightMesh1.setSpecular( LLColor4( 1.0f, 1.0f, 1.0f, 1.0f ), 1.f ); | ||
894 | 909 | ||
895 | //------------------------------------------------------------------------- | 910 | //------------------------------------------------------------------------- |
896 | // register motions | 911 | // register motions |
@@ -989,20 +1004,11 @@ LLVOAvatar::~LLVOAvatar() | |||
989 | 1004 | ||
990 | mNumJoints = 0; | 1005 | mNumJoints = 0; |
991 | 1006 | ||
992 | delete mHeadLayerSet; | 1007 | for (U32 i = 0; i < mBakedTextureData.size(); i++) |
993 | mHeadLayerSet = NULL; | 1008 | { |
994 | 1009 | delete mBakedTextureData[i].mTexLayerSet; | |
995 | delete mUpperBodyLayerSet; | 1010 | mBakedTextureData[i].mTexLayerSet = NULL; |
996 | mUpperBodyLayerSet = NULL; | 1011 | } |
997 | |||
998 | delete mLowerBodyLayerSet; | ||
999 | mLowerBodyLayerSet = NULL; | ||
1000 | |||
1001 | delete mEyesLayerSet; | ||
1002 | mEyesLayerSet = NULL; | ||
1003 | |||
1004 | delete mSkirtLayerSet; | ||
1005 | mSkirtLayerSet = NULL; | ||
1006 | 1012 | ||
1007 | std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer()); | 1013 | std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer()); |
1008 | mAttachmentPoints.clear(); | 1014 | mAttachmentPoints.clear(); |
@@ -1016,6 +1022,16 @@ LLVOAvatar::~LLVOAvatar() | |||
1016 | 1022 | ||
1017 | std::for_each(mMeshes.begin(), mMeshes.end(), DeletePairedPointer()); | 1023 | std::for_each(mMeshes.begin(), mMeshes.end(), DeletePairedPointer()); |
1018 | mMeshes.clear(); | 1024 | mMeshes.clear(); |
1025 | |||
1026 | for (std::vector<LLViewerJoint*>::iterator jointIter = mMeshLOD.begin(); | ||
1027 | jointIter != mMeshLOD.end(); jointIter++) | ||
1028 | { | ||
1029 | LLViewerJoint* joint = (LLViewerJoint *) *jointIter; | ||
1030 | std::for_each(joint->mMeshParts.begin(), joint->mMeshParts.end(), DeletePointer()); | ||
1031 | joint->mMeshParts.clear(); | ||
1032 | } | ||
1033 | std::for_each(mMeshLOD.begin(), mMeshLOD.end(), DeletePointer()); | ||
1034 | mMeshLOD.clear(); | ||
1019 | 1035 | ||
1020 | mDead = TRUE; | 1036 | mDead = TRUE; |
1021 | 1037 | ||
@@ -1047,45 +1063,34 @@ BOOL LLVOAvatar::isFullyBaked() | |||
1047 | { | 1063 | { |
1048 | if (mIsDummy) return TRUE; | 1064 | if (mIsDummy) return TRUE; |
1049 | if (getNumTEs() == 0) return FALSE; | 1065 | if (getNumTEs() == 0) return FALSE; |
1050 | |||
1051 | BOOL head_baked = ( getTEImage( TEX_HEAD_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
1052 | BOOL upper_baked = ( getTEImage( TEX_UPPER_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
1053 | BOOL lower_baked = ( getTEImage( TEX_LOWER_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
1054 | BOOL eyes_baked = ( getTEImage( TEX_EYES_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
1055 | BOOL skirt_baked = ( getTEImage( TEX_SKIRT_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
1056 | 1066 | ||
1057 | if (isWearingWearableType(WT_SKIRT)) | 1067 | for (U32 i = 0; i < mBakedTextureData.size(); i++) |
1058 | { | ||
1059 | return head_baked && upper_baked && lower_baked && eyes_baked && skirt_baked; | ||
1060 | } | ||
1061 | else | ||
1062 | { | 1068 | { |
1063 | return head_baked && upper_baked && lower_baked && eyes_baked; | 1069 | if (!isTextureDefined(mBakedTextureData[i].mTextureIndex) |
1070 | && ( (i != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) ) ) | ||
1071 | { | ||
1072 | return FALSE; | ||
1073 | } | ||
1064 | } | 1074 | } |
1075 | return TRUE; | ||
1065 | } | 1076 | } |
1066 | 1077 | ||
1067 | void LLVOAvatar::deleteLayerSetCaches() | 1078 | void LLVOAvatar::deleteLayerSetCaches(bool clearAll) |
1068 | { | 1079 | { |
1069 | if( mHeadLayerSet ) mHeadLayerSet->deleteCaches(); | 1080 | for (U32 i = 0; i < mBakedTextureData.size(); i++) |
1070 | if( mUpperBodyLayerSet ) mUpperBodyLayerSet->deleteCaches(); | ||
1071 | if( mLowerBodyLayerSet ) mLowerBodyLayerSet->deleteCaches(); | ||
1072 | if( mEyesLayerSet ) mEyesLayerSet->deleteCaches(); | ||
1073 | if( mSkirtLayerSet ) mSkirtLayerSet->deleteCaches(); | ||
1074 | |||
1075 | if(mUpperMaskTexName) | ||
1076 | { | ||
1077 | glDeleteTextures(1, (GLuint*)&mUpperMaskTexName); | ||
1078 | mUpperMaskTexName = 0 ; | ||
1079 | } | ||
1080 | if(mHeadMaskTexName) | ||
1081 | { | ||
1082 | glDeleteTextures(1, (GLuint*)&mHeadMaskTexName); | ||
1083 | mHeadMaskTexName = 0 ; | ||
1084 | } | ||
1085 | if(mLowerMaskTexName) | ||
1086 | { | 1081 | { |
1087 | glDeleteTextures(1, (GLuint*)&mLowerMaskTexName); | 1082 | if (mBakedTextureData[i].mTexLayerSet) |
1088 | mLowerMaskTexName = 0 ; | 1083 | { |
1084 | if ((i != BAKED_HAIR || mIsSelf) && !clearAll) // Backwards compatibility - can be removed after hair baking is mandatory on the grid | ||
1085 | { | ||
1086 | mBakedTextureData[i].mTexLayerSet->deleteCaches(); | ||
1087 | } | ||
1088 | } | ||
1089 | if (mBakedTextureData[i].mMaskTexName) | ||
1090 | { | ||
1091 | glDeleteTextures(1, (GLuint*)&(mBakedTextureData[i].mMaskTexName)); | ||
1092 | mBakedTextureData[i].mMaskTexName = 0 ; | ||
1093 | } | ||
1089 | } | 1094 | } |
1090 | } | 1095 | } |
1091 | 1096 | ||
@@ -1156,7 +1161,7 @@ void LLVOAvatar::dumpBakedStatus() | |||
1156 | llcont << " DEAD ("<< inst->getNumRefs() << " refs)"; | 1161 | llcont << " DEAD ("<< inst->getNumRefs() << " refs)"; |
1157 | } | 1162 | } |
1158 | 1163 | ||
1159 | if( inst->mIsSelf ) | 1164 | if( inst->isSelf() ) |
1160 | { | 1165 | { |
1161 | llcont << " (self)"; | 1166 | llcont << " (self)"; |
1162 | } | 1167 | } |
@@ -1183,130 +1188,26 @@ void LLVOAvatar::dumpBakedStatus() | |||
1183 | else | 1188 | else |
1184 | { | 1189 | { |
1185 | llcont << " Unbaked ("; | 1190 | llcont << " Unbaked ("; |
1186 | if( inst->getTEImage( TEX_HEAD_BAKED )->getID() == IMG_DEFAULT_AVATAR ) | 1191 | |
1187 | { | 1192 | for (LLVOAvatarDictionary::baked_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); |
1188 | llcont << " head"; | 1193 | iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); |
1189 | } | 1194 | iter++) |
1190 | |||
1191 | if( inst->getTEImage( TEX_UPPER_BAKED )->getID() == IMG_DEFAULT_AVATAR ) | ||
1192 | { | ||
1193 | llcont << " upper"; | ||
1194 | } | ||
1195 | |||
1196 | if( inst->getTEImage( TEX_LOWER_BAKED )->getID() == IMG_DEFAULT_AVATAR ) | ||
1197 | { | ||
1198 | llcont << " lower"; | ||
1199 | } | ||
1200 | |||
1201 | if( inst->getTEImage( TEX_EYES_BAKED )->getID() == IMG_DEFAULT_AVATAR ) | ||
1202 | { | ||
1203 | llcont << " eyes"; | ||
1204 | } | ||
1205 | |||
1206 | if (inst->isWearingWearableType(WT_SKIRT)) | ||
1207 | { | 1195 | { |
1208 | if( inst->getTEImage( TEX_SKIRT_BAKED )->getID() == IMG_DEFAULT_AVATAR ) | 1196 | const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = iter->second; |
1197 | const ETextureIndex index = baked_dict->mTextureIndex; | ||
1198 | if (!inst->isTextureDefined(index)) | ||
1209 | { | 1199 | { |
1210 | llcont << " skirt"; | 1200 | llcont << " " << LLVOAvatarDictionary::getInstance()->getTexture(index)->mName; |
1211 | } | 1201 | } |
1212 | } | 1202 | } |
1213 | 1203 | ||
1214 | llcont << " ) " << inst->getUnbakedPixelAreaRank() << "/" << LLVOAvatar::sMaxOtherAvatarsToComposite; | 1204 | llcont << " ) " << inst->getUnbakedPixelAreaRank(); |
1215 | if( inst->isCulled() ) | 1205 | if( inst->isCulled() ) |
1216 | { | 1206 | { |
1217 | llcont << " culled"; | 1207 | llcont << " culled"; |
1218 | } | 1208 | } |
1219 | } | 1209 | } |
1220 | llcont << llendl; | 1210 | llcont << llendl; |
1221 | /* | ||
1222 | if( inst->isDead() ) | ||
1223 | { | ||
1224 | llinfos << "DEAD LIST " << llendl; | ||
1225 | |||
1226 | |||
1227 | for( S32 i = 0; i < inst->mOwners.count(); i++ ) | ||
1228 | { | ||
1229 | llinfos << i << llendl; | ||
1230 | LLPointer<LLViewerObject>* owner = (LLPointer<LLViewerObject>*)(inst->mOwners[i]); | ||
1231 | LLPointer<LLViewerObject>* cur; | ||
1232 | if( !owner->mName.isEmpty() ) | ||
1233 | { | ||
1234 | llinfos << " " << owner->mName << llendl; | ||
1235 | } | ||
1236 | |||
1237 | LLViewerObject* key_vo; | ||
1238 | for( key_vo = gObjectList.mActiveObjects.getFirstKey(); key_vo; key_vo = gObjectList.mActiveObjects.getNextKey() ) | ||
1239 | { | ||
1240 | cur = &(gObjectList.mActiveObjects.getCurrentDataWithoutIncrement()); | ||
1241 | if( cur == owner ) | ||
1242 | { | ||
1243 | llinfos << " gObjectList.mActiveObjects" << llendl; | ||
1244 | } | ||
1245 | } | ||
1246 | |||
1247 | for( key_vo = gObjectList.mAvatarObjects.getFirstKey(); key_vo; key_vo = gObjectList.mAvatarObjects.getNextKey() ) | ||
1248 | { | ||
1249 | cur = &(gObjectList.mAvatarObjects.getCurrentDataWithoutIncrement()); | ||
1250 | if( cur == owner ) | ||
1251 | { | ||
1252 | llinfos << " gObjectList.mAvatarObjects" << llendl; | ||
1253 | } | ||
1254 | } | ||
1255 | |||
1256 | LLUUID id; | ||
1257 | for( id = gObjectList.mDeadObjects.getFirstKey(); id; id = gObjectList.mDeadObjects.getNextKey() ) | ||
1258 | { | ||
1259 | cur = &(gObjectList.mDeadObjects.getCurrentDataWithoutIncrement()); | ||
1260 | if( cur == owner ) | ||
1261 | { | ||
1262 | llinfos << " gObjectList.mDeadObjects" << llendl; | ||
1263 | } | ||
1264 | } | ||
1265 | |||
1266 | |||
1267 | for( id = gObjectList.mUUIDObjectMap.getFirstKey(); id; id = gObjectList.mUUIDObjectMap.getNextKey() ) | ||
1268 | { | ||
1269 | cur = &(gObjectList.mUUIDObjectMap.getCurrentDataWithoutIncrement()); | ||
1270 | if( cur == owner ) | ||
1271 | { | ||
1272 | llinfos << " gObjectList.mUUIDObjectMap" << llendl; | ||
1273 | } | ||
1274 | } | ||
1275 | |||
1276 | S32 j; | ||
1277 | S32 k; | ||
1278 | for( j = 0; j < 16; j++ ) | ||
1279 | { | ||
1280 | for( k = 0; k < 10; k++ ) | ||
1281 | { | ||
1282 | cur = &(gObjectList.mCloseObjects[j][k]); | ||
1283 | if( cur == owner ) | ||
1284 | { | ||
1285 | llinfos << " gObjectList.mCloseObjects" << llendl; | ||
1286 | } | ||
1287 | } | ||
1288 | } | ||
1289 | |||
1290 | for( j = 0; j < gObjectList.mObjects.count(); j++ ) | ||
1291 | { | ||
1292 | cur = &(gObjectList.mObjects[j]); | ||
1293 | if( cur == owner ) | ||
1294 | { | ||
1295 | llinfos << " gObjectList.mObjects" << llendl; | ||
1296 | } | ||
1297 | } | ||
1298 | |||
1299 | for( j = 0; j < gObjectList.mMapObjects.count(); j++ ) | ||
1300 | { | ||
1301 | cur = &(gObjectList.mMapObjects[j]); | ||
1302 | if( cur == owner ) | ||
1303 | { | ||
1304 | llinfos << " gObjectList.mMapObjects" << llendl; | ||
1305 | } | ||
1306 | } | ||
1307 | } | ||
1308 | } | ||
1309 | */ | ||
1310 | } | 1211 | } |
1311 | } | 1212 | } |
1312 | 1213 | ||
@@ -1318,11 +1219,10 @@ void LLVOAvatar::restoreGL() | |||
1318 | { | 1219 | { |
1319 | LLVOAvatar* inst = (LLVOAvatar*) *iter; | 1220 | LLVOAvatar* inst = (LLVOAvatar*) *iter; |
1320 | inst->setCompositeUpdatesEnabled( TRUE ); | 1221 | inst->setCompositeUpdatesEnabled( TRUE ); |
1321 | inst->invalidateComposite( inst->mHeadLayerSet, FALSE ); | 1222 | for (U32 i = 0; i < inst->mBakedTextureData.size(); i++) |
1322 | inst->invalidateComposite( inst->mLowerBodyLayerSet, FALSE ); | 1223 | { |
1323 | inst->invalidateComposite( inst->mUpperBodyLayerSet, FALSE ); | 1224 | inst->invalidateComposite( inst->mBakedTextureData[i].mTexLayerSet, FALSE ); |
1324 | inst->invalidateComposite( inst->mEyesLayerSet, FALSE ); | 1225 | } |
1325 | inst->invalidateComposite( inst->mSkirtLayerSet, FALSE ); | ||
1326 | inst->updateMeshTextures(); | 1226 | inst->updateMeshTextures(); |
1327 | } | 1227 | } |
1328 | } | 1228 | } |
@@ -1347,7 +1247,7 @@ void LLVOAvatar::resetImpostors() | |||
1347 | } | 1247 | } |
1348 | 1248 | ||
1349 | // static | 1249 | // static |
1350 | void LLVOAvatar::deleteCachedImages() | 1250 | void LLVOAvatar::deleteCachedImages(bool clearAll) |
1351 | { | 1251 | { |
1352 | if (LLTexLayerSet::sHasCaches) | 1252 | if (LLTexLayerSet::sHasCaches) |
1353 | { | 1253 | { |
@@ -1356,16 +1256,16 @@ void LLVOAvatar::deleteCachedImages() | |||
1356 | iter != LLCharacter::sInstances.end(); ++iter) | 1256 | iter != LLCharacter::sInstances.end(); ++iter) |
1357 | { | 1257 | { |
1358 | LLVOAvatar* inst = (LLVOAvatar*) *iter; | 1258 | LLVOAvatar* inst = (LLVOAvatar*) *iter; |
1359 | inst->deleteLayerSetCaches(); | 1259 | inst->deleteLayerSetCaches(clearAll); |
1360 | } | 1260 | } |
1361 | LLTexLayerSet::sHasCaches = FALSE; | 1261 | LLTexLayerSet::sHasCaches = FALSE; |
1362 | } | 1262 | } |
1363 | 1263 | ||
1364 | for( GLuint* namep = (GLuint*)sScratchTexNames.getFirstData(); | 1264 | for( LLGLuint* namep = sScratchTexNames.getFirstData(); |
1365 | namep; | 1265 | namep; |
1366 | namep = (GLuint*)sScratchTexNames.getNextData() ) | 1266 | namep = sScratchTexNames.getNextData() ) |
1367 | { | 1267 | { |
1368 | glDeleteTextures(1, namep ); | 1268 | LLImageGL::deleteTextures(1, (U32 *)namep ); |
1369 | stop_glerror(); | 1269 | stop_glerror(); |
1370 | } | 1270 | } |
1371 | 1271 | ||
@@ -1389,8 +1289,6 @@ void LLVOAvatar::deleteCachedImages() | |||
1389 | //------------------------------------------------------------------------ | 1289 | //------------------------------------------------------------------------ |
1390 | void LLVOAvatar::initClass() | 1290 | void LLVOAvatar::initClass() |
1391 | { | 1291 | { |
1392 | LLVOAvatar::sMaxOtherAvatarsToComposite = gSavedSettings.getS32("AvatarCompositeLimit"); | ||
1393 | |||
1394 | std::string xmlFile; | 1292 | std::string xmlFile; |
1395 | 1293 | ||
1396 | xmlFile = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,AVATAR_DEFAULT_CHAR) + "_lad.xml"; | 1294 | xmlFile = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,AVATAR_DEFAULT_CHAR) + "_lad.xml"; |
@@ -1454,44 +1352,45 @@ void LLVOAvatar::initClass() | |||
1454 | // Process XML data | 1352 | // Process XML data |
1455 | 1353 | ||
1456 | // avatar_skeleton.xml | 1354 | // avatar_skeleton.xml |
1457 | llassert(!sSkeletonInfo); | 1355 | llassert(!sAvatarSkeletonInfo); |
1458 | sSkeletonInfo = new LLVOAvatarSkeletonInfo; | 1356 | sAvatarSkeletonInfo = new LLVOAvatarSkeletonInfo; |
1459 | if (!sSkeletonInfo->parseXml(sSkeletonXMLTree.getRoot())) | 1357 | if (!sAvatarSkeletonInfo->parseXml(sSkeletonXMLTree.getRoot())) |
1460 | { | 1358 | { |
1461 | llerrs << "Error parsing skeleton XML file: " << skeleton_path << llendl; | 1359 | llerrs << "Error parsing skeleton XML file: " << skeleton_path << llendl; |
1462 | } | 1360 | } |
1463 | // parse avatar_lad.xml | 1361 | // parse avatar_lad.xml |
1464 | llassert(!sAvatarInfo); | 1362 | llassert(!sAvatarXmlInfo); |
1465 | sAvatarInfo = new LLVOAvatarInfo; | 1363 | sAvatarXmlInfo = new LLVOAvatarXmlInfo; |
1466 | if (!sAvatarInfo->parseXmlSkeletonNode(root)) | 1364 | if (!sAvatarXmlInfo->parseXmlSkeletonNode(root)) |
1467 | { | 1365 | { |
1468 | llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; | 1366 | llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; |
1469 | } | 1367 | } |
1470 | if (!sAvatarInfo->parseXmlMeshNodes(root)) | 1368 | if (!sAvatarXmlInfo->parseXmlMeshNodes(root)) |
1471 | { | 1369 | { |
1472 | llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; | 1370 | llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; |
1473 | } | 1371 | } |
1474 | if (!sAvatarInfo->parseXmlColorNodes(root)) | 1372 | if (!sAvatarXmlInfo->parseXmlColorNodes(root)) |
1475 | { | 1373 | { |
1476 | llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; | 1374 | llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; |
1477 | } | 1375 | } |
1478 | if (!sAvatarInfo->parseXmlLayerNodes(root)) | 1376 | if (!sAvatarXmlInfo->parseXmlLayerNodes(root)) |
1479 | { | 1377 | { |
1480 | llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; | 1378 | llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; |
1481 | } | 1379 | } |
1482 | if (!sAvatarInfo->parseXmlDriverNodes(root)) | 1380 | if (!sAvatarXmlInfo->parseXmlDriverNodes(root)) |
1483 | { | 1381 | { |
1484 | llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; | 1382 | llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; |
1485 | } | 1383 | } |
1384 | |||
1486 | } | 1385 | } |
1487 | 1386 | ||
1488 | 1387 | ||
1489 | void LLVOAvatar::cleanupClass() | 1388 | void LLVOAvatar::cleanupClass() |
1490 | { | 1389 | { |
1491 | delete sAvatarInfo; | 1390 | delete sAvatarXmlInfo; |
1492 | sAvatarInfo = NULL; | 1391 | sAvatarXmlInfo = NULL; |
1493 | delete sSkeletonInfo; | 1392 | delete sAvatarSkeletonInfo; |
1494 | sSkeletonInfo = NULL; | 1393 | sAvatarSkeletonInfo = NULL; |
1495 | sSkeletonXMLTree.cleanup(); | 1394 | sSkeletonXMLTree.cleanup(); |
1496 | sXMLTree.cleanup(); | 1395 | sXMLTree.cleanup(); |
1497 | } | 1396 | } |
@@ -1554,7 +1453,7 @@ void LLVOAvatar::getSpatialExtents(LLVector3& newMin, LLVector3& newMax) | |||
1554 | newMax = pos + buffer; | 1453 | newMax = pos + buffer; |
1555 | 1454 | ||
1556 | //stretch bounding box by joint positions | 1455 | //stretch bounding box by joint positions |
1557 | for (mesh_map_t::iterator i = mMeshes.begin(); i != mMeshes.end(); ++i) | 1456 | for (polymesh_map_t::iterator i = mMeshes.begin(); i != mMeshes.end(); ++i) |
1558 | { | 1457 | { |
1559 | LLPolyMesh* mesh = i->second; | 1458 | LLPolyMesh* mesh = i->second; |
1560 | for (S32 joint_num = 0; joint_num < mesh->mJointRenderData.count(); joint_num++) | 1459 | for (S32 joint_num = 0; joint_num < mesh->mJointRenderData.count(); joint_num++) |
@@ -1573,7 +1472,7 @@ void LLVOAvatar::getSpatialExtents(LLVector3& newMin, LLVector3& newMax) | |||
1573 | { | 1472 | { |
1574 | LLViewerJointAttachment* attachment = iter->second; | 1473 | LLViewerJointAttachment* attachment = iter->second; |
1575 | 1474 | ||
1576 | if(!attachment->getValid()) | 1475 | if (!attachment->getValid()) |
1577 | { | 1476 | { |
1578 | continue ; | 1477 | continue ; |
1579 | } | 1478 | } |
@@ -1690,7 +1589,6 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& e | |||
1690 | return FALSE; | 1589 | return FALSE; |
1691 | } | 1590 | } |
1692 | 1591 | ||
1693 | |||
1694 | //----------------------------------------------------------------------------- | 1592 | //----------------------------------------------------------------------------- |
1695 | // parseSkeletonFile() | 1593 | // parseSkeletonFile() |
1696 | //----------------------------------------------------------------------------- | 1594 | //----------------------------------------------------------------------------- |
@@ -1734,7 +1632,7 @@ BOOL LLVOAvatar::parseSkeletonFile(const std::string& filename) | |||
1734 | //----------------------------------------------------------------------------- | 1632 | //----------------------------------------------------------------------------- |
1735 | // setupBone() | 1633 | // setupBone() |
1736 | //----------------------------------------------------------------------------- | 1634 | //----------------------------------------------------------------------------- |
1737 | BOOL LLVOAvatar::setupBone(LLVOAvatarBoneInfo* info, LLViewerJoint* parent) | 1635 | BOOL LLVOAvatar::setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent, S32 &volume_num, S32 &joint_num) |
1738 | { | 1636 | { |
1739 | LLMemType mt(LLMemType::MTYPE_AVATAR); | 1637 | LLMemType mt(LLMemType::MTYPE_AVATAR); |
1740 | 1638 | ||
@@ -1742,7 +1640,7 @@ BOOL LLVOAvatar::setupBone(LLVOAvatarBoneInfo* info, LLViewerJoint* parent) | |||
1742 | 1640 | ||
1743 | if (info->mIsJoint) | 1641 | if (info->mIsJoint) |
1744 | { | 1642 | { |
1745 | joint = (LLViewerJoint*)getCharacterJoint(sCurJoint); | 1643 | joint = (LLViewerJoint*)getCharacterJoint(joint_num); |
1746 | if (!joint) | 1644 | if (!joint) |
1747 | { | 1645 | { |
1748 | llwarns << "Too many bones" << llendl; | 1646 | llwarns << "Too many bones" << llendl; |
@@ -1752,12 +1650,12 @@ BOOL LLVOAvatar::setupBone(LLVOAvatarBoneInfo* info, LLViewerJoint* parent) | |||
1752 | } | 1650 | } |
1753 | else // collision volume | 1651 | else // collision volume |
1754 | { | 1652 | { |
1755 | if (sCurVolume >= (S32)mNumCollisionVolumes) | 1653 | if (volume_num >= (S32)mNumCollisionVolumes) |
1756 | { | 1654 | { |
1757 | llwarns << "Too many bones" << llendl; | 1655 | llwarns << "Too many bones" << llendl; |
1758 | return FALSE; | 1656 | return FALSE; |
1759 | } | 1657 | } |
1760 | joint = (LLViewerJoint*)(&mCollisionVolumes[sCurVolume]); | 1658 | joint = (LLViewerJoint*)(&mCollisionVolumes[volume_num]); |
1761 | 1659 | ||
1762 | joint->setName( info->mName ); | 1660 | joint->setName( info->mName ); |
1763 | } | 1661 | } |
@@ -1779,19 +1677,19 @@ BOOL LLVOAvatar::setupBone(LLVOAvatarBoneInfo* info, LLViewerJoint* parent) | |||
1779 | if (info->mIsJoint) | 1677 | if (info->mIsJoint) |
1780 | { | 1678 | { |
1781 | joint->setSkinOffset( info->mPivot ); | 1679 | joint->setSkinOffset( info->mPivot ); |
1782 | sCurJoint++; | 1680 | joint_num++; |
1783 | } | 1681 | } |
1784 | else // collision volume | 1682 | else // collision volume |
1785 | { | 1683 | { |
1786 | sCurVolume++; | 1684 | volume_num++; |
1787 | } | 1685 | } |
1788 | 1686 | ||
1789 | // setup children | 1687 | // setup children |
1790 | LLVOAvatarBoneInfo::child_list_t::iterator iter; | 1688 | LLVOAvatarBoneInfo::child_list_t::const_iterator iter; |
1791 | for (iter = info->mChildList.begin(); iter != info->mChildList.end(); iter++) | 1689 | for (iter = info->mChildList.begin(); iter != info->mChildList.end(); iter++) |
1792 | { | 1690 | { |
1793 | LLVOAvatarBoneInfo *child_info = *iter; | 1691 | LLVOAvatarBoneInfo *child_info = *iter; |
1794 | if (!setupBone(child_info, joint)) | 1692 | if (!setupBone(child_info, joint, volume_num, joint_num)) |
1795 | { | 1693 | { |
1796 | return FALSE; | 1694 | return FALSE; |
1797 | } | 1695 | } |
@@ -1803,7 +1701,7 @@ BOOL LLVOAvatar::setupBone(LLVOAvatarBoneInfo* info, LLViewerJoint* parent) | |||
1803 | //----------------------------------------------------------------------------- | 1701 | //----------------------------------------------------------------------------- |
1804 | // buildSkeleton() | 1702 | // buildSkeleton() |
1805 | //----------------------------------------------------------------------------- | 1703 | //----------------------------------------------------------------------------- |
1806 | BOOL LLVOAvatar::buildSkeleton(LLVOAvatarSkeletonInfo *info) | 1704 | BOOL LLVOAvatar::buildSkeleton(const LLVOAvatarSkeletonInfo *info) |
1807 | { | 1705 | { |
1808 | LLMemType mt(LLMemType::MTYPE_AVATAR); | 1706 | LLMemType mt(LLMemType::MTYPE_AVATAR); |
1809 | 1707 | ||
@@ -1828,14 +1726,13 @@ BOOL LLVOAvatar::buildSkeleton(LLVOAvatarSkeletonInfo *info) | |||
1828 | } | 1726 | } |
1829 | } | 1727 | } |
1830 | 1728 | ||
1831 | sCurJoint = 0; | 1729 | S32 current_joint_num = 0; |
1832 | sCurVolume = 0; | 1730 | S32 current_volume_num = 0; |
1833 | 1731 | LLVOAvatarSkeletonInfo::bone_info_list_t::const_iterator iter; | |
1834 | LLVOAvatarSkeletonInfo::bone_info_list_t::iterator iter; | ||
1835 | for (iter = info->mBoneInfoList.begin(); iter != info->mBoneInfoList.end(); iter++) | 1732 | for (iter = info->mBoneInfoList.begin(); iter != info->mBoneInfoList.end(); iter++) |
1836 | { | 1733 | { |
1837 | LLVOAvatarBoneInfo *info = *iter; | 1734 | LLVOAvatarBoneInfo *info = *iter; |
1838 | if (!setupBone(info, NULL)) | 1735 | if (!setupBone(info, NULL, current_volume_num, current_joint_num)) |
1839 | { | 1736 | { |
1840 | llerrs << "Error parsing bone in skeleton file" << llendl; | 1737 | llerrs << "Error parsing bone in skeleton file" << llendl; |
1841 | return FALSE; | 1738 | return FALSE; |
@@ -1901,43 +1798,17 @@ void LLVOAvatar::buildCharacter() | |||
1901 | //------------------------------------------------------------------------- | 1798 | //------------------------------------------------------------------------- |
1902 | // clear mesh data | 1799 | // clear mesh data |
1903 | //------------------------------------------------------------------------- | 1800 | //------------------------------------------------------------------------- |
1904 | mHairMesh0.setMesh(NULL); | 1801 | for (std::vector<LLViewerJoint*>::iterator jointIter = mMeshLOD.begin(); |
1905 | mHairMesh1.setMesh(NULL); | 1802 | jointIter != mMeshLOD.end(); jointIter++) |
1906 | mHairMesh2.setMesh(NULL); | 1803 | { |
1907 | mHairMesh3.setMesh(NULL); | 1804 | LLViewerJoint* joint = (LLViewerJoint*) *jointIter; |
1908 | mHairMesh4.setMesh(NULL); | 1805 | for (std::vector<LLViewerJointMesh*>::iterator meshIter = joint->mMeshParts.begin(); |
1909 | mHairMesh5.setMesh(NULL); | 1806 | meshIter != joint->mMeshParts.end(); meshIter++) |
1910 | 1807 | { | |
1911 | mHeadMesh0.setMesh(NULL); | 1808 | LLViewerJointMesh * mesh = (LLViewerJointMesh *) *meshIter; |
1912 | mHeadMesh1.setMesh(NULL); | 1809 | mesh->setMesh(NULL); |
1913 | mHeadMesh2.setMesh(NULL); | 1810 | } |
1914 | mHeadMesh3.setMesh(NULL); | 1811 | } |
1915 | mHeadMesh4.setMesh(NULL); | ||
1916 | |||
1917 | mEyeLashMesh0.setMesh(NULL); | ||
1918 | |||
1919 | mUpperBodyMesh0.setMesh(NULL); | ||
1920 | mUpperBodyMesh1.setMesh(NULL); | ||
1921 | mUpperBodyMesh2.setMesh(NULL); | ||
1922 | mUpperBodyMesh3.setMesh(NULL); | ||
1923 | mUpperBodyMesh4.setMesh(NULL); | ||
1924 | |||
1925 | mLowerBodyMesh0.setMesh(NULL); | ||
1926 | mLowerBodyMesh1.setMesh(NULL); | ||
1927 | mLowerBodyMesh2.setMesh(NULL); | ||
1928 | mLowerBodyMesh3.setMesh(NULL); | ||
1929 | mLowerBodyMesh4.setMesh(NULL); | ||
1930 | |||
1931 | mEyeBallLeftMesh0.setMesh(NULL); | ||
1932 | mEyeBallLeftMesh1.setMesh(NULL); | ||
1933 | mEyeBallRightMesh0.setMesh(NULL); | ||
1934 | mEyeBallRightMesh1.setMesh(NULL); | ||
1935 | |||
1936 | mSkirtMesh0.setMesh(NULL); | ||
1937 | mSkirtMesh1.setMesh(NULL); | ||
1938 | mSkirtMesh2.setMesh(NULL); | ||
1939 | mSkirtMesh3.setMesh(NULL); | ||
1940 | mSkirtMesh4.setMesh(NULL); | ||
1941 | 1812 | ||
1942 | //------------------------------------------------------------------------- | 1813 | //------------------------------------------------------------------------- |
1943 | // (re)load our skeleton and meshes | 1814 | // (re)load our skeleton and meshes |
@@ -2048,7 +1919,12 @@ void LLVOAvatar::buildCharacter() | |||
2048 | } | 1919 | } |
2049 | 1920 | ||
2050 | startDefaultMotions(); | 1921 | startDefaultMotions(); |
2051 | 1922 | ||
1923 | //------------------------------------------------------------------------- | ||
1924 | // restart any currently active motions | ||
1925 | //------------------------------------------------------------------------- | ||
1926 | processAnimationStateChanges(); | ||
1927 | |||
2052 | mIsBuilt = TRUE; | 1928 | mIsBuilt = TRUE; |
2053 | stop_glerror(); | 1929 | stop_glerror(); |
2054 | 1930 | ||
@@ -2262,21 +2138,18 @@ void LLVOAvatar::releaseMeshData() | |||
2262 | //llinfos << "Releasing" << llendl; | 2138 | //llinfos << "Releasing" << llendl; |
2263 | 2139 | ||
2264 | // cleanup mesh data | 2140 | // cleanup mesh data |
2265 | mHairLOD.setValid(FALSE, TRUE); | 2141 | for (std::vector<LLViewerJoint*>::iterator iter = mMeshLOD.begin(); |
2266 | mHeadLOD.setValid(FALSE, TRUE); | 2142 | iter != mMeshLOD.end(); iter++) |
2267 | mEyeLashLOD.setValid(FALSE, TRUE); | 2143 | { |
2268 | mUpperBodyLOD.setValid(FALSE, TRUE); | 2144 | LLViewerJoint* joint = (LLViewerJoint*) *iter; |
2269 | mLowerBodyLOD.setValid(FALSE, TRUE); | 2145 | joint->setValid(FALSE, TRUE); |
2270 | mEyeBallLeftLOD.setValid(FALSE, TRUE); | 2146 | } |
2271 | mEyeBallRightLOD.setValid(FALSE, TRUE); | ||
2272 | mSkirtLOD.setValid(FALSE, TRUE); | ||
2273 | 2147 | ||
2274 | //cleanup data | 2148 | //cleanup data |
2275 | if (mDrawable.notNull()) | 2149 | if (mDrawable.notNull()) |
2276 | { | 2150 | { |
2277 | LLFace* facep = mDrawable->getFace(0); | 2151 | LLFace* facep = mDrawable->getFace(0); |
2278 | facep->setSize(0, 0); | 2152 | facep->setSize(0, 0); |
2279 | |||
2280 | for(S32 i = mNumInitFaces ; i < mDrawable->getNumFaces(); i++) | 2153 | for(S32 i = mNumInitFaces ; i < mDrawable->getNumFaces(); i++) |
2281 | { | 2154 | { |
2282 | facep = mDrawable->getFace(i); | 2155 | facep = mDrawable->getFace(i); |
@@ -2339,34 +2212,25 @@ void LLVOAvatar::updateMeshData() | |||
2339 | { | 2212 | { |
2340 | stop_glerror(); | 2213 | stop_glerror(); |
2341 | 2214 | ||
2342 | LLViewerJoint* av_parts[8] ; | ||
2343 | av_parts[0] = &mEyeBallLeftLOD ; | ||
2344 | av_parts[1] = &mEyeBallRightLOD ; | ||
2345 | av_parts[2] = &mEyeLashLOD ; | ||
2346 | av_parts[3] = &mHeadLOD ; | ||
2347 | av_parts[4] = &mLowerBodyLOD ; | ||
2348 | av_parts[5] = &mSkirtLOD ; | ||
2349 | av_parts[6] = &mUpperBodyLOD ; | ||
2350 | av_parts[7] = &mHairLOD ; | ||
2351 | |||
2352 | S32 f_num = 0 ; | 2215 | S32 f_num = 0 ; |
2353 | const U32 VERTEX_NUMBER_THRESHOLD = 128 ;//small number of this means each part of an avatar has its own vertex buffer. | 2216 | const U32 VERTEX_NUMBER_THRESHOLD = 128 ;//small number of this means each part of an avatar has its own vertex buffer. |
2217 | const S32 num_parts = mMeshLOD.size(); | ||
2354 | 2218 | ||
2355 | // this order is determined by number of LODS | 2219 | // this order is determined by number of LODS |
2356 | // if a mesh earlier in this list changed LODs while a later mesh doesn't, | 2220 | // if a mesh earlier in this list changed LODs while a later mesh doesn't, |
2357 | // the later mesh's index offset will be inaccurate | 2221 | // the later mesh's index offset will be inaccurate |
2358 | for(S32 part_index = 0 ; part_index < 8 ;) | 2222 | for(S32 part_index = 0 ; part_index < num_parts ;) |
2359 | { | 2223 | { |
2360 | S32 j = part_index ; | 2224 | S32 j = part_index ; |
2361 | U32 last_v_num = 0, num_vertices = 0 ; | 2225 | U32 last_v_num = 0, num_vertices = 0 ; |
2362 | U32 last_i_num = 0, num_indices = 0 ; | 2226 | U32 last_i_num = 0, num_indices = 0 ; |
2363 | 2227 | ||
2364 | while(part_index < 8 && num_vertices < VERTEX_NUMBER_THRESHOLD) | 2228 | while(part_index < num_parts && num_vertices < VERTEX_NUMBER_THRESHOLD) |
2365 | { | 2229 | { |
2366 | last_v_num = num_vertices ; | 2230 | last_v_num = num_vertices ; |
2367 | last_i_num = num_indices ; | 2231 | last_i_num = num_indices ; |
2368 | 2232 | ||
2369 | av_parts[part_index++]->updateFaceSizes(num_vertices, num_indices, mAdjustedPixelArea); | 2233 | mMeshLOD[part_index++]->updateFaceSizes(num_vertices, num_indices, mAdjustedPixelArea); |
2370 | } | 2234 | } |
2371 | if(num_vertices < 1)//skip empty meshes | 2235 | if(num_vertices < 1)//skip empty meshes |
2372 | { | 2236 | { |
@@ -2414,7 +2278,7 @@ void LLVOAvatar::updateMeshData() | |||
2414 | 2278 | ||
2415 | for(S32 k = j ; k < part_index ; k++) | 2279 | for(S32 k = j ; k < part_index ; k++) |
2416 | { | 2280 | { |
2417 | av_parts[k]->updateFaceData(facep, mAdjustedPixelArea, (k == 7)); | 2281 | mMeshLOD[k]->updateFaceData(facep, mAdjustedPixelArea, k == MESH_ID_HAIR); |
2418 | } | 2282 | } |
2419 | 2283 | ||
2420 | stop_glerror(); | 2284 | stop_glerror(); |
@@ -2538,27 +2402,6 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, | |||
2538 | 2402 | ||
2539 | //llinfos << getRotation() << llendl; | 2403 | //llinfos << getRotation() << llendl; |
2540 | //llinfos << getPosition() << llendl; | 2404 | //llinfos << getPosition() << llendl; |
2541 | if (update_type == OUT_FULL ) | ||
2542 | { | ||
2543 | if( !mIsSelf || !mFirstTEMessageReceived ) | ||
2544 | { | ||
2545 | // dumpAvatarTEs( "PRE processUpdateMessage()" ); | ||
2546 | unpackTEMessage(mesgsys, _PREHASH_ObjectData, block_num); | ||
2547 | // dumpAvatarTEs( "POST processUpdateMessage()" ); | ||
2548 | |||
2549 | if( !mFirstTEMessageReceived ) | ||
2550 | { | ||
2551 | onFirstTEMessageReceived(); | ||
2552 | } | ||
2553 | |||
2554 | // Disable updates to composites. We'll decide whether we need to do | ||
2555 | // any updates after we find out whether this update message has any | ||
2556 | // "baked" (pre-composited) textures. | ||
2557 | setCompositeUpdatesEnabled( FALSE ); | ||
2558 | updateMeshTextures(); | ||
2559 | setCompositeUpdatesEnabled( TRUE ); | ||
2560 | } | ||
2561 | } | ||
2562 | 2405 | ||
2563 | return retval; | 2406 | return retval; |
2564 | } | 2407 | } |
@@ -2568,7 +2411,7 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) | |||
2568 | { | 2411 | { |
2569 | // The core setTETexture() method requests images, so we need | 2412 | // The core setTETexture() method requests images, so we need |
2570 | // to redirect certain avatar texture requests to different sims. | 2413 | // to redirect certain avatar texture requests to different sims. |
2571 | if (isTextureIndexBaked(te)) | 2414 | if (isIndexBakedTexture((ETextureIndex)te)) |
2572 | { | 2415 | { |
2573 | LLHost target_host = getObjectHost(); | 2416 | LLHost target_host = getObjectHost(); |
2574 | return setTETextureCore(te, uuid, target_host); | 2417 | return setTETextureCore(te, uuid, target_host); |
@@ -3217,69 +3060,69 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) | |||
3217 | (is_away != mNameAway || is_busy != mNameBusy || is_muted != mNameMute) | 3060 | (is_away != mNameAway || is_busy != mNameBusy || is_muted != mNameMute) |
3218 | || is_appearance != mNameAppearance) | 3061 | || is_appearance != mNameAppearance) |
3219 | { | 3062 | { |
3220 | char line[MAX_STRING]; /* Flawfinder: ignore */ | 3063 | std::string line; |
3221 | if (!sRenderGroupTitles) | 3064 | if (!sRenderGroupTitles) |
3222 | { | 3065 | { |
3223 | // If all group titles are turned off, stack first name | 3066 | // If all group titles are turned off, stack first name |
3224 | // on a line above last name | 3067 | // on a line above last name |
3225 | strncpy(line, firstname->getString(), MAX_STRING -1 ); /* Flawfinder: ignore */ | 3068 | line += firstname->getString(); |
3226 | line[MAX_STRING -1] = '\0'; | 3069 | line += "\n"; |
3227 | strcat(line, "\n"); | ||
3228 | } | 3070 | } |
3229 | else if (title && title->getString() && title->getString()[0] != '\0') | 3071 | else if (title && title->getString() && title->getString()[0] != '\0') |
3230 | { | 3072 | { |
3231 | strncpy(line, title->getString(), MAX_STRING -1 ); /* Flawfinder: ignore */ | 3073 | line += title->getString(); |
3232 | line[MAX_STRING -1] = '\0'; | 3074 | LLStringFn::replace_ascii_controlchars(line,LL_UNKNOWN_CHAR); |
3233 | strcat(line, "\n"); /* Flawfinder: ignore */ | 3075 | line += "\n"; |
3234 | strncat(line, firstname->getString(), MAX_STRING - strlen(line) -1 ); /* Flawfinder: ignore */ | 3076 | line += firstname->getString(); |
3235 | } | 3077 | } |
3236 | else | 3078 | else |
3237 | { | 3079 | { |
3238 | strncpy(line, firstname->getString(), MAX_STRING -1 ); /* Flawfinder: ignore */ | 3080 | line += firstname->getString(); |
3239 | line[MAX_STRING -1] = '\0'; | ||
3240 | } | 3081 | } |
3241 | 3082 | ||
3242 | strcat(line, " "); /* Flawfinder: ignore */ | 3083 | line += " "; |
3243 | strncat(line, lastname->getString(), MAX_STRING - strlen(line) -1); /* Flawfinder: ignore */ | 3084 | line += lastname->getString(); |
3244 | BOOL need_comma = FALSE; | 3085 | BOOL need_comma = FALSE; |
3245 | 3086 | ||
3246 | if (is_away || is_muted || is_busy) | 3087 | if (is_away || is_muted || is_busy) |
3247 | { | 3088 | { |
3248 | strcat(line, " ("); /* Flawfinder: ignore */ | 3089 | line += " ("; |
3249 | if (is_away) | 3090 | if (is_away) |
3250 | { | 3091 | { |
3251 | strcat(line, "Away"); /* Flawfinder: ignore */ | 3092 | line += "Away"; |
3252 | need_comma = TRUE; | 3093 | need_comma = TRUE; |
3253 | } | 3094 | } |
3254 | if (is_busy) | 3095 | if (is_busy) |
3255 | { | 3096 | { |
3256 | if (need_comma) | 3097 | if (need_comma) |
3257 | { | 3098 | { |
3258 | strcat(line, ", "); /* Flawfinder: ignore */ | 3099 | line += ", "; |
3259 | } | 3100 | } |
3260 | strcat(line, "Busy"); /* Flawfinder: ignore */ | 3101 | line += "Busy"; |
3261 | need_comma = TRUE; | 3102 | need_comma = TRUE; |
3262 | } | 3103 | } |
3263 | if (is_muted) | 3104 | if (is_muted) |
3264 | { | 3105 | { |
3265 | if (need_comma) | 3106 | if (need_comma) |
3266 | { | 3107 | { |
3267 | strcat(line, ", "); /* Flawfinder: ignore */ | 3108 | line += ", "; |
3268 | } | 3109 | } |
3269 | strcat(line, "Muted"); /* Flawfinder: ignore */ | 3110 | line += "Muted"; |
3270 | need_comma = TRUE; | 3111 | need_comma = TRUE; |
3271 | } | 3112 | } |
3272 | strcat(line,")"); /* Flawfinder: ignore */ | 3113 | line += ")"; |
3273 | } | 3114 | } |
3274 | if (is_appearance) | 3115 | if (is_appearance) |
3275 | { | 3116 | { |
3276 | strcat(line, "\n(Editing Appearance)"); /* Flawfinder: ignore */ | 3117 | line += "\n"; |
3118 | line += "(Editing Appearance)"; | ||
3277 | } | 3119 | } |
3278 | mNameAway = is_away; | 3120 | mNameAway = is_away; |
3279 | mNameBusy = is_busy; | 3121 | mNameBusy = is_busy; |
3280 | mNameMute = is_muted; | 3122 | mNameMute = is_muted; |
3281 | mNameAppearance = is_appearance; | 3123 | mNameAppearance = is_appearance; |
3282 | mTitle = title ? title->getString() : ""; | 3124 | mTitle = title ? title->getString() : ""; |
3125 | LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); | ||
3283 | mNameString = utf8str_to_wstring(line); | 3126 | mNameString = utf8str_to_wstring(line); |
3284 | new_name = TRUE; | 3127 | new_name = TRUE; |
3285 | } | 3128 | } |
@@ -3287,7 +3130,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) | |||
3287 | if (visible_chat) | 3130 | if (visible_chat) |
3288 | { | 3131 | { |
3289 | mNameText->setDropShadow(TRUE); | 3132 | mNameText->setDropShadow(TRUE); |
3290 | mNameText->setFont(LLFontGL::sSansSerif); | 3133 | mNameText->setFont(LLFontGL::getFontSansSerif()); |
3291 | mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_LEFT); | 3134 | mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_LEFT); |
3292 | mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); | 3135 | mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); |
3293 | if (new_name) | 3136 | if (new_name) |
@@ -3364,11 +3207,11 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) | |||
3364 | { | 3207 | { |
3365 | if (gSavedSettings.getBOOL("SmallAvatarNames")) | 3208 | if (gSavedSettings.getBOOL("SmallAvatarNames")) |
3366 | { | 3209 | { |
3367 | mNameText->setFont(LLFontGL::sSansSerif); | 3210 | mNameText->setFont(LLFontGL::getFontSansSerif()); |
3368 | } | 3211 | } |
3369 | else | 3212 | else |
3370 | { | 3213 | { |
3371 | mNameText->setFont(LLFontGL::sSansSerifBig); | 3214 | mNameText->setFont(LLFontGL::getFontSansSerifBig()); |
3372 | } | 3215 | } |
3373 | mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_CENTER); | 3216 | mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_CENTER); |
3374 | mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); | 3217 | mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); |
@@ -3575,6 +3418,10 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3575 | { //back 25% of max visible avatars are slow updating impostors | 3418 | { //back 25% of max visible avatars are slow updating impostors |
3576 | mUpdatePeriod = 8; | 3419 | mUpdatePeriod = 8; |
3577 | } | 3420 | } |
3421 | else if (visible && mVisibilityRank > (U32) LLVOAvatar::sMaxVisible) | ||
3422 | { //background avatars are REALLY slow updating impostors | ||
3423 | mUpdatePeriod = 16; | ||
3424 | } | ||
3578 | else if (visible && mImpostorPixelArea <= impostor_area) | 3425 | else if (visible && mImpostorPixelArea <= impostor_area) |
3579 | { // stuff in between gets an update period based on pixel area | 3426 | { // stuff in between gets an update period based on pixel area |
3580 | mUpdatePeriod = llclamp((S32) sqrtf(impostor_area*4.f/mImpostorPixelArea), 2, 8); | 3427 | mUpdatePeriod = llclamp((S32) sqrtf(impostor_area*4.f/mImpostorPixelArea), 2, 8); |
@@ -3760,7 +3607,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3760 | F32 root_roll, root_pitch, root_yaw; | 3607 | F32 root_roll, root_pitch, root_yaw; |
3761 | root_rotation.getEulerAngles(&root_roll, &root_pitch, &root_yaw); | 3608 | root_rotation.getEulerAngles(&root_roll, &root_pitch, &root_yaw); |
3762 | 3609 | ||
3763 | if (gDebugAvatarRotation) | 3610 | if (sDebugAvatarRotation) |
3764 | { | 3611 | { |
3765 | llinfos << "root_roll " << RAD_TO_DEG * root_roll | 3612 | llinfos << "root_roll " << RAD_TO_DEG * root_roll |
3766 | << " root_pitch " << RAD_TO_DEG * root_pitch | 3613 | << " root_pitch " << RAD_TO_DEG * root_pitch |
@@ -3916,7 +3763,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3916 | // Generate footstep sounds when feet hit the ground | 3763 | // Generate footstep sounds when feet hit the ground |
3917 | //------------------------------------------------------------------------- | 3764 | //------------------------------------------------------------------------- |
3918 | const LLUUID AGENT_FOOTSTEP_ANIMS[] = {ANIM_AGENT_WALK, ANIM_AGENT_RUN, ANIM_AGENT_LAND}; | 3765 | const LLUUID AGENT_FOOTSTEP_ANIMS[] = {ANIM_AGENT_WALK, ANIM_AGENT_RUN, ANIM_AGENT_LAND}; |
3919 | const S32 NUM_AGENT_FOOTSTEP_ANIMS = sizeof(AGENT_FOOTSTEP_ANIMS) / sizeof(LLUUID); | 3766 | const S32 NUM_AGENT_FOOTSTEP_ANIMS = LL_ARRAY_SIZE(AGENT_FOOTSTEP_ANIMS); |
3920 | 3767 | ||
3921 | if ( gAudiop && isAnyAnimationSignaled(AGENT_FOOTSTEP_ANIMS, NUM_AGENT_FOOTSTEP_ANIMS) ) | 3768 | if ( gAudiop && isAnyAnimationSignaled(AGENT_FOOTSTEP_ANIMS, NUM_AGENT_FOOTSTEP_ANIMS) ) |
3922 | { | 3769 | { |
@@ -3950,7 +3797,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3950 | // AUDIO_STEP_LO_GAIN, AUDIO_STEP_HI_GAIN ); | 3797 | // AUDIO_STEP_LO_GAIN, AUDIO_STEP_HI_GAIN ); |
3951 | 3798 | ||
3952 | const F32 STEP_VOLUME = 0.5f; | 3799 | const F32 STEP_VOLUME = 0.5f; |
3953 | LLUUID& step_sound_id = getStepSound(); | 3800 | const LLUUID& step_sound_id = getStepSound(); |
3954 | 3801 | ||
3955 | LLVector3d foot_pos_global = gAgent.getPosGlobalFromAgent(foot_pos_agent); | 3802 | LLVector3d foot_pos_global = gAgent.getPosGlobalFromAgent(foot_pos_agent); |
3956 | 3803 | ||
@@ -4184,19 +4031,19 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) | |||
4184 | if (mNeedsSkin) | 4031 | if (mNeedsSkin) |
4185 | { | 4032 | { |
4186 | //generate animated mesh | 4033 | //generate animated mesh |
4187 | mLowerBodyLOD.updateJointGeometry(); | 4034 | mMeshLOD[MESH_ID_LOWER_BODY]->updateJointGeometry(); |
4188 | mUpperBodyLOD.updateJointGeometry(); | 4035 | mMeshLOD[MESH_ID_UPPER_BODY]->updateJointGeometry(); |
4189 | 4036 | ||
4190 | if( isWearingWearableType( WT_SKIRT ) ) | 4037 | if( isWearingWearableType( WT_SKIRT ) ) |
4191 | { | 4038 | { |
4192 | mSkirtLOD.updateJointGeometry(); | 4039 | mMeshLOD[MESH_ID_SKIRT]->updateJointGeometry(); |
4193 | } | 4040 | } |
4194 | 4041 | ||
4195 | if (!mIsSelf || gAgent.needsRenderHead()) | 4042 | if (!mIsSelf || gAgent.needsRenderHead() || LLPipeline::sShadowRender) |
4196 | { | 4043 | { |
4197 | mEyeLashLOD.updateJointGeometry(); | 4044 | mMeshLOD[MESH_ID_EYELASH]->updateJointGeometry(); |
4198 | mHeadLOD.updateJointGeometry(); | 4045 | mMeshLOD[MESH_ID_HEAD]->updateJointGeometry(); |
4199 | mHairLOD.updateJointGeometry(); | 4046 | mMeshLOD[MESH_ID_HAIR]->updateJointGeometry(); |
4200 | } | 4047 | } |
4201 | mNeedsSkin = FALSE; | 4048 | mNeedsSkin = FALSE; |
4202 | 4049 | ||
@@ -4284,7 +4131,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) | |||
4284 | gGL.flush(); | 4131 | gGL.flush(); |
4285 | } | 4132 | } |
4286 | //-------------------------------------------------------------------- | 4133 | //-------------------------------------------------------------------- |
4287 | // render all geomety attached to the skeleton | 4134 | // render all geometry attached to the skeleton |
4288 | //-------------------------------------------------------------------- | 4135 | //-------------------------------------------------------------------- |
4289 | static LLStat render_stat; | 4136 | static LLStat render_stat; |
4290 | 4137 | ||
@@ -4292,19 +4139,52 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) | |||
4292 | 4139 | ||
4293 | if (pass == AVATAR_RENDER_PASS_SINGLE) | 4140 | if (pass == AVATAR_RENDER_PASS_SINGLE) |
4294 | { | 4141 | { |
4142 | const bool should_alpha_mask = mHasBakedHair && isTextureDefined(TEX_HEAD_BAKED) && isTextureDefined(TEX_UPPER_BAKED) | ||
4143 | && isTextureDefined(TEX_LOWER_BAKED) && mBakedTextureData[BAKED_HEAD].mIsLoaded | ||
4144 | && mBakedTextureData[BAKED_UPPER].mIsLoaded && mBakedTextureData[BAKED_LOWER].mIsLoaded | ||
4145 | && !LLDrawPoolAlpha::sShowDebugAlpha; // Don't alpha mask if "Highlight Transparent" checked | ||
4146 | |||
4147 | LLGLState test(GL_ALPHA_TEST, should_alpha_mask); | ||
4148 | |||
4149 | if (should_alpha_mask) | ||
4150 | { | ||
4151 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); | ||
4152 | } | ||
4153 | |||
4295 | BOOL first_pass = TRUE; | 4154 | BOOL first_pass = TRUE; |
4296 | if (!mIsSelf || gAgent.needsRenderHead()) | 4155 | if (!LLDrawPoolAvatar::sSkipOpaque) |
4297 | { | 4156 | { |
4298 | num_indices += mHeadLOD.render(mAdjustedPixelArea); | 4157 | if (!mIsSelf || gAgent.needsRenderHead() || LLPipeline::sShadowRender) |
4299 | first_pass = FALSE; | 4158 | { |
4159 | if (isTextureVisible(TEX_HEAD_BAKED) || mIsDummy) | ||
4160 | { | ||
4161 | num_indices += mMeshLOD[MESH_ID_HEAD]->render(mAdjustedPixelArea, TRUE, mIsDummy); | ||
4162 | first_pass = FALSE; | ||
4163 | } | ||
4164 | } | ||
4165 | if (isTextureVisible(TEX_UPPER_BAKED) || mIsDummy) | ||
4166 | { | ||
4167 | num_indices += mMeshLOD[MESH_ID_UPPER_BODY]->render(mAdjustedPixelArea, first_pass, mIsDummy); | ||
4168 | first_pass = FALSE; | ||
4169 | } | ||
4170 | |||
4171 | if (isTextureVisible(TEX_LOWER_BAKED) || mIsDummy) | ||
4172 | { | ||
4173 | num_indices += mMeshLOD[MESH_ID_LOWER_BODY]->render(mAdjustedPixelArea, first_pass, mIsDummy); | ||
4174 | first_pass = FALSE; | ||
4175 | } | ||
4300 | } | 4176 | } |
4301 | num_indices += mUpperBodyLOD.render(mAdjustedPixelArea, first_pass); | ||
4302 | num_indices += mLowerBodyLOD.render(mAdjustedPixelArea, FALSE); | ||
4303 | 4177 | ||
4178 | gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); | ||
4179 | |||
4180 | if (!LLDrawPoolAvatar::sSkipTransparent || LLPipeline::sImpostorRender) | ||
4304 | { | 4181 | { |
4305 | LLGLEnable blend(GL_BLEND); | 4182 | if (!mIsDummy) |
4306 | LLGLEnable test(GL_ALPHA_TEST); | 4183 | { |
4307 | num_indices += renderTransparent(); | 4184 | LLGLEnable blend(GL_BLEND); |
4185 | LLGLEnable test(GL_ALPHA_TEST); | ||
4186 | } | ||
4187 | num_indices += renderTransparent(first_pass); | ||
4308 | } | 4188 | } |
4309 | } | 4189 | } |
4310 | 4190 | ||
@@ -4317,26 +4197,36 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) | |||
4317 | return num_indices; | 4197 | return num_indices; |
4318 | } | 4198 | } |
4319 | 4199 | ||
4320 | U32 LLVOAvatar::renderTransparent() | 4200 | U32 LLVOAvatar::renderTransparent(BOOL first_pass) |
4321 | { | 4201 | { |
4322 | U32 num_indices = 0; | 4202 | U32 num_indices = 0; |
4323 | BOOL first_pass = FALSE; | 4203 | if( isWearingWearableType( WT_SKIRT ) && (mIsDummy || isTextureVisible(TEX_SKIRT_BAKED)) ) |
4324 | if( isWearingWearableType( WT_SKIRT ) ) | ||
4325 | { | 4204 | { |
4326 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.25f); | 4205 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.25f); |
4327 | num_indices += mSkirtLOD.render(mAdjustedPixelArea, FALSE); | 4206 | num_indices += mMeshLOD[MESH_ID_SKIRT]->render(mAdjustedPixelArea, FALSE); |
4328 | first_pass = FALSE; | 4207 | first_pass = FALSE; |
4329 | gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); | 4208 | gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); |
4330 | } | 4209 | } |
4331 | 4210 | ||
4332 | if (!mIsSelf || gAgent.needsRenderHead()) | 4211 | if (!mIsSelf || gAgent.needsRenderHead() || LLPipeline::sShadowRender) |
4333 | { | 4212 | { |
4334 | if (LLPipeline::sImpostorRender) | 4213 | if (LLPipeline::sImpostorRender) |
4335 | { | 4214 | { |
4336 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); | 4215 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); |
4337 | } | 4216 | } |
4338 | num_indices += mEyeLashLOD.render(mAdjustedPixelArea, first_pass); | 4217 | |
4339 | num_indices += mHairLOD.render(mAdjustedPixelArea, FALSE); | 4218 | if (isTextureVisible(TEX_HEAD_BAKED)) |
4219 | { | ||
4220 | num_indices += mMeshLOD[MESH_ID_EYELASH]->render(mAdjustedPixelArea, first_pass, mIsDummy); | ||
4221 | first_pass = FALSE; | ||
4222 | } | ||
4223 | // Can't test for baked hair being defined, since that won't always be the case (not all viewers send baked hair) | ||
4224 | // TODO: 1.25 will be able to switch this logic back to calling isTextureVisible(); | ||
4225 | if (getTEImage(TEX_HAIR_BAKED)->getID() != IMG_INVISIBLE || LLDrawPoolAlpha::sShowDebugAlpha) | ||
4226 | { | ||
4227 | num_indices += mMeshLOD[MESH_ID_HAIR]->render(mAdjustedPixelArea, first_pass, mIsDummy); | ||
4228 | first_pass = FALSE; | ||
4229 | } | ||
4340 | if (LLPipeline::sImpostorRender) | 4230 | if (LLPipeline::sImpostorRender) |
4341 | { | 4231 | { |
4342 | gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); | 4232 | gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); |
@@ -4368,8 +4258,22 @@ U32 LLVOAvatar::renderRigid() | |||
4368 | return 0; | 4258 | return 0; |
4369 | } | 4259 | } |
4370 | 4260 | ||
4371 | num_indices += mEyeBallLeftLOD.render(mAdjustedPixelArea); | 4261 | if (isTextureVisible(TEX_EYES_BAKED) || mIsDummy) |
4372 | num_indices += mEyeBallRightLOD.render(mAdjustedPixelArea); | 4262 | { |
4263 | // If the meshes need to be drawn, enable alpha masking but not blending | ||
4264 | bool should_alpha_mask = mHasBakedHair && mBakedTextureData[BAKED_EYES].mIsLoaded; | ||
4265 | LLGLState test(GL_ALPHA_TEST, should_alpha_mask); | ||
4266 | |||
4267 | if (should_alpha_mask) | ||
4268 | { | ||
4269 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); | ||
4270 | } | ||
4271 | |||
4272 | num_indices += mMeshLOD[MESH_ID_EYEBALL_LEFT]->render(mAdjustedPixelArea, TRUE, mIsDummy); | ||
4273 | num_indices += mMeshLOD[MESH_ID_EYEBALL_RIGHT]->render(mAdjustedPixelArea, TRUE, mIsDummy); | ||
4274 | |||
4275 | gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); | ||
4276 | } | ||
4373 | 4277 | ||
4374 | return num_indices; | 4278 | return num_indices; |
4375 | } | 4279 | } |
@@ -4392,6 +4296,13 @@ U32 LLVOAvatar::renderFootShadows() | |||
4392 | { | 4296 | { |
4393 | return 0; | 4297 | return 0; |
4394 | } | 4298 | } |
4299 | |||
4300 | // Don't render foot shadows if your lower body is completely invisible. | ||
4301 | // (non-humanoid avatars rule!) | ||
4302 | if (! isTextureVisible(TEX_LOWER_BAKED)) | ||
4303 | { | ||
4304 | return 0; | ||
4305 | } | ||
4395 | 4306 | ||
4396 | // Update the shadow, tractor, and text label geometry. | 4307 | // Update the shadow, tractor, and text label geometry. |
4397 | if (mDrawable->isState(LLDrawable::REBUILD_SHADOW) && !isImpostor()) | 4308 | if (mDrawable->isState(LLDrawable::REBUILD_SHADOW) && !isImpostor()) |
@@ -4401,7 +4312,7 @@ U32 LLVOAvatar::renderFootShadows() | |||
4401 | } | 4312 | } |
4402 | 4313 | ||
4403 | U32 foot_mask = LLVertexBuffer::MAP_VERTEX | | 4314 | U32 foot_mask = LLVertexBuffer::MAP_VERTEX | |
4404 | LLVertexBuffer::MAP_TEXCOORD; | 4315 | LLVertexBuffer::MAP_TEXCOORD0; |
4405 | 4316 | ||
4406 | LLGLDepthTest test(GL_TRUE, GL_FALSE); | 4317 | LLGLDepthTest test(GL_TRUE, GL_FALSE); |
4407 | //render foot shadows | 4318 | //render foot shadows |
@@ -4434,23 +4345,6 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color) | |||
4434 | LLGLEnable test(GL_ALPHA_TEST); | 4345 | LLGLEnable test(GL_ALPHA_TEST); |
4435 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.f); | 4346 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.f); |
4436 | 4347 | ||
4437 | F32 blend = gFrameTimeSeconds - mFadeTime; | ||
4438 | |||
4439 | LLGLState gl_blend(GL_BLEND, blend < 1.f ? TRUE : FALSE); | ||
4440 | gGL.setSceneBlendType(LLRender::BT_ALPHA); | ||
4441 | |||
4442 | F32 alpha; | ||
4443 | if (mVisibilityRank >= (U32) LLVOAvatar::sMaxVisible) | ||
4444 | { //fade out | ||
4445 | alpha = 1.f - llmin(blend, 1.f); | ||
4446 | } | ||
4447 | else | ||
4448 | { //fade in | ||
4449 | alpha = llmin(blend, 1.f); | ||
4450 | } | ||
4451 | |||
4452 | color.mV[3] = (U8) (alpha*255); | ||
4453 | |||
4454 | gGL.color4ubv(color.mV); | 4348 | gGL.color4ubv(color.mV); |
4455 | gGL.getTexUnit(0)->bind(&mImpostor); | 4349 | gGL.getTexUnit(0)->bind(&mImpostor); |
4456 | gGL.begin(LLRender::QUADS); | 4350 | gGL.begin(LLRender::QUADS); |
@@ -4479,12 +4373,6 @@ void LLVOAvatar::updateTextures(LLAgent &agent) | |||
4479 | { | 4373 | { |
4480 | return; | 4374 | return; |
4481 | } | 4375 | } |
4482 | |||
4483 | BOOL head_baked = ( getTEImage( TEX_HEAD_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
4484 | BOOL upper_baked = ( getTEImage( TEX_UPPER_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
4485 | BOOL lower_baked = ( getTEImage( TEX_LOWER_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
4486 | BOOL eyes_baked = ( getTEImage( TEX_EYES_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
4487 | BOOL skirt_baked = ( getTEImage( TEX_SKIRT_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
4488 | 4376 | ||
4489 | if( mIsSelf ) | 4377 | if( mIsSelf ) |
4490 | { | 4378 | { |
@@ -4495,30 +4383,18 @@ void LLVOAvatar::updateTextures(LLAgent &agent) | |||
4495 | render_avatar = isVisible() && !mCulled; | 4383 | render_avatar = isVisible() && !mCulled; |
4496 | } | 4384 | } |
4497 | 4385 | ||
4498 | // bind the texture so that they'll be decoded | 4386 | std::vector<bool> layer_baked; |
4499 | // slightly inefficient, we can short-circuit this | 4387 | for (U32 i = 0; i < mBakedTextureData.size(); i++) |
4500 | // if we have to | ||
4501 | if( render_avatar && !gGLManager.mIsDisabled ) | ||
4502 | { | 4388 | { |
4503 | if( head_baked && ! mHeadBakedLoaded ) | 4389 | layer_baked.push_back(isTextureDefined(mBakedTextureData[i].mTextureIndex)); |
4504 | { | 4390 | // bind the texture so that they'll be decoded slightly |
4505 | gGL.getTexUnit(0)->bind(getTEImage( TEX_HEAD_BAKED )); | 4391 | // inefficient, we can short-circuit this if we have to |
4506 | } | 4392 | if( render_avatar && !gGLManager.mIsDisabled ) |
4507 | if( upper_baked && ! mUpperBakedLoaded ) | ||
4508 | { | ||
4509 | gGL.getTexUnit(0)->bind(getTEImage( TEX_UPPER_BAKED )); | ||
4510 | } | ||
4511 | if( lower_baked && ! mLowerBakedLoaded ) | ||
4512 | { | ||
4513 | gGL.getTexUnit(0)->bind(getTEImage( TEX_LOWER_BAKED )); | ||
4514 | } | ||
4515 | if( eyes_baked && ! mEyesBakedLoaded ) | ||
4516 | { | 4393 | { |
4517 | gGL.getTexUnit(0)->bind(getTEImage( TEX_EYES_BAKED )); | 4394 | if (layer_baked[i] && !mBakedTextureData[i].mIsLoaded) |
4518 | } | 4395 | { |
4519 | if( skirt_baked && ! mSkirtBakedLoaded ) | 4396 | gGL.getTexUnit(0)->bind(getTEImage( mBakedTextureData[i].mTextureIndex )); |
4520 | { | 4397 | } |
4521 | gGL.getTexUnit(0)->bind(getTEImage( TEX_SKIRT_BAKED )); | ||
4522 | } | 4398 | } |
4523 | } | 4399 | } |
4524 | 4400 | ||
@@ -4550,9 +4426,9 @@ void LLVOAvatar::updateTextures(LLAgent &agent) | |||
4550 | mMaxPixelArea = 0.f; | 4426 | mMaxPixelArea = 0.f; |
4551 | mMinPixelArea = 99999999.f; | 4427 | mMinPixelArea = 99999999.f; |
4552 | mHasGrey = FALSE; // debug | 4428 | mHasGrey = FALSE; // debug |
4553 | for (U32 i = 0; i < getNumTEs(); i++) | 4429 | for (U32 index = 0; index < getNumTEs(); index++) |
4554 | { | 4430 | { |
4555 | LLViewerImage *imagep = getTEImage(i); | 4431 | LLViewerImage *imagep = getTEImage(index); |
4556 | if (imagep) | 4432 | if (imagep) |
4557 | { | 4433 | { |
4558 | // Debugging code - maybe non-self avatars are downloading textures? | 4434 | // Debugging code - maybe non-self avatars are downloading textures? |
@@ -4564,131 +4440,39 @@ void LLVOAvatar::updateTextures(LLAgent &agent) | |||
4564 | // << " desired " << imagep->getDesiredDiscardLevel() | 4440 | // << " desired " << imagep->getDesiredDiscardLevel() |
4565 | // << llendl; | 4441 | // << llendl; |
4566 | 4442 | ||
4567 | const LLTextureEntry *te = getTE(i); | 4443 | const LLTextureEntry *te = getTE(index); |
4568 | F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT); | 4444 | F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT); |
4569 | S32 boost_level = mIsSelf ? LLViewerImage::BOOST_AVATAR_BAKED_SELF : LLViewerImage::BOOST_AVATAR_BAKED; | 4445 | S32 boost_level = mIsSelf ? LLViewerImage::BOOST_AVATAR_BAKED_SELF : LLViewerImage::BOOST_AVATAR_BAKED; |
4570 | 4446 | ||
4571 | // Spam if this is a baked texture, not set to default image, without valid host info | 4447 | // Spam if this is a baked texture, not set to default image, without valid host info |
4572 | if (isTextureIndexBaked(i) | 4448 | if (isIndexBakedTexture((ETextureIndex)index) |
4573 | && imagep->getID() != IMG_DEFAULT_AVATAR | 4449 | && imagep->getID() != IMG_DEFAULT_AVATAR |
4574 | && !imagep->getTargetHost().isOk()) | 4450 | && !imagep->getTargetHost().isOk()) |
4575 | { | 4451 | { |
4576 | llwarns << "LLVOAvatar::updateTextures No host for texture " | 4452 | LL_WARNS_ONCE("Texture") << "LLVOAvatar::updateTextures No host for texture " |
4577 | << imagep->getID() << " for avatar " | 4453 | << imagep->getID() << " for avatar " |
4578 | << (mIsSelf ? "<myself>" : getID().asString()) | 4454 | << (mIsSelf ? "<myself>" : getID().asString()) |
4579 | << " on host " << getRegion()->getHost() << llendl; | 4455 | << " on host " << getRegion()->getHost() << llendl; |
4580 | } | 4456 | } |
4581 | |||
4582 | switch( i ) | ||
4583 | { | ||
4584 | // Head | ||
4585 | case TEX_HEAD_BODYPAINT: | ||
4586 | addLocalTextureStats( LOCTEX_HEAD_BODYPAINT, imagep, texel_area_ratio, render_avatar, head_baked ); | ||
4587 | break; | ||
4588 | |||
4589 | // Upper | ||
4590 | case TEX_UPPER_JACKET: | ||
4591 | addLocalTextureStats( LOCTEX_UPPER_JACKET, imagep, texel_area_ratio, render_avatar, upper_baked ); | ||
4592 | break; | ||
4593 | |||
4594 | case TEX_UPPER_SHIRT: | ||
4595 | addLocalTextureStats( LOCTEX_UPPER_SHIRT, imagep, texel_area_ratio, render_avatar, upper_baked ); | ||
4596 | break; | ||
4597 | |||
4598 | case TEX_UPPER_GLOVES: | ||
4599 | addLocalTextureStats( LOCTEX_UPPER_GLOVES, imagep, texel_area_ratio, render_avatar, upper_baked ); | ||
4600 | break; | ||
4601 | |||
4602 | case TEX_UPPER_UNDERSHIRT: | ||
4603 | addLocalTextureStats( LOCTEX_UPPER_UNDERSHIRT, imagep, texel_area_ratio, render_avatar, upper_baked ); | ||
4604 | break; | ||
4605 | |||
4606 | case TEX_UPPER_BODYPAINT: | ||
4607 | addLocalTextureStats( LOCTEX_UPPER_BODYPAINT, imagep, texel_area_ratio, render_avatar, upper_baked ); | ||
4608 | break; | ||
4609 | |||
4610 | // Lower | ||
4611 | case TEX_LOWER_JACKET: | ||
4612 | addLocalTextureStats( LOCTEX_LOWER_JACKET, imagep, texel_area_ratio, render_avatar, lower_baked ); | ||
4613 | break; | ||
4614 | |||
4615 | case TEX_LOWER_PANTS: | ||
4616 | addLocalTextureStats( LOCTEX_LOWER_PANTS, imagep, texel_area_ratio, render_avatar, lower_baked ); | ||
4617 | break; | ||
4618 | |||
4619 | case TEX_LOWER_SHOES: | ||
4620 | addLocalTextureStats( LOCTEX_LOWER_SHOES, imagep, texel_area_ratio, render_avatar, lower_baked ); | ||
4621 | break; | ||
4622 | |||
4623 | case TEX_LOWER_SOCKS: | ||
4624 | addLocalTextureStats( LOCTEX_LOWER_SOCKS, imagep, texel_area_ratio, render_avatar, lower_baked ); | ||
4625 | break; | ||
4626 | 4457 | ||
4627 | case TEX_LOWER_UNDERPANTS: | 4458 | /* switch(index) |
4628 | addLocalTextureStats( LOCTEX_LOWER_UNDERPANTS, imagep, texel_area_ratio, render_avatar, lower_baked ); | 4459 | case TEX_HEAD_BODYPAINT: |
4629 | break; | 4460 | addLocalTextureStats( LOCTEX_HEAD_BODYPAINT, imagep, texel_area_ratio, render_avatar, head_baked ); */ |
4630 | 4461 | const LLVOAvatarDictionary::TextureDictionaryEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)index); | |
4631 | case TEX_LOWER_BODYPAINT: | 4462 | if (texture_dict->mIsUsedByBakedTexture) |
4632 | addLocalTextureStats( LOCTEX_LOWER_BODYPAINT, imagep, texel_area_ratio, render_avatar, lower_baked ); | 4463 | { |
4633 | break; | 4464 | const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; |
4634 | 4465 | if (texture_dict->mIsLocalTexture) | |
4635 | // Eyes | ||
4636 | case TEX_EYES_IRIS: | ||
4637 | addLocalTextureStats( LOCTEX_EYES_IRIS, imagep, texel_area_ratio, render_avatar, eyes_baked ); | ||
4638 | break; | ||
4639 | |||
4640 | // Skirt | ||
4641 | case TEX_SKIRT: | ||
4642 | addLocalTextureStats( LOCTEX_SKIRT, imagep, texel_area_ratio, render_avatar, skirt_baked ); | ||
4643 | break; | ||
4644 | |||
4645 | // Baked | ||
4646 | case TEX_HEAD_BAKED: | ||
4647 | if (head_baked) | ||
4648 | { | ||
4649 | addBakedTextureStats( imagep, mPixelArea, texel_area_ratio, boost_level ); | ||
4650 | } | ||
4651 | break; | ||
4652 | |||
4653 | case TEX_UPPER_BAKED: | ||
4654 | if (upper_baked) | ||
4655 | { | ||
4656 | addBakedTextureStats( imagep, mPixelArea, texel_area_ratio, boost_level ); | ||
4657 | } | ||
4658 | break; | ||
4659 | |||
4660 | case TEX_LOWER_BAKED: | ||
4661 | if (lower_baked) | ||
4662 | { | ||
4663 | addBakedTextureStats( imagep, mPixelArea, texel_area_ratio, boost_level ); | ||
4664 | } | ||
4665 | break; | ||
4666 | |||
4667 | case TEX_EYES_BAKED: | ||
4668 | if (eyes_baked) | ||
4669 | { | 4466 | { |
4670 | addBakedTextureStats( imagep, mPixelArea, texel_area_ratio, boost_level ); | 4467 | addLocalTextureStats((ETextureIndex)index, imagep, texel_area_ratio, render_avatar, layer_baked[baked_index]); |
4671 | } | 4468 | } |
4672 | break; | 4469 | else if (texture_dict->mIsBakedTexture) |
4673 | |||
4674 | case TEX_SKIRT_BAKED: | ||
4675 | if (skirt_baked) | ||
4676 | { | 4470 | { |
4677 | addBakedTextureStats( imagep, mPixelArea, texel_area_ratio, boost_level ); | 4471 | if (layer_baked[baked_index]) |
4472 | { | ||
4473 | addBakedTextureStats( imagep, mPixelArea, texel_area_ratio, boost_level ); | ||
4474 | } | ||
4678 | } | 4475 | } |
4679 | break; | ||
4680 | |||
4681 | case TEX_HAIR: | ||
4682 | // Hair is neither a local texture used for baking, nor the output | ||
4683 | // of the baking process. It's just a texture that happens to be | ||
4684 | // used to draw avatars. Hence BOOST_AVATAR. JC | ||
4685 | boost_level = mIsSelf ? LLViewerImage::BOOST_AVATAR_SELF : LLViewerImage::BOOST_AVATAR; | ||
4686 | addBakedTextureStats( imagep, mPixelArea, texel_area_ratio, boost_level ); | ||
4687 | break; | ||
4688 | |||
4689 | default: | ||
4690 | llassert(0); | ||
4691 | break; | ||
4692 | } | 4476 | } |
4693 | } | 4477 | } |
4694 | } | 4478 | } |
@@ -4705,22 +4489,24 @@ void LLVOAvatar::updateTextures(LLAgent &agent) | |||
4705 | } | 4489 | } |
4706 | 4490 | ||
4707 | 4491 | ||
4708 | void LLVOAvatar::addLocalTextureStats( LLVOAvatar::ELocTexIndex idx, LLViewerImage* imagep, | 4492 | void LLVOAvatar::addLocalTextureStats( ETextureIndex idx, LLViewerImage* imagep, |
4709 | F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked ) | 4493 | F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked ) |
4710 | { | 4494 | { |
4495 | if (!isIndexLocalTexture(idx)) return; | ||
4496 | |||
4711 | if (!covered_by_baked && render_avatar) // render_avatar is always true if mIsSelf | 4497 | if (!covered_by_baked && render_avatar) // render_avatar is always true if mIsSelf |
4712 | { | 4498 | { |
4713 | if (mLocalTexture[ idx ].notNull() && mLocalTexture[idx]->getID() != IMG_DEFAULT_AVATAR) | 4499 | if (getLocalTextureID(idx) != IMG_DEFAULT_AVATAR) |
4714 | { | 4500 | { |
4715 | F32 desired_pixels; | 4501 | F32 desired_pixels; |
4716 | if( mIsSelf ) | 4502 | if( mIsSelf ) |
4717 | { | 4503 | { |
4718 | desired_pixels = llmin(mPixelArea, (F32)LOCTEX_IMAGE_AREA_SELF ); | 4504 | desired_pixels = llmin(mPixelArea, (F32)TEX_IMAGE_AREA_SELF ); |
4719 | imagep->setBoostLevel(LLViewerImage::BOOST_AVATAR_SELF); | 4505 | imagep->setBoostLevel(LLViewerImage::BOOST_AVATAR_SELF); |
4720 | } | 4506 | } |
4721 | else | 4507 | else |
4722 | { | 4508 | { |
4723 | desired_pixels = llmin(mPixelArea, (F32)LOCTEX_IMAGE_AREA_OTHER ); | 4509 | desired_pixels = llmin(mPixelArea, (F32)TEX_IMAGE_AREA_OTHER ); |
4724 | imagep->setBoostLevel(LLViewerImage::BOOST_AVATAR); | 4510 | imagep->setBoostLevel(LLViewerImage::BOOST_AVATAR); |
4725 | } | 4511 | } |
4726 | imagep->addTextureStats( desired_pixels / texel_area_ratio ); | 4512 | imagep->addTextureStats( desired_pixels / texel_area_ratio ); |
@@ -4731,11 +4517,8 @@ void LLVOAvatar::addLocalTextureStats( LLVOAvatar::ELocTexIndex idx, LLViewerIma | |||
4731 | } | 4517 | } |
4732 | else | 4518 | else |
4733 | { | 4519 | { |
4734 | if (mLocalTexture[idx]->getID() == IMG_DEFAULT_AVATAR) | 4520 | // texture asset is missing |
4735 | { | 4521 | mHasGrey = TRUE; // for statistics gathering |
4736 | // texture asset is missing | ||
4737 | mHasGrey = TRUE; // for statistics gathering | ||
4738 | } | ||
4739 | } | 4522 | } |
4740 | } | 4523 | } |
4741 | } | 4524 | } |
@@ -4803,7 +4586,7 @@ void LLVOAvatar::resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos | |||
4803 | //----------------------------------------------------------------------------- | 4586 | //----------------------------------------------------------------------------- |
4804 | // getStepSound() | 4587 | // getStepSound() |
4805 | //----------------------------------------------------------------------------- | 4588 | //----------------------------------------------------------------------------- |
4806 | LLUUID& LLVOAvatar::getStepSound() | 4589 | const LLUUID& LLVOAvatar::getStepSound() const |
4807 | { | 4590 | { |
4808 | if ( mStepOnLand ) | 4591 | if ( mStepOnLand ) |
4809 | { | 4592 | { |
@@ -5241,7 +5024,7 @@ F32 LLVOAvatar::getPixelArea() const | |||
5241 | //----------------------------------------------------------------------------- | 5024 | //----------------------------------------------------------------------------- |
5242 | LLPolyMesh* LLVOAvatar::getHeadMesh() | 5025 | LLPolyMesh* LLVOAvatar::getHeadMesh() |
5243 | { | 5026 | { |
5244 | return mHeadMesh0.getMesh(); | 5027 | return mMeshLOD[MESH_ID_HEAD]->mMeshParts[0]->getMesh(); |
5245 | } | 5028 | } |
5246 | 5029 | ||
5247 | 5030 | ||
@@ -5250,7 +5033,7 @@ LLPolyMesh* LLVOAvatar::getHeadMesh() | |||
5250 | //----------------------------------------------------------------------------- | 5033 | //----------------------------------------------------------------------------- |
5251 | LLPolyMesh* LLVOAvatar::getUpperBodyMesh() | 5034 | LLPolyMesh* LLVOAvatar::getUpperBodyMesh() |
5252 | { | 5035 | { |
5253 | return mUpperBodyMesh0.getMesh(); | 5036 | return mMeshLOD[MESH_ID_UPPER_BODY]->mMeshParts[0]->getMesh(); |
5254 | } | 5037 | } |
5255 | 5038 | ||
5256 | 5039 | ||
@@ -5349,7 +5132,7 @@ BOOL LLVOAvatar::loadAvatar() | |||
5349 | // LLFastTimer t(LLFastTimer::FTM_LOAD_AVATAR); | 5132 | // LLFastTimer t(LLFastTimer::FTM_LOAD_AVATAR); |
5350 | 5133 | ||
5351 | // avatar_skeleton.xml | 5134 | // avatar_skeleton.xml |
5352 | if( !buildSkeleton(sSkeletonInfo) ) | 5135 | if( !buildSkeleton(sAvatarSkeletonInfo) ) |
5353 | { | 5136 | { |
5354 | llwarns << "avatar file: buildSkeleton() failed" << llendl; | 5137 | llwarns << "avatar file: buildSkeleton() failed" << llendl; |
5355 | return FALSE; | 5138 | return FALSE; |
@@ -5370,10 +5153,10 @@ BOOL LLVOAvatar::loadAvatar() | |||
5370 | } | 5153 | } |
5371 | 5154 | ||
5372 | // avatar_lad.xml : <global_color> | 5155 | // avatar_lad.xml : <global_color> |
5373 | if( sAvatarInfo->mTexSkinColorInfo ) | 5156 | if( sAvatarXmlInfo->mTexSkinColorInfo ) |
5374 | { | 5157 | { |
5375 | mTexSkinColor = new LLTexGlobalColor( this ); | 5158 | mTexSkinColor = new LLTexGlobalColor( this ); |
5376 | if( !mTexSkinColor->setInfo( sAvatarInfo->mTexSkinColorInfo ) ) | 5159 | if( !mTexSkinColor->setInfo( sAvatarXmlInfo->mTexSkinColorInfo ) ) |
5377 | { | 5160 | { |
5378 | llwarns << "avatar file: mTexSkinColor->setInfo() failed" << llendl; | 5161 | llwarns << "avatar file: mTexSkinColor->setInfo() failed" << llendl; |
5379 | return FALSE; | 5162 | return FALSE; |
@@ -5384,10 +5167,10 @@ BOOL LLVOAvatar::loadAvatar() | |||
5384 | llwarns << "<global_color> name=\"skin_color\" not found" << llendl; | 5167 | llwarns << "<global_color> name=\"skin_color\" not found" << llendl; |
5385 | return FALSE; | 5168 | return FALSE; |
5386 | } | 5169 | } |
5387 | if( sAvatarInfo->mTexHairColorInfo ) | 5170 | if( sAvatarXmlInfo->mTexHairColorInfo ) |
5388 | { | 5171 | { |
5389 | mTexHairColor = new LLTexGlobalColor( this ); | 5172 | mTexHairColor = new LLTexGlobalColor( this ); |
5390 | if( !mTexHairColor->setInfo( sAvatarInfo->mTexHairColorInfo ) ) | 5173 | if( !mTexHairColor->setInfo( sAvatarXmlInfo->mTexHairColorInfo ) ) |
5391 | { | 5174 | { |
5392 | llwarns << "avatar file: mTexHairColor->setInfo() failed" << llendl; | 5175 | llwarns << "avatar file: mTexHairColor->setInfo() failed" << llendl; |
5393 | return FALSE; | 5176 | return FALSE; |
@@ -5398,10 +5181,10 @@ BOOL LLVOAvatar::loadAvatar() | |||
5398 | llwarns << "<global_color> name=\"hair_color\" not found" << llendl; | 5181 | llwarns << "<global_color> name=\"hair_color\" not found" << llendl; |
5399 | return FALSE; | 5182 | return FALSE; |
5400 | } | 5183 | } |
5401 | if( sAvatarInfo->mTexEyeColorInfo ) | 5184 | if( sAvatarXmlInfo->mTexEyeColorInfo ) |
5402 | { | 5185 | { |
5403 | mTexEyeColor = new LLTexGlobalColor( this ); | 5186 | mTexEyeColor = new LLTexGlobalColor( this ); |
5404 | if( !mTexEyeColor->setInfo( sAvatarInfo->mTexEyeColorInfo ) ) | 5187 | if( !mTexEyeColor->setInfo( sAvatarXmlInfo->mTexEyeColorInfo ) ) |
5405 | { | 5188 | { |
5406 | llwarns << "avatar file: mTexEyeColor->setInfo() failed" << llendl; | 5189 | llwarns << "avatar file: mTexEyeColor->setInfo() failed" << llendl; |
5407 | return FALSE; | 5190 | return FALSE; |
@@ -5414,15 +5197,15 @@ BOOL LLVOAvatar::loadAvatar() | |||
5414 | } | 5197 | } |
5415 | 5198 | ||
5416 | // avatar_lad.xml : <layer_set> | 5199 | // avatar_lad.xml : <layer_set> |
5417 | if (sAvatarInfo->mLayerInfoList.empty()) | 5200 | if (sAvatarXmlInfo->mLayerInfoList.empty()) |
5418 | { | 5201 | { |
5419 | llwarns << "avatar file: missing <layer_set> node" << llendl; | 5202 | llwarns << "avatar file: missing <layer_set> node" << llendl; |
5420 | } | 5203 | } |
5421 | else | 5204 | else |
5422 | { | 5205 | { |
5423 | LLVOAvatarInfo::layer_info_list_t::iterator iter; | 5206 | LLVOAvatarXmlInfo::layer_info_list_t::iterator iter; |
5424 | for (iter = sAvatarInfo->mLayerInfoList.begin(); | 5207 | for (iter = sAvatarXmlInfo->mLayerInfoList.begin(); |
5425 | iter != sAvatarInfo->mLayerInfoList.end(); iter++) | 5208 | iter != sAvatarXmlInfo->mLayerInfoList.end(); iter++) |
5426 | { | 5209 | { |
5427 | LLTexLayerSetInfo *info = *iter; | 5210 | LLTexLayerSetInfo *info = *iter; |
5428 | LLTexLayerSet* layer_set = new LLTexLayerSet( this ); | 5211 | LLTexLayerSet* layer_set = new LLTexLayerSet( this ); |
@@ -5433,27 +5216,20 @@ BOOL LLVOAvatar::loadAvatar() | |||
5433 | llwarns << "avatar file: layer_set->parseData() failed" << llendl; | 5216 | llwarns << "avatar file: layer_set->parseData() failed" << llendl; |
5434 | return FALSE; | 5217 | return FALSE; |
5435 | } | 5218 | } |
5436 | if( layer_set->isBodyRegion( "head" ) ) | 5219 | bool found_baked_entry = false; |
5437 | { | 5220 | for (LLVOAvatarDictionary::baked_map_t::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); |
5438 | mHeadLayerSet = layer_set; | 5221 | baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); |
5439 | } | 5222 | baked_iter++) |
5440 | else if( layer_set->isBodyRegion( "upper_body" ) ) | ||
5441 | { | ||
5442 | mUpperBodyLayerSet = layer_set; | ||
5443 | } | ||
5444 | else if( layer_set->isBodyRegion( "lower_body" ) ) | ||
5445 | { | ||
5446 | mLowerBodyLayerSet = layer_set; | ||
5447 | } | ||
5448 | else if( layer_set->isBodyRegion( "eyes" ) ) | ||
5449 | { | 5223 | { |
5450 | mEyesLayerSet = layer_set; | 5224 | const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = baked_iter->second; |
5451 | } | 5225 | if (layer_set->isBodyRegion(baked_dict->mName)) |
5452 | else if( layer_set->isBodyRegion( "skirt" ) ) | 5226 | { |
5453 | { | 5227 | mBakedTextureData[baked_iter->first].mTexLayerSet = layer_set; |
5454 | mSkirtLayerSet = layer_set; | 5228 | found_baked_entry = true; |
5229 | break; | ||
5230 | } | ||
5455 | } | 5231 | } |
5456 | else | 5232 | if (!found_baked_entry) |
5457 | { | 5233 | { |
5458 | llwarns << "<layer_set> has invalid body_region attribute" << llendl; | 5234 | llwarns << "<layer_set> has invalid body_region attribute" << llendl; |
5459 | delete layer_set; | 5235 | delete layer_set; |
@@ -5464,9 +5240,9 @@ BOOL LLVOAvatar::loadAvatar() | |||
5464 | 5240 | ||
5465 | // avatar_lad.xml : <driver_parameters> | 5241 | // avatar_lad.xml : <driver_parameters> |
5466 | { | 5242 | { |
5467 | LLVOAvatarInfo::driver_info_list_t::iterator iter; | 5243 | LLVOAvatarXmlInfo::driver_info_list_t::iterator iter; |
5468 | for (iter = sAvatarInfo->mDriverInfoList.begin(); | 5244 | for (iter = sAvatarXmlInfo->mDriverInfoList.begin(); |
5469 | iter != sAvatarInfo->mDriverInfoList.end(); iter++) | 5245 | iter != sAvatarXmlInfo->mDriverInfoList.end(); iter++) |
5470 | { | 5246 | { |
5471 | LLDriverParamInfo *info = *iter; | 5247 | LLDriverParamInfo *info = *iter; |
5472 | LLDriverParam* driver_param = new LLDriverParam( this ); | 5248 | LLDriverParam* driver_param = new LLDriverParam( this ); |
@@ -5493,78 +5269,44 @@ BOOL LLVOAvatar::loadSkeletonNode () | |||
5493 | { | 5269 | { |
5494 | mRoot.addChild( &mSkeleton[0] ); | 5270 | mRoot.addChild( &mSkeleton[0] ); |
5495 | 5271 | ||
5496 | mRoot.addChild( &mHeadLOD ); | 5272 | for (std::vector<LLViewerJoint *>::iterator iter = mMeshLOD.begin(); |
5497 | mHeadLOD.mUpdateXform = FALSE; | 5273 | iter != mMeshLOD.end(); iter++) |
5498 | mHeadLOD.addChild( &mHeadMesh0 ); | 5274 | { |
5499 | mHeadLOD.addChild( &mHeadMesh1 ); | 5275 | LLViewerJoint *joint = (LLViewerJoint *) *iter; |
5500 | mHeadLOD.addChild( &mHeadMesh2 ); | 5276 | joint->mUpdateXform = FALSE; |
5501 | mHeadLOD.addChild( &mHeadMesh3 ); | 5277 | joint->setMeshesToChildren(); |
5502 | mHeadLOD.addChild( &mHeadMesh4 ); | 5278 | } |
5503 | 5279 | ||
5504 | mRoot.addChild( &mEyeLashLOD ); | 5280 | mRoot.addChild(mMeshLOD[MESH_ID_HEAD]); |
5505 | mEyeLashLOD.mUpdateXform = FALSE; | 5281 | mRoot.addChild(mMeshLOD[MESH_ID_EYELASH]); |
5506 | mEyeLashLOD.addChild( &mEyeLashMesh0 ); | 5282 | mRoot.addChild(mMeshLOD[MESH_ID_UPPER_BODY]); |
5507 | 5283 | mRoot.addChild(mMeshLOD[MESH_ID_LOWER_BODY]); | |
5508 | mRoot.addChild( &mUpperBodyLOD ); | 5284 | mRoot.addChild(mMeshLOD[MESH_ID_SKIRT]); |
5509 | mUpperBodyLOD.mUpdateXform = FALSE; | 5285 | mRoot.addChild(mMeshLOD[MESH_ID_HEAD]); |
5510 | mUpperBodyLOD.addChild( &mUpperBodyMesh0 ); | ||
5511 | mUpperBodyLOD.addChild( &mUpperBodyMesh1 ); | ||
5512 | mUpperBodyLOD.addChild( &mUpperBodyMesh2 ); | ||
5513 | mUpperBodyLOD.addChild( &mUpperBodyMesh3 ); | ||
5514 | mUpperBodyLOD.addChild( &mUpperBodyMesh4 ); | ||
5515 | |||
5516 | mRoot.addChild( &mLowerBodyLOD ); | ||
5517 | mLowerBodyLOD.mUpdateXform = FALSE; | ||
5518 | mLowerBodyLOD.addChild( &mLowerBodyMesh0 ); | ||
5519 | mLowerBodyLOD.addChild( &mLowerBodyMesh1 ); | ||
5520 | mLowerBodyLOD.addChild( &mLowerBodyMesh2 ); | ||
5521 | mLowerBodyLOD.addChild( &mLowerBodyMesh3 ); | ||
5522 | mLowerBodyLOD.addChild( &mLowerBodyMesh4 ); | ||
5523 | |||
5524 | mRoot.addChild( &mSkirtLOD ); | ||
5525 | mSkirtLOD.mUpdateXform = FALSE; | ||
5526 | mSkirtLOD.addChild( &mSkirtMesh0 ); | ||
5527 | mSkirtLOD.addChild( &mSkirtMesh1 ); | ||
5528 | mSkirtLOD.addChild( &mSkirtMesh2 ); | ||
5529 | mSkirtLOD.addChild( &mSkirtMesh3 ); | ||
5530 | mSkirtLOD.addChild( &mSkirtMesh4 ); | ||
5531 | 5286 | ||
5532 | LLViewerJoint *skull = (LLViewerJoint*)mRoot.findJoint("mSkull"); | 5287 | LLViewerJoint *skull = (LLViewerJoint*)mRoot.findJoint("mSkull"); |
5533 | if (skull) | 5288 | if (skull) |
5534 | { | 5289 | { |
5535 | skull->addChild( &mHairLOD ); | 5290 | skull->addChild(mMeshLOD[MESH_ID_HAIR] ); |
5536 | mHairLOD.mUpdateXform = FALSE; | ||
5537 | mHairLOD.addChild( &mHairMesh0 ); | ||
5538 | mHairLOD.addChild( &mHairMesh1 ); | ||
5539 | mHairLOD.addChild( &mHairMesh2 ); | ||
5540 | mHairLOD.addChild( &mHairMesh3 ); | ||
5541 | mHairLOD.addChild( &mHairMesh4 ); | ||
5542 | mHairLOD.addChild( &mHairMesh5 ); | ||
5543 | } | 5291 | } |
5544 | 5292 | ||
5545 | LLViewerJoint *eyeL = (LLViewerJoint*)mRoot.findJoint("mEyeLeft"); | 5293 | LLViewerJoint *eyeL = (LLViewerJoint*)mRoot.findJoint("mEyeLeft"); |
5546 | if (eyeL) | 5294 | if (eyeL) |
5547 | { | 5295 | { |
5548 | eyeL->addChild( &mEyeBallLeftLOD ); | 5296 | eyeL->addChild( mMeshLOD[MESH_ID_EYEBALL_LEFT] ); |
5549 | mEyeBallLeftLOD.mUpdateXform = FALSE; | ||
5550 | mEyeBallLeftLOD.addChild( &mEyeBallLeftMesh0 ); | ||
5551 | mEyeBallLeftLOD.addChild( &mEyeBallLeftMesh1 ); | ||
5552 | } | 5297 | } |
5553 | 5298 | ||
5554 | LLViewerJoint *eyeR = (LLViewerJoint*)mRoot.findJoint("mEyeRight"); | 5299 | LLViewerJoint *eyeR = (LLViewerJoint*)mRoot.findJoint("mEyeRight"); |
5555 | if (eyeR) | 5300 | if (eyeR) |
5556 | { | 5301 | { |
5557 | eyeR->addChild( &mEyeBallRightLOD ); | 5302 | eyeR->addChild( mMeshLOD[MESH_ID_EYEBALL_RIGHT] ); |
5558 | mEyeBallRightLOD.mUpdateXform = FALSE; | ||
5559 | mEyeBallRightLOD.addChild( &mEyeBallRightMesh0 ); | ||
5560 | mEyeBallRightLOD.addChild( &mEyeBallRightMesh1 ); | ||
5561 | } | 5303 | } |
5562 | 5304 | ||
5563 | // SKELETAL DISTORTIONS | 5305 | // SKELETAL DISTORTIONS |
5564 | { | 5306 | { |
5565 | LLVOAvatarInfo::skeletal_distortion_info_list_t::iterator iter; | 5307 | LLVOAvatarXmlInfo::skeletal_distortion_info_list_t::iterator iter; |
5566 | for (iter = sAvatarInfo->mSkeletalDistortionInfoList.begin(); | 5308 | for (iter = sAvatarXmlInfo->mSkeletalDistortionInfoList.begin(); |
5567 | iter != sAvatarInfo->mSkeletalDistortionInfoList.end(); iter++) | 5309 | iter != sAvatarXmlInfo->mSkeletalDistortionInfoList.end(); iter++) |
5568 | { | 5310 | { |
5569 | LLPolySkeletalDistortionInfo *info = *iter; | 5311 | LLPolySkeletalDistortionInfo *info = *iter; |
5570 | LLPolySkeletalDistortion *param = new LLPolySkeletalDistortion(this); | 5312 | LLPolySkeletalDistortion *param = new LLPolySkeletalDistortion(this); |
@@ -5582,11 +5324,11 @@ BOOL LLVOAvatar::loadSkeletonNode () | |||
5582 | 5324 | ||
5583 | // ATTACHMENTS | 5325 | // ATTACHMENTS |
5584 | { | 5326 | { |
5585 | LLVOAvatarInfo::attachment_info_list_t::iterator iter; | 5327 | LLVOAvatarXmlInfo::attachment_info_list_t::iterator iter; |
5586 | for (iter = sAvatarInfo->mAttachmentInfoList.begin(); | 5328 | for (iter = sAvatarXmlInfo->mAttachmentInfoList.begin(); |
5587 | iter != sAvatarInfo->mAttachmentInfoList.end(); iter++) | 5329 | iter != sAvatarXmlInfo->mAttachmentInfoList.end(); iter++) |
5588 | { | 5330 | { |
5589 | LLVOAvatarInfo::LLVOAvatarAttachmentInfo *info = *iter; | 5331 | LLVOAvatarXmlInfo::LLVOAvatarAttachmentInfo *info = *iter; |
5590 | if (!isSelf() && info->mJointName == "mScreen") | 5332 | if (!isSelf() && info->mJointName == "mScreen") |
5591 | { //don't process screen joint for other avatars | 5333 | { //don't process screen joint for other avatars |
5592 | continue; | 5334 | continue; |
@@ -5663,174 +5405,49 @@ BOOL LLVOAvatar::loadSkeletonNode () | |||
5663 | //----------------------------------------------------------------------------- | 5405 | //----------------------------------------------------------------------------- |
5664 | BOOL LLVOAvatar::loadMeshNodes() | 5406 | BOOL LLVOAvatar::loadMeshNodes() |
5665 | { | 5407 | { |
5666 | LLVOAvatarInfo::mesh_info_list_t::iterator iter; | 5408 | for (LLVOAvatarXmlInfo::mesh_info_list_t::const_iterator meshinfo_iter = sAvatarXmlInfo->mMeshInfoList.begin(); |
5667 | for (iter = sAvatarInfo->mMeshInfoList.begin(); | 5409 | meshinfo_iter != sAvatarXmlInfo->mMeshInfoList.end(); |
5668 | iter != sAvatarInfo->mMeshInfoList.end(); iter++) | 5410 | meshinfo_iter++) |
5669 | { | 5411 | { |
5670 | LLVOAvatarInfo::LLVOAvatarMeshInfo *info = *iter; | 5412 | const LLVOAvatarXmlInfo::LLVOAvatarMeshInfo *info = *meshinfo_iter; |
5671 | std::string &type = info->mType; | 5413 | const std::string &type = info->mType; |
5672 | S32 lod = info->mLOD; | 5414 | S32 lod = info->mLOD; |
5673 | 5415 | ||
5674 | LLViewerJointMesh* mesh = NULL; | 5416 | LLViewerJointMesh* mesh = NULL; |
5675 | if (type == "hairMesh") | 5417 | U8 mesh_id = 0; |
5676 | { | 5418 | BOOL found_mesh_id = FALSE; |
5677 | switch (lod) | 5419 | |
5678 | { | 5420 | /* if (type == "hairMesh") |
5679 | case 0: | 5421 | switch(lod) |
5680 | mesh = &mHairMesh0; | ||
5681 | break; | ||
5682 | case 1: | ||
5683 | mesh = &mHairMesh1; | ||
5684 | break; | ||
5685 | case 2: | ||
5686 | mesh = &mHairMesh2; | ||
5687 | break; | ||
5688 | case 3: | ||
5689 | mesh = &mHairMesh3; | ||
5690 | break; | ||
5691 | case 4: | ||
5692 | mesh = &mHairMesh4; | ||
5693 | break; | ||
5694 | case 5: | ||
5695 | mesh = &mHairMesh5; | ||
5696 | break; | ||
5697 | default: | ||
5698 | llwarns << "Avatar file: <mesh> has invalid lod setting " << lod << llendl; | ||
5699 | return FALSE; | ||
5700 | } | ||
5701 | } | ||
5702 | else if (type == "headMesh") | ||
5703 | { | ||
5704 | switch (lod) | ||
5705 | { | ||
5706 | case 0: | 5422 | case 0: |
5707 | mesh = &mHeadMesh0; | 5423 | mesh = &mHairMesh0; */ |
5708 | break; | 5424 | for (LLVOAvatarDictionary::mesh_map_t::const_iterator mesh_iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); |
5709 | case 1: | 5425 | mesh_iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); |
5710 | mesh = &mHeadMesh1; | 5426 | mesh_iter++) |
5711 | break; | ||
5712 | case 2: | ||
5713 | mesh = &mHeadMesh2; | ||
5714 | break; | ||
5715 | case 3: | ||
5716 | mesh = &mHeadMesh3; | ||
5717 | break; | ||
5718 | case 4: | ||
5719 | mesh = &mHeadMesh4; | ||
5720 | break; | ||
5721 | default: | ||
5722 | llwarns << "Avatar file: <mesh> has invalid lod setting " << lod << llendl; | ||
5723 | return FALSE; | ||
5724 | } | ||
5725 | } | ||
5726 | else if (type == "upperBodyMesh") | ||
5727 | { | 5427 | { |
5728 | switch (lod) | 5428 | const EMeshIndex mesh_index = mesh_iter->first; |
5429 | const LLVOAvatarDictionary::MeshDictionaryEntry *mesh_dict = mesh_iter->second; | ||
5430 | if (type.compare(mesh_dict->mName) == 0) | ||
5729 | { | 5431 | { |
5730 | case 0: | 5432 | mesh_id = mesh_index; |
5731 | mesh = &mUpperBodyMesh0; | 5433 | found_mesh_id = TRUE; |
5732 | break; | 5434 | break; |
5733 | case 1: | ||
5734 | mesh = &mUpperBodyMesh1; | ||
5735 | break; | ||
5736 | case 2: | ||
5737 | mesh = &mUpperBodyMesh2; | ||
5738 | break; | ||
5739 | case 3: | ||
5740 | mesh = &mUpperBodyMesh3; | ||
5741 | break; | ||
5742 | case 4: | ||
5743 | mesh = &mUpperBodyMesh4; | ||
5744 | break; | ||
5745 | default: | ||
5746 | llwarns << "Avatar file: <mesh> has invalid lod setting " << lod << llendl; | ||
5747 | return FALSE; | ||
5748 | } | 5435 | } |
5749 | } | 5436 | } |
5750 | else if (type == "lowerBodyMesh") | 5437 | |
5751 | { | 5438 | if (found_mesh_id) |
5752 | switch (lod) | ||
5753 | { | ||
5754 | case 0: | ||
5755 | mesh = &mLowerBodyMesh0; | ||
5756 | break; | ||
5757 | case 1: | ||
5758 | mesh = &mLowerBodyMesh1; | ||
5759 | break; | ||
5760 | case 2: | ||
5761 | mesh = &mLowerBodyMesh2; | ||
5762 | break; | ||
5763 | case 3: | ||
5764 | mesh = &mLowerBodyMesh3; | ||
5765 | break; | ||
5766 | case 4: | ||
5767 | mesh = &mLowerBodyMesh4; | ||
5768 | break; | ||
5769 | default: | ||
5770 | llwarns << "Avatar file: <mesh> has invalid lod setting " << lod << llendl; | ||
5771 | return FALSE; | ||
5772 | } | ||
5773 | } | ||
5774 | else if (type == "skirtMesh") | ||
5775 | { | ||
5776 | switch (lod) | ||
5777 | { | ||
5778 | case 0: | ||
5779 | mesh = &mSkirtMesh0; | ||
5780 | break; | ||
5781 | case 1: | ||
5782 | mesh = &mSkirtMesh1; | ||
5783 | break; | ||
5784 | case 2: | ||
5785 | mesh = &mSkirtMesh2; | ||
5786 | break; | ||
5787 | case 3: | ||
5788 | mesh = &mSkirtMesh3; | ||
5789 | break; | ||
5790 | case 4: | ||
5791 | mesh = &mSkirtMesh4; | ||
5792 | break; | ||
5793 | default: | ||
5794 | llwarns << "Avatar file: <mesh> has invalid lod setting " << lod << llendl; | ||
5795 | return FALSE; | ||
5796 | } | ||
5797 | } | ||
5798 | else if (type == "eyelashMesh") | ||
5799 | { | ||
5800 | mesh = &mEyeLashMesh0; | ||
5801 | } | ||
5802 | else if (type == "eyeBallLeftMesh") | ||
5803 | { | 5439 | { |
5804 | switch (lod) | 5440 | if (lod < (S32)mMeshLOD[mesh_id]->mMeshParts.size()) |
5805 | { | 5441 | { |
5806 | case 0: | 5442 | mesh = mMeshLOD[mesh_id]->mMeshParts[lod]; |
5807 | mesh = &mEyeBallLeftMesh0; | ||
5808 | break; | ||
5809 | case 1: | ||
5810 | mesh = &mEyeBallLeftMesh1; | ||
5811 | break; | ||
5812 | default: | ||
5813 | llwarns << "Avatar file: <mesh> has invalid lod setting " << lod << llendl; | ||
5814 | return FALSE; | ||
5815 | } | 5443 | } |
5816 | } | 5444 | else |
5817 | else if (type == "eyeBallRightMesh") | ||
5818 | { | ||
5819 | switch (lod) | ||
5820 | { | 5445 | { |
5821 | case 0: | ||
5822 | mesh = &mEyeBallRightMesh0; | ||
5823 | break; | ||
5824 | case 1: | ||
5825 | mesh = &mEyeBallRightMesh1; | ||
5826 | break; | ||
5827 | default: | ||
5828 | llwarns << "Avatar file: <mesh> has invalid lod setting " << lod << llendl; | 5446 | llwarns << "Avatar file: <mesh> has invalid lod setting " << lod << llendl; |
5829 | return FALSE; | 5447 | return FALSE; |
5830 | } | 5448 | } |
5831 | } | 5449 | } |
5832 | 5450 | else | |
5833 | if( !mesh ) | ||
5834 | { | 5451 | { |
5835 | llwarns << "Ignoring unrecognized mesh type: " << type << llendl; | 5452 | llwarns << "Ignoring unrecognized mesh type: " << type << llendl; |
5836 | return FALSE; | 5453 | return FALSE; |
@@ -5846,15 +5463,16 @@ BOOL LLVOAvatar::loadMeshNodes() | |||
5846 | 5463 | ||
5847 | if (!info->mReferenceMeshName.empty()) | 5464 | if (!info->mReferenceMeshName.empty()) |
5848 | { | 5465 | { |
5849 | mesh_map_t::iterator iter = mMeshes.find(info->mReferenceMeshName); | 5466 | polymesh_map_t::const_iterator polymesh_iter = mMeshes.find(info->mReferenceMeshName); |
5850 | if (iter != mMeshes.end()) | 5467 | if (polymesh_iter != mMeshes.end()) |
5851 | { | 5468 | { |
5852 | poly_mesh = LLPolyMesh::getMesh(info->mMeshFileName, iter->second); | 5469 | poly_mesh = LLPolyMesh::getMesh(info->mMeshFileName, polymesh_iter->second); |
5853 | poly_mesh->setAvatar(this); | 5470 | poly_mesh->setAvatar(this); |
5854 | } | 5471 | } |
5855 | else | 5472 | else |
5856 | { | 5473 | { |
5857 | // This should never happen | 5474 | // This should never happen |
5475 | LL_WARNS("Avatar") << "Could not find avatar mesh: " << info->mReferenceMeshName << LL_ENDL; | ||
5858 | } | 5476 | } |
5859 | } | 5477 | } |
5860 | else | 5478 | else |
@@ -5873,14 +5491,13 @@ BOOL LLVOAvatar::loadMeshNodes() | |||
5873 | mMeshes.insert(std::make_pair(info->mMeshFileName, poly_mesh)); | 5491 | mMeshes.insert(std::make_pair(info->mMeshFileName, poly_mesh)); |
5874 | 5492 | ||
5875 | mesh->setMesh( poly_mesh ); | 5493 | mesh->setMesh( poly_mesh ); |
5876 | |||
5877 | mesh->setLOD( info->mMinPixelArea ); | 5494 | mesh->setLOD( info->mMinPixelArea ); |
5878 | 5495 | ||
5879 | LLVOAvatarInfo::LLVOAvatarMeshInfo::morph_info_list_t::iterator iter; | 5496 | for (LLVOAvatarXmlInfo::LLVOAvatarMeshInfo::morph_info_list_t::const_iterator xmlinfo_iter = info->mPolyMorphTargetInfoList.begin(); |
5880 | for (iter = info->mPolyMorphTargetInfoList.begin(); | 5497 | xmlinfo_iter != info->mPolyMorphTargetInfoList.end(); |
5881 | iter != info->mPolyMorphTargetInfoList.end(); iter++) | 5498 | xmlinfo_iter++) |
5882 | { | 5499 | { |
5883 | LLVOAvatarInfo::LLVOAvatarMeshInfo::morph_info_pair_t *info_pair = &(*iter); | 5500 | const LLVOAvatarXmlInfo::LLVOAvatarMeshInfo::morph_info_pair_t *info_pair = &(*xmlinfo_iter); |
5884 | LLPolyMorphTarget *param = new LLPolyMorphTarget(mesh->getMesh()); | 5501 | LLPolyMorphTarget *param = new LLPolyMorphTarget(mesh->getMesh()); |
5885 | if (!param->setInfo(info_pair->first)) | 5502 | if (!param->setInfo(info_pair->first)) |
5886 | { | 5503 | { |
@@ -5944,6 +5561,11 @@ void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent) | |||
5944 | { | 5561 | { |
5945 | LLMemType mt(LLMemType::MTYPE_AVATAR); | 5562 | LLMemType mt(LLMemType::MTYPE_AVATAR); |
5946 | 5563 | ||
5564 | if (mDrawable.isNull()) | ||
5565 | { | ||
5566 | return; | ||
5567 | } | ||
5568 | |||
5947 | const LLVector3* ext = mDrawable->getSpatialExtents(); | 5569 | const LLVector3* ext = mDrawable->getSpatialExtents(); |
5948 | LLVector3 center = (ext[1] + ext[0]) * 0.5f; | 5570 | LLVector3 center = (ext[1] + ext[0]) * 0.5f; |
5949 | LLVector3 size = (ext[1]-ext[0])*0.5f; | 5571 | LLVector3 size = (ext[1]-ext[0])*0.5f; |
@@ -5965,7 +5587,7 @@ void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent) | |||
5965 | // We always want to look good to ourselves | 5587 | // We always want to look good to ourselves |
5966 | if( mIsSelf ) | 5588 | if( mIsSelf ) |
5967 | { | 5589 | { |
5968 | mPixelArea = llmax( mPixelArea, F32(LOCTEX_IMAGE_SIZE_SELF / 16) ); | 5590 | mPixelArea = llmax( mPixelArea, F32(TEX_IMAGE_SIZE_SELF / 16) ); |
5969 | } | 5591 | } |
5970 | } | 5592 | } |
5971 | 5593 | ||
@@ -6082,7 +5704,7 @@ void LLVOAvatar::updateShadowFaces() | |||
6082 | // | 5704 | // |
6083 | // render avatar shadows | 5705 | // render avatar shadows |
6084 | // | 5706 | // |
6085 | if (mInAir || mUpdatePeriod >= VOAVATAR_IMPOSTOR_PERIOD) | 5707 | if (mInAir || mUpdatePeriod >= IMPOSTOR_PERIOD) |
6086 | { | 5708 | { |
6087 | face0p->setSize(0, 0); | 5709 | face0p->setSize(0, 0); |
6088 | face1p->setSize(0, 0); | 5710 | face1p->setSize(0, 0); |
@@ -6177,9 +5799,9 @@ void LLVOAvatar::updateShadowFaces() | |||
6177 | //----------------------------------------------------------------------------- | 5799 | //----------------------------------------------------------------------------- |
6178 | void LLVOAvatar::updateSexDependentLayerSets( BOOL set_by_user ) | 5800 | void LLVOAvatar::updateSexDependentLayerSets( BOOL set_by_user ) |
6179 | { | 5801 | { |
6180 | invalidateComposite( mHeadLayerSet, set_by_user ); | 5802 | invalidateComposite( mBakedTextureData[BAKED_HEAD].mTexLayerSet, set_by_user ); |
6181 | invalidateComposite( mLowerBodyLayerSet, set_by_user ); | 5803 | invalidateComposite( mBakedTextureData[BAKED_UPPER].mTexLayerSet, set_by_user ); |
6182 | invalidateComposite( mUpperBodyLayerSet, set_by_user ); | 5804 | invalidateComposite( mBakedTextureData[BAKED_LOWER].mTexLayerSet, set_by_user ); |
6183 | updateMeshTextures(); | 5805 | updateMeshTextures(); |
6184 | } | 5806 | } |
6185 | 5807 | ||
@@ -6192,74 +5814,32 @@ void LLVOAvatar::dirtyMesh() | |||
6192 | } | 5814 | } |
6193 | 5815 | ||
6194 | //----------------------------------------------------------------------------- | 5816 | //----------------------------------------------------------------------------- |
6195 | // requestLayerSetUpdate() | 5817 | // hideSkirt() |
6196 | //----------------------------------------------------------------------------- | 5818 | //----------------------------------------------------------------------------- |
6197 | void LLVOAvatar::requestLayerSetUpdate( LLVOAvatar::ELocTexIndex i ) | 5819 | void LLVOAvatar::hideSkirt() |
6198 | { | 5820 | { |
6199 | switch( i ) | 5821 | mMeshLOD[MESH_ID_SKIRT]->setVisible(FALSE, TRUE); |
6200 | { | 5822 | } |
6201 | case LOCTEX_HEAD_BODYPAINT: | ||
6202 | if( mHeadLayerSet ) | ||
6203 | { | ||
6204 | mHeadLayerSet->requestUpdate(); | ||
6205 | } | ||
6206 | break; | ||
6207 | |||
6208 | case LOCTEX_UPPER_BODYPAINT: | ||
6209 | case LOCTEX_UPPER_SHIRT: | ||
6210 | case LOCTEX_UPPER_GLOVES: | ||
6211 | case LOCTEX_UPPER_UNDERSHIRT: | ||
6212 | if( mUpperBodyLayerSet ) | ||
6213 | { | ||
6214 | mUpperBodyLayerSet->requestUpdate(); | ||
6215 | } | ||
6216 | break; | ||
6217 | |||
6218 | case LOCTEX_LOWER_BODYPAINT: | ||
6219 | case LOCTEX_LOWER_PANTS: | ||
6220 | case LOCTEX_LOWER_SHOES: | ||
6221 | case LOCTEX_LOWER_SOCKS: | ||
6222 | case LOCTEX_LOWER_UNDERPANTS: | ||
6223 | if( mLowerBodyLayerSet ) | ||
6224 | { | ||
6225 | mLowerBodyLayerSet->requestUpdate(); | ||
6226 | } | ||
6227 | break; | ||
6228 | |||
6229 | case LOCTEX_EYES_IRIS: | ||
6230 | if( mEyesLayerSet ) | ||
6231 | { | ||
6232 | mEyesLayerSet->requestUpdate(); | ||
6233 | } | ||
6234 | break; | ||
6235 | |||
6236 | |||
6237 | case LOCTEX_SKIRT: | ||
6238 | if( mSkirtLayerSet ) | ||
6239 | { | ||
6240 | mSkirtLayerSet->requestUpdate(); | ||
6241 | } | ||
6242 | break; | ||
6243 | |||
6244 | |||
6245 | case LOCTEX_UPPER_JACKET: | ||
6246 | case LOCTEX_LOWER_JACKET: | ||
6247 | if( mUpperBodyLayerSet ) | ||
6248 | { | ||
6249 | mUpperBodyLayerSet->requestUpdate(); | ||
6250 | } | ||
6251 | 5823 | ||
6252 | if( mLowerBodyLayerSet ) | ||
6253 | { | ||
6254 | mLowerBodyLayerSet->requestUpdate(); | ||
6255 | } | ||
6256 | break; | ||
6257 | 5824 | ||
6258 | case LOCTEX_NUM_ENTRIES: | 5825 | //----------------------------------------------------------------------------- |
6259 | llerrs << "Bogus texture value " << i << llendl; | 5826 | // requestLayerSetUpdate() |
6260 | break; | 5827 | //----------------------------------------------------------------------------- |
5828 | void LLVOAvatar::requestLayerSetUpdate(ETextureIndex index ) | ||
5829 | { | ||
5830 | /* switch(index) | ||
5831 | case LOCTEX_UPPER_BODYPAINT: | ||
5832 | case LOCTEX_UPPER_SHIRT: | ||
5833 | if( mUpperBodyLayerSet ) | ||
5834 | mUpperBodyLayerSet->requestUpdate(); */ | ||
5835 | const LLVOAvatarDictionary::TextureDictionaryEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); | ||
5836 | if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture) | ||
5837 | return; | ||
5838 | const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; | ||
5839 | if (mBakedTextureData[baked_index].mTexLayerSet) | ||
5840 | { | ||
5841 | mBakedTextureData[baked_index].mTexLayerSet->requestUpdate(); | ||
6261 | } | 5842 | } |
6262 | |||
6263 | } | 5843 | } |
6264 | 5844 | ||
6265 | void LLVOAvatar::setParent(LLViewerObject* parent) | 5845 | void LLVOAvatar::setParent(LLViewerObject* parent) |
@@ -6348,15 +5928,21 @@ BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object) | |||
6348 | //----------------------------------------------------------------------------- | 5928 | //----------------------------------------------------------------------------- |
6349 | void LLVOAvatar::lazyAttach() | 5929 | void LLVOAvatar::lazyAttach() |
6350 | { | 5930 | { |
5931 | std::vector<LLPointer<LLViewerObject> > still_pending; | ||
5932 | |||
6351 | for (U32 i = 0; i < mPendingAttachment.size(); i++) | 5933 | for (U32 i = 0; i < mPendingAttachment.size(); i++) |
6352 | { | 5934 | { |
6353 | if (mPendingAttachment[i]->mDrawable) | 5935 | if (mPendingAttachment[i]->mDrawable) |
6354 | { | 5936 | { |
6355 | attachObject(mPendingAttachment[i]); | 5937 | attachObject(mPendingAttachment[i]); |
6356 | } | 5938 | } |
5939 | else | ||
5940 | { | ||
5941 | still_pending.push_back(mPendingAttachment[i]); | ||
5942 | } | ||
6357 | } | 5943 | } |
6358 | 5944 | ||
6359 | mPendingAttachment.clear(); | 5945 | mPendingAttachment = still_pending; |
6360 | } | 5946 | } |
6361 | 5947 | ||
6362 | void LLVOAvatar::resetHUDAttachments() | 5948 | void LLVOAvatar::resetHUDAttachments() |
@@ -6614,6 +6200,7 @@ const std::string LLVOAvatar::getAttachedPointName(const LLUUID& inv_item_id) | |||
6614 | // static | 6200 | // static |
6615 | // onLocalTextureLoaded() | 6201 | // onLocalTextureLoaded() |
6616 | //----------------------------------------------------------------------------- | 6202 | //----------------------------------------------------------------------------- |
6203 | |||
6617 | void LLVOAvatar::onLocalTextureLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src_raw, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) | 6204 | void LLVOAvatar::onLocalTextureLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src_raw, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) |
6618 | { | 6205 | { |
6619 | //llinfos << "onLocalTextureLoaded: " << src_vi->getID() << llendl; | 6206 | //llinfos << "onLocalTextureLoaded: " << src_vi->getID() << llendl; |
@@ -6623,37 +6210,47 @@ void LLVOAvatar::onLocalTextureLoaded( BOOL success, LLViewerImage *src_vi, LLIm | |||
6623 | if (success) | 6210 | if (success) |
6624 | { | 6211 | { |
6625 | LLVOAvatar *self = (LLVOAvatar *)gObjectList.findObject(data->mAvatarID); | 6212 | LLVOAvatar *self = (LLVOAvatar *)gObjectList.findObject(data->mAvatarID); |
6626 | LLVOAvatar::ELocTexIndex idx = data->mIndex; | 6213 | if (self) |
6627 | if( self && | 6214 | { |
6628 | (!self->mLocalTextureBaked[ idx ]) && | 6215 | ETextureIndex index = data->mIndex; |
6629 | (self->mLocalTexture[ idx ].notNull()) && | 6216 | if (!self->isIndexLocalTexture(index)) return; |
6630 | (self->mLocalTexture[ idx ]->getID() == src_id) && | 6217 | LocalTextureData &local_tex_data = self->mLocalTextureData[index]; |
6631 | (discard_level < self->mLocalTextureDiscard[idx])) | 6218 | if(!local_tex_data.mIsBakedReady && |
6632 | { | 6219 | local_tex_data.mImage.notNull() && |
6633 | self->mLocalTextureDiscard[idx] = discard_level; | 6220 | (local_tex_data.mImage->getID() == src_id) && |
6634 | self->requestLayerSetUpdate( idx ); | 6221 | discard_level < local_tex_data.mDiscard) |
6635 | if( self->mIsSelf && gAgent.cameraCustomizeAvatar() ) | 6222 | { |
6636 | { | 6223 | local_tex_data.mDiscard = discard_level; |
6637 | LLVisualParamHint::requestHintUpdates(); | 6224 | if ( self->isSelf() && !gAgent.cameraCustomizeAvatar() ) |
6225 | { | ||
6226 | self->requestLayerSetUpdate( index ); | ||
6227 | } | ||
6228 | else if( self->isSelf() && gAgent.cameraCustomizeAvatar() ) | ||
6229 | { | ||
6230 | LLVisualParamHint::requestHintUpdates(); | ||
6231 | } | ||
6232 | self->updateMeshTextures(); | ||
6638 | } | 6233 | } |
6639 | self->updateMeshTextures(); | ||
6640 | } | 6234 | } |
6641 | } | 6235 | } |
6642 | else if (final) | 6236 | else if (final) |
6643 | { | 6237 | { |
6644 | LLVOAvatar *self = (LLVOAvatar *)gObjectList.findObject(data->mAvatarID); | 6238 | LLVOAvatar *self = (LLVOAvatar *)gObjectList.findObject(data->mAvatarID); |
6645 | LLVOAvatar::ELocTexIndex idx = data->mIndex; | 6239 | if (self) |
6646 | // Failed: asset is missing | ||
6647 | if( self && | ||
6648 | (!self->mLocalTextureBaked[ idx ]) && | ||
6649 | (self->mLocalTexture[ idx ].notNull()) && | ||
6650 | (self->mLocalTexture[ idx ]->getID() == src_id)) | ||
6651 | { | 6240 | { |
6652 | self->mLocalTextureDiscard[idx] = 0; // we check that it's missing later | 6241 | ETextureIndex index = data->mIndex; |
6653 | self->requestLayerSetUpdate( idx ); | 6242 | if (!self->isIndexLocalTexture(index)) return; |
6654 | self->updateMeshTextures(); | 6243 | LocalTextureData &local_tex_data = self->mLocalTextureData[index]; |
6244 | // Failed: asset is missing | ||
6245 | if(!local_tex_data.mIsBakedReady && | ||
6246 | local_tex_data.mImage.notNull() && | ||
6247 | local_tex_data.mImage->getID() == src_id) | ||
6248 | { | ||
6249 | local_tex_data.mDiscard = 0; | ||
6250 | self->requestLayerSetUpdate( index ); | ||
6251 | self->updateMeshTextures(); | ||
6252 | } | ||
6655 | } | 6253 | } |
6656 | |||
6657 | } | 6254 | } |
6658 | 6255 | ||
6659 | if( final || !success ) | 6256 | if( final || !success ) |
@@ -6664,29 +6261,13 @@ void LLVOAvatar::onLocalTextureLoaded( BOOL success, LLViewerImage *src_vi, LLIm | |||
6664 | 6261 | ||
6665 | void LLVOAvatar::updateComposites() | 6262 | void LLVOAvatar::updateComposites() |
6666 | { | 6263 | { |
6667 | if( mHeadLayerSet ) | 6264 | for (U32 i = 0; i < mBakedTextureData.size(); i++) |
6668 | { | ||
6669 | mHeadLayerSet->updateComposite(); | ||
6670 | } | ||
6671 | |||
6672 | if( mUpperBodyLayerSet ) | ||
6673 | { | 6265 | { |
6674 | mUpperBodyLayerSet->updateComposite(); | 6266 | if ( mBakedTextureData[i].mTexLayerSet |
6675 | } | 6267 | && ((i != BAKED_SKIRT) || isWearingWearableType( WT_SKIRT )) ) |
6676 | 6268 | { | |
6677 | if( mLowerBodyLayerSet ) | 6269 | mBakedTextureData[i].mTexLayerSet->updateComposite(); |
6678 | { | 6270 | } |
6679 | mLowerBodyLayerSet->updateComposite(); | ||
6680 | } | ||
6681 | |||
6682 | if( mEyesLayerSet ) | ||
6683 | { | ||
6684 | mEyesLayerSet->updateComposite(); | ||
6685 | } | ||
6686 | |||
6687 | if( mSkirtLayerSet && isWearingWearableType( WT_SKIRT )) | ||
6688 | { | ||
6689 | mSkirtLayerSet->updateComposite(); | ||
6690 | } | 6271 | } |
6691 | } | 6272 | } |
6692 | 6273 | ||
@@ -6738,6 +6319,10 @@ void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user | |||
6738 | { | 6319 | { |
6739 | layer_name = "eyes"; | 6320 | layer_name = "eyes"; |
6740 | } | 6321 | } |
6322 | else if (layerset == mHairLayerSet) | ||
6323 | { | ||
6324 | layer_name = "hair"; | ||
6325 | } | ||
6741 | else if (layerset == mSkirtLayerSet) | 6326 | else if (layerset == mSkirtLayerSet) |
6742 | { | 6327 | { |
6743 | layer_name = "skirt"; | 6328 | layer_name = "skirt"; |
@@ -6756,47 +6341,52 @@ void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user | |||
6756 | llassert( mIsSelf ); | 6341 | llassert( mIsSelf ); |
6757 | 6342 | ||
6758 | ETextureIndex baked_te = getBakedTE( layerset ); | 6343 | ETextureIndex baked_te = getBakedTE( layerset ); |
6759 | if( gAgent.cameraCustomizeAvatar() ) | 6344 | setTEImage( baked_te, gImageList.getImage(IMG_DEFAULT_AVATAR) ); |
6760 | { | 6345 | layerset->requestUpload(); |
6761 | mSavedTE[ baked_te ].setNull(); | ||
6762 | } | ||
6763 | else | ||
6764 | { | ||
6765 | setTEImage( baked_te, gImageList.getImage(IMG_DEFAULT_AVATAR) ); | ||
6766 | layerset->requestUpload(); | ||
6767 | } | ||
6768 | } | 6346 | } |
6769 | } | 6347 | } |
6770 | 6348 | ||
6349 | void LLVOAvatar::invalidateAll() | ||
6350 | { | ||
6351 | for (U32 i = 0; i < mBakedTextureData.size(); i++) | ||
6352 | { | ||
6353 | invalidateComposite(mBakedTextureData[i].mTexLayerSet, TRUE); | ||
6354 | } | ||
6355 | updateMeshTextures(); | ||
6356 | } | ||
6771 | 6357 | ||
6772 | void LLVOAvatar::onGlobalColorChanged( LLTexGlobalColor* global_color, BOOL set_by_user ) | 6358 | void LLVOAvatar::onGlobalColorChanged( LLTexGlobalColor* global_color, BOOL set_by_user ) |
6773 | { | 6359 | { |
6774 | if( global_color == mTexSkinColor ) | 6360 | if( global_color == mTexSkinColor ) |
6775 | { | 6361 | { |
6776 | // llinfos << "invalidateComposite cause: onGlobalColorChanged( skin color )" << llendl; | 6362 | // llinfos << "invalidateComposite cause: onGlobalColorChanged( skin color )" << llendl; |
6777 | invalidateComposite( mHeadLayerSet, set_by_user ); | 6363 | invalidateComposite( mBakedTextureData[BAKED_HEAD].mTexLayerSet, set_by_user ); |
6778 | invalidateComposite( mUpperBodyLayerSet, set_by_user ); | 6364 | invalidateComposite( mBakedTextureData[BAKED_UPPER].mTexLayerSet, set_by_user ); |
6779 | invalidateComposite( mLowerBodyLayerSet, set_by_user ); | 6365 | invalidateComposite( mBakedTextureData[BAKED_LOWER].mTexLayerSet, set_by_user ); |
6780 | } | 6366 | } |
6781 | else | 6367 | else |
6782 | if( global_color == mTexHairColor ) | 6368 | if( global_color == mTexHairColor ) |
6783 | { | 6369 | { |
6784 | // llinfos << "invalidateComposite cause: onGlobalColorChanged( hair color )" << llendl; | 6370 | // llinfos << "invalidateComposite cause: onGlobalColorChanged( hair color )" << llendl; |
6785 | invalidateComposite( mHeadLayerSet, set_by_user ); | 6371 | invalidateComposite( mBakedTextureData[BAKED_HEAD].mTexLayerSet, set_by_user ); |
6786 | 6372 | invalidateComposite( mBakedTextureData[BAKED_HAIR].mTexLayerSet, set_by_user ); | |
6787 | LLColor4 color = mTexHairColor->getColor(); | 6373 | |
6788 | mHairMesh0.setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); | 6374 | // ! BACKWARDS COMPATIBILITY ! |
6789 | mHairMesh1.setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); | 6375 | // Fix for dealing with avatars from viewers that don't bake hair. |
6790 | mHairMesh2.setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); | 6376 | if (!isTextureDefined(mBakedTextureData[BAKED_HAIR].mTextureIndex)) |
6791 | mHairMesh3.setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); | 6377 | { |
6792 | mHairMesh4.setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); | 6378 | LLColor4 color = mTexHairColor->getColor(); |
6793 | mHairMesh5.setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); | 6379 | for (U32 i = 0; i < mBakedTextureData[BAKED_HAIR].mMeshes.size(); i++) |
6380 | { | ||
6381 | mBakedTextureData[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); | ||
6382 | } | ||
6383 | } | ||
6794 | } | 6384 | } |
6795 | else | 6385 | else |
6796 | if( global_color == mTexEyeColor ) | 6386 | if( global_color == mTexEyeColor ) |
6797 | { | 6387 | { |
6798 | // llinfos << "invalidateComposite cause: onGlobalColorChanged( eyecolor )" << llendl; | 6388 | // llinfos << "invalidateComposite cause: onGlobalColorChanged( eyecolor )" << llendl; |
6799 | invalidateComposite( mEyesLayerSet, set_by_user ); | 6389 | invalidateComposite( mBakedTextureData[BAKED_EYES].mTexLayerSet, set_by_user ); |
6800 | } | 6390 | } |
6801 | updateMeshTextures(); | 6391 | updateMeshTextures(); |
6802 | } | 6392 | } |
@@ -6805,9 +6395,9 @@ void LLVOAvatar::forceBakeAllTextures(bool slam_for_debug) | |||
6805 | { | 6395 | { |
6806 | llinfos << "TAT: forced full rebake. " << llendl; | 6396 | llinfos << "TAT: forced full rebake. " << llendl; |
6807 | 6397 | ||
6808 | for (S32 i = 0; i < BAKED_TEXTURE_COUNT; i++) | 6398 | for (U32 i = 0; i < mBakedTextureData.size(); i++) |
6809 | { | 6399 | { |
6810 | ETextureIndex baked_index = sBakedTextureIndices[i]; | 6400 | ETextureIndex baked_index = mBakedTextureData[i].mTextureIndex; |
6811 | LLTexLayerSet* layer_set = getLayerSet(baked_index); | 6401 | LLTexLayerSet* layer_set = getLayerSet(baked_index); |
6812 | if (layer_set) | 6402 | if (layer_set) |
6813 | { | 6403 | { |
@@ -6844,20 +6434,30 @@ void LLVOAvatar::processRebakeAvatarTextures(LLMessageSystem* msg, void**) | |||
6844 | // If this is a texture corresponding to one of our baked entries, | 6434 | // If this is a texture corresponding to one of our baked entries, |
6845 | // just rebake that layer set. | 6435 | // just rebake that layer set. |
6846 | BOOL found = FALSE; | 6436 | BOOL found = FALSE; |
6847 | for (S32 i = 0; i < BAKED_TEXTURE_COUNT; i++) | 6437 | |
6438 | /* ETextureIndex baked_texture_indices[BAKED_NUM_INDICES] = | ||
6439 | TEX_HEAD_BAKED, | ||
6440 | TEX_UPPER_BAKED, */ | ||
6441 | for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); | ||
6442 | iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); | ||
6443 | iter++) | ||
6848 | { | 6444 | { |
6849 | ETextureIndex baked_index = sBakedTextureIndices[i]; | 6445 | const ETextureIndex index = iter->first; |
6850 | if (texture_id == self->getTEImage(baked_index)->getID()) | 6446 | const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; |
6447 | if (text_dict->mIsBakedTexture) | ||
6851 | { | 6448 | { |
6852 | LLTexLayerSet* layer_set = self->getLayerSet(baked_index); | 6449 | if (texture_id == self->getTEImage(index)->getID()) |
6853 | if (layer_set) | ||
6854 | { | 6450 | { |
6855 | llinfos << "TAT: rebake - matched entry " << (S32)baked_index << llendl; | 6451 | LLTexLayerSet* layer_set = self->getLayerSet(index); |
6856 | // Apparently set_by_user == force upload | 6452 | if (layer_set) |
6857 | BOOL set_by_user = TRUE; | 6453 | { |
6858 | self->invalidateComposite(layer_set, set_by_user); | 6454 | llinfos << "TAT: rebake - matched entry " << (S32)index << llendl; |
6859 | found = TRUE; | 6455 | // Apparently set_by_user == force upload |
6860 | LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES); | 6456 | BOOL set_by_user = TRUE; |
6457 | self->invalidateComposite(layer_set, set_by_user); | ||
6458 | found = TRUE; | ||
6459 | LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES); | ||
6460 | } | ||
6861 | } | 6461 | } |
6862 | } | 6462 | } |
6863 | } | 6463 | } |
@@ -6875,48 +6475,48 @@ void LLVOAvatar::processRebakeAvatarTextures(LLMessageSystem* msg, void**) | |||
6875 | } | 6475 | } |
6876 | 6476 | ||
6877 | 6477 | ||
6878 | BOOL LLVOAvatar::getLocalTextureRaw(S32 index, LLImageRaw* image_raw) | 6478 | BOOL LLVOAvatar::getLocalTextureRaw(ETextureIndex index, LLImageRaw* image_raw) |
6879 | { | 6479 | { |
6480 | if (!isIndexLocalTexture(index)) return FALSE; | ||
6481 | |||
6880 | BOOL success = FALSE; | 6482 | BOOL success = FALSE; |
6881 | 6483 | ||
6882 | if( (0 <= index) && (index < LOCTEX_NUM_ENTRIES) ) | 6484 | if (getLocalTextureID(index) == IMG_DEFAULT_AVATAR) |
6485 | { | ||
6486 | success = TRUE; | ||
6487 | } | ||
6488 | else | ||
6883 | { | 6489 | { |
6884 | if (mLocalTexture[ index ].isNull() || mLocalTexture[ index ]->getID() == IMG_DEFAULT_AVATAR ) | 6490 | LocalTextureData &local_tex_data = mLocalTextureData[index]; |
6491 | if(local_tex_data.mImage->readBackRaw(-1, image_raw, false)) | ||
6885 | { | 6492 | { |
6886 | success = TRUE; | 6493 | success = TRUE; |
6887 | } | 6494 | } |
6888 | else | 6495 | else |
6889 | { | 6496 | { |
6890 | if( mLocalTexture[ index ]->readBackRaw(-1, image_raw, false) ) | 6497 | // No data loaded yet |
6891 | { | 6498 | setLocalTexture( (ETextureIndex)index, getTEImage( index ), FALSE ); |
6892 | success = TRUE; | ||
6893 | } | ||
6894 | else | ||
6895 | { | ||
6896 | // No data loaded yet | ||
6897 | setLocalTexture( (ELocTexIndex)index, getTEImage( index ), FALSE ); | ||
6898 | } | ||
6899 | } | 6499 | } |
6900 | } | 6500 | } |
6901 | return success; | 6501 | return success; |
6902 | } | 6502 | } |
6903 | 6503 | ||
6904 | BOOL LLVOAvatar::getLocalTextureGL(S32 index, LLImageGL** image_gl_pp) | 6504 | BOOL LLVOAvatar::getLocalTextureGL(ETextureIndex index, LLImageGL** image_gl_pp) |
6905 | { | 6505 | { |
6506 | if (!isIndexLocalTexture(index)) return FALSE; | ||
6507 | |||
6906 | BOOL success = FALSE; | 6508 | BOOL success = FALSE; |
6907 | *image_gl_pp = NULL; | 6509 | *image_gl_pp = NULL; |
6908 | 6510 | ||
6909 | if( (0 <= index) && (index < LOCTEX_NUM_ENTRIES) ) | 6511 | if (getLocalTextureID(index) == IMG_DEFAULT_AVATAR) |
6910 | { | 6512 | { |
6911 | if( mLocalTexture[ index ].isNull() || mLocalTexture[ index ]->getID() == IMG_DEFAULT_AVATAR) | 6513 | success = TRUE; |
6912 | { | 6514 | } |
6913 | success = TRUE; | 6515 | else |
6914 | } | 6516 | { |
6915 | else | 6517 | LocalTextureData &local_tex_data = mLocalTextureData[index]; |
6916 | { | 6518 | *image_gl_pp = local_tex_data.mImage; |
6917 | *image_gl_pp = mLocalTexture[ index ]; | 6519 | success = TRUE; |
6918 | success = TRUE; | ||
6919 | } | ||
6920 | } | 6520 | } |
6921 | 6521 | ||
6922 | if( !success ) | 6522 | if( !success ) |
@@ -6926,11 +6526,13 @@ BOOL LLVOAvatar::getLocalTextureGL(S32 index, LLImageGL** image_gl_pp) | |||
6926 | return success; | 6526 | return success; |
6927 | } | 6527 | } |
6928 | 6528 | ||
6929 | const LLUUID& LLVOAvatar::getLocalTextureID( S32 index ) | 6529 | const LLUUID& LLVOAvatar::getLocalTextureID(ETextureIndex index) |
6930 | { | 6530 | { |
6931 | if (index >= 0 && mLocalTexture[index].notNull()) | 6531 | if (!isIndexLocalTexture(index)) return IMG_DEFAULT_AVATAR; |
6532 | |||
6533 | if (mLocalTextureData[index].mImage.notNull()) | ||
6932 | { | 6534 | { |
6933 | return mLocalTexture[index]->getID(); | 6535 | return mLocalTextureData[index].mImage->getID(); |
6934 | } | 6536 | } |
6935 | else | 6537 | else |
6936 | { | 6538 | { |
@@ -6956,8 +6558,7 @@ void LLVOAvatar::dumpTotalLocalTextureByteCount() | |||
6956 | BOOL LLVOAvatar::isVisible() | 6558 | BOOL LLVOAvatar::isVisible() |
6957 | { | 6559 | { |
6958 | return mDrawable.notNull() | 6560 | return mDrawable.notNull() |
6959 | && (mDrawable->isVisible() || mIsDummy) | 6561 | && (mDrawable->isVisible() || mIsDummy); |
6960 | && (mVisibilityRank < (U32) sMaxVisible || gFrameTimeSeconds - mFadeTime < 1.f); | ||
6961 | } | 6562 | } |
6962 | 6563 | ||
6963 | 6564 | ||
@@ -6976,8 +6577,15 @@ BOOL LLVOAvatar::updateIsFullyLoaded() | |||
6976 | loading = TRUE; | 6577 | loading = TRUE; |
6977 | } | 6578 | } |
6978 | 6579 | ||
6979 | // are our texture settings still default? | 6580 | // |
6980 | if ((getTEImage( TEX_HAIR )->getID() == IMG_DEFAULT)) | 6581 | if (mIsSelf) |
6582 | { | ||
6583 | if (!isTextureDefined(TEX_HAIR)) | ||
6584 | { | ||
6585 | loading = TRUE; | ||
6586 | } | ||
6587 | } | ||
6588 | else if (!isTextureDefined(TEX_LOWER_BAKED) || !isTextureDefined(TEX_UPPER_BAKED) || !isTextureDefined(TEX_HEAD_BAKED)) | ||
6981 | { | 6589 | { |
6982 | loading = TRUE; | 6590 | loading = TRUE; |
6983 | } | 6591 | } |
@@ -6997,14 +6605,14 @@ BOOL LLVOAvatar::updateIsFullyLoaded() | |||
6997 | // texture info for our shirt/pants, stay unloaded: | 6605 | // texture info for our shirt/pants, stay unloaded: |
6998 | if (!mPreviousFullyLoaded) | 6606 | if (!mPreviousFullyLoaded) |
6999 | { | 6607 | { |
7000 | if ((!isLocalTextureDataAvailable(mLowerBodyLayerSet)) && | 6608 | if ((!isLocalTextureDataAvailable(mBakedTextureData[BAKED_LOWER].mTexLayerSet)) && |
7001 | (getTEImage(TEX_LOWER_BAKED)->getID() == IMG_DEFAULT_AVATAR)) | 6609 | (!isTextureDefined(TEX_LOWER_BAKED))) |
7002 | { | 6610 | { |
7003 | loading = TRUE; | 6611 | loading = TRUE; |
7004 | } | 6612 | } |
7005 | 6613 | ||
7006 | if ((!isLocalTextureDataAvailable(mUpperBodyLayerSet)) && | 6614 | if ((!isLocalTextureDataAvailable(mBakedTextureData[BAKED_UPPER].mTexLayerSet)) && |
7007 | (getTEImage(TEX_UPPER_BAKED)->getID() == IMG_DEFAULT_AVATAR)) | 6615 | (!isTextureDefined(TEX_UPPER_BAKED))) |
7008 | { | 6616 | { |
7009 | loading = TRUE; | 6617 | loading = TRUE; |
7010 | } | 6618 | } |
@@ -7056,9 +6664,10 @@ LLMotion* LLVOAvatar::findMotion(const LLUUID& id) | |||
7056 | void LLVOAvatar::getLocalTextureByteCount( S32* gl_bytes ) | 6664 | void LLVOAvatar::getLocalTextureByteCount( S32* gl_bytes ) |
7057 | { | 6665 | { |
7058 | *gl_bytes = 0; | 6666 | *gl_bytes = 0; |
7059 | for( S32 i = 0; i < LOCTEX_NUM_ENTRIES; i++ ) | 6667 | for( S32 i = 0; i < TEX_NUM_INDICES; i++ ) |
7060 | { | 6668 | { |
7061 | LLViewerImage* image_gl = mLocalTexture[i]; | 6669 | if (!isIndexLocalTexture((ETextureIndex)i)) continue; |
6670 | LLViewerImage* image_gl = mLocalTextureData[(ETextureIndex)i].mImage; | ||
7062 | if( image_gl ) | 6671 | if( image_gl ) |
7063 | { | 6672 | { |
7064 | S32 bytes = (S32)image_gl->getWidth() * image_gl->getHeight() * image_gl->getComponents(); | 6673 | S32 bytes = (S32)image_gl->getWidth() * image_gl->getHeight() * image_gl->getComponents(); |
@@ -7121,7 +6730,7 @@ LLGLuint LLVOAvatar::getScratchTexName( LLGLenum format, U32* texture_bytes ) | |||
7121 | default: llassert(0); components = 4; internal_format = GL_RGBA8; break; | 6730 | default: llassert(0); components = 4; internal_format = GL_RGBA8; break; |
7122 | } | 6731 | } |
7123 | 6732 | ||
7124 | *texture_bytes = components * VOAVATAR_SCRATCH_TEX_WIDTH * VOAVATAR_SCRATCH_TEX_HEIGHT; | 6733 | *texture_bytes = components * SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT; |
7125 | 6734 | ||
7126 | if( LLVOAvatar::sScratchTexNames.checkData( format ) ) | 6735 | if( LLVOAvatar::sScratchTexNames.checkData( format ) ) |
7127 | { | 6736 | { |
@@ -7132,23 +6741,21 @@ LLGLuint LLVOAvatar::getScratchTexName( LLGLenum format, U32* texture_bytes ) | |||
7132 | 6741 | ||
7133 | LLGLSUIDefault gls_ui; | 6742 | LLGLSUIDefault gls_ui; |
7134 | 6743 | ||
7135 | GLuint name = 0; | 6744 | U32 name = 0; |
7136 | glGenTextures(1, &name ); | 6745 | LLImageGL::generateTextures(1, &name ); |
7137 | stop_glerror(); | 6746 | stop_glerror(); |
7138 | 6747 | ||
7139 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, name); | 6748 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, name); |
7140 | stop_glerror(); | 6749 | stop_glerror(); |
7141 | 6750 | ||
7142 | glTexImage2D( | 6751 | LLImageGL::setManualImage( |
7143 | GL_TEXTURE_2D, 0, internal_format, | 6752 | GL_TEXTURE_2D, 0, internal_format, |
7144 | VOAVATAR_SCRATCH_TEX_WIDTH, VOAVATAR_SCRATCH_TEX_HEIGHT, | 6753 | SCRATCH_TEX_WIDTH, SCRATCH_TEX_HEIGHT, |
7145 | 0, format, GL_UNSIGNED_BYTE, NULL ); | 6754 | format, GL_UNSIGNED_BYTE, NULL ); |
7146 | stop_glerror(); | 6755 | stop_glerror(); |
7147 | 6756 | ||
7148 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 6757 | gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); |
7149 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 6758 | gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); |
7150 | glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); | ||
7151 | glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); | ||
7152 | stop_glerror(); | 6759 | stop_glerror(); |
7153 | 6760 | ||
7154 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); | 6761 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); |
@@ -7175,7 +6782,7 @@ void LLVOAvatar::setLocTexTE( U8 te, LLViewerImage* image, BOOL set_by_user ) | |||
7175 | return; | 6782 | return; |
7176 | } | 6783 | } |
7177 | 6784 | ||
7178 | if( te >= TEX_NUM_ENTRIES ) | 6785 | if( te >= TEX_NUM_INDICES ) |
7179 | { | 6786 | { |
7180 | llassert(0); | 6787 | llassert(0); |
7181 | return; | 6788 | return; |
@@ -7186,7 +6793,7 @@ void LLVOAvatar::setLocTexTE( U8 te, LLViewerImage* image, BOOL set_by_user ) | |||
7186 | return; | 6793 | return; |
7187 | } | 6794 | } |
7188 | 6795 | ||
7189 | if (isTextureIndexBaked(te)) | 6796 | if (isIndexBakedTexture((ETextureIndex)te)) |
7190 | { | 6797 | { |
7191 | llassert(0); | 6798 | llassert(0); |
7192 | return; | 6799 | return; |
@@ -7209,32 +6816,13 @@ void LLVOAvatar::setLocTexTE( U8 te, LLViewerImage* image, BOOL set_by_user ) | |||
7209 | 6816 | ||
7210 | void LLVOAvatar::setupComposites() | 6817 | void LLVOAvatar::setupComposites() |
7211 | { | 6818 | { |
7212 | // Don't invalidate the baked textures we had on start-up. | 6819 | for (U32 i = 0; i < mBakedTextureData.size(); i++) |
7213 | BOOL head_baked = ( getTEImage( TEX_HEAD_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
7214 | BOOL upper_baked = ( getTEImage( TEX_UPPER_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
7215 | BOOL lower_baked = ( getTEImage( TEX_LOWER_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
7216 | BOOL eyes_baked = ( getTEImage( TEX_EYES_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
7217 | BOOL skirt_baked = ( getTEImage( TEX_SKIRT_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
7218 | |||
7219 | if (mHeadLayerSet) | ||
7220 | { | 6820 | { |
7221 | mHeadLayerSet->setUpdatesEnabled( !head_baked ); | 6821 | bool layer_baked = isTextureDefined(mBakedTextureData[i].mTextureIndex); |
7222 | } | 6822 | if (mBakedTextureData[i].mTexLayerSet) |
7223 | if (mUpperBodyLayerSet) | 6823 | { |
7224 | { | 6824 | mBakedTextureData[i].mTexLayerSet->setUpdatesEnabled( !layer_baked ); |
7225 | mUpperBodyLayerSet->setUpdatesEnabled( !upper_baked ); | 6825 | } |
7226 | } | ||
7227 | if (mLowerBodyLayerSet) | ||
7228 | { | ||
7229 | mLowerBodyLayerSet->setUpdatesEnabled( !lower_baked ); | ||
7230 | } | ||
7231 | if (mEyesLayerSet) | ||
7232 | { | ||
7233 | mEyesLayerSet->setUpdatesEnabled( !eyes_baked ); | ||
7234 | } | ||
7235 | if (mSkirtLayerSet) | ||
7236 | { | ||
7237 | mSkirtLayerSet->setUpdatesEnabled( !skirt_baked ); | ||
7238 | } | 6826 | } |
7239 | } | 6827 | } |
7240 | 6828 | ||
@@ -7244,447 +6832,193 @@ void LLVOAvatar::setupComposites() | |||
7244 | //----------------------------------------------------------------------------- | 6832 | //----------------------------------------------------------------------------- |
7245 | void LLVOAvatar::updateMeshTextures() | 6833 | void LLVOAvatar::updateMeshTextures() |
7246 | { | 6834 | { |
7247 | // llinfos << "updateMeshTextures" << llendl; | 6835 | // llinfos << "updateMeshTextures" << llendl; |
7248 | if (gNoRender) | 6836 | if (gNoRender) return; |
7249 | { | 6837 | |
7250 | return; | ||
7251 | } | ||
7252 | // if user has never specified a texture, assign the default | 6838 | // if user has never specified a texture, assign the default |
7253 | LLViewerImage* default_tex = gImageList.getImage(IMG_DEFAULT); | 6839 | for (U32 i=0; i < getNumTEs(); i++) |
7254 | U8 num_TEs = getNumTEs(); | ||
7255 | for (U32 i=0; i<num_TEs; i++) | ||
7256 | { | 6840 | { |
7257 | LLViewerImage* te_image = getTEImage(i); | 6841 | const LLViewerImage* te_image = getTEImage(i); |
7258 | if( (NULL == te_image) || te_image->getID().isNull() || (te_image->getID() == IMG_DEFAULT) ) | 6842 | if(!te_image || te_image->getID().isNull() || (te_image->getID() == IMG_DEFAULT)) |
7259 | { | 6843 | { |
7260 | if( TEX_HAIR == i ) | 6844 | setTEImage(i, gImageList.getImage(i == TEX_HAIR ? IMG_DEFAULT : IMG_DEFAULT_AVATAR)); // IMG_DEFAULT_AVATAR = a special texture that's never rendered. |
7261 | { | ||
7262 | setTEImage(i, default_tex ); | ||
7263 | } | ||
7264 | else | ||
7265 | { | ||
7266 | setTEImage(i, gImageList.getImage(IMG_DEFAULT_AVATAR)); // a special texture that's never rendered. | ||
7267 | } | ||
7268 | } | 6845 | } |
7269 | } | 6846 | } |
7270 | 6847 | ||
7271 | // During face edit mode, we don't use baked textures | 6848 | const BOOL self_customizing = mIsSelf && gAgent.cameraCustomizeAvatar(); // During face edit mode, we don't use baked textures |
7272 | BOOL self_customize = mIsSelf && gAgent.cameraCustomizeAvatar(); | 6849 | const BOOL other_culled = !mIsSelf && mCulled; |
7273 | 6850 | ||
7274 | BOOL head_baked = (getTEImage( TEX_HEAD_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | 6851 | std::vector<bool> is_layer_baked; |
7275 | BOOL upper_baked = (getTEImage( TEX_UPPER_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | 6852 | is_layer_baked.resize(mBakedTextureData.size(), false); |
7276 | BOOL lower_baked = (getTEImage( TEX_LOWER_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
7277 | BOOL eyes_baked = (getTEImage( TEX_EYES_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
7278 | BOOL skirt_baked = (getTEImage( TEX_SKIRT_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
7279 | 6853 | ||
7280 | // Nothing should be baked if we're in customize avatar mode. | 6854 | std::vector<bool> use_lkg_baked_layer; // lkg = "last known good" |
7281 | llassert( !( self_customize && | 6855 | use_lkg_baked_layer.resize(mBakedTextureData.size(), false); |
7282 | ( head_baked || upper_baked || lower_baked || eyes_baked ) ) ); | ||
7283 | 6856 | ||
7284 | BOOL use_lkg_head_baked = FALSE; | 6857 | for (U32 i=0; i < mBakedTextureData.size(); i++) |
7285 | BOOL use_lkg_upper_baked = FALSE; | ||
7286 | BOOL use_lkg_lower_baked = FALSE; | ||
7287 | BOOL use_lkg_eyes_baked = FALSE; | ||
7288 | BOOL use_lkg_skirt_baked = FALSE; | ||
7289 | |||
7290 | BOOL other_culled = !mIsSelf && mCulled; | ||
7291 | if( other_culled ) | ||
7292 | { | 6858 | { |
7293 | use_lkg_head_baked = !head_baked && (mLastHeadBakedID != IMG_DEFAULT_AVATAR); | 6859 | is_layer_baked[i] = isTextureDefined(mBakedTextureData[i].mTextureIndex); |
7294 | use_lkg_upper_baked = !upper_baked && (mLastUpperBodyBakedID != IMG_DEFAULT_AVATAR); | ||
7295 | use_lkg_lower_baked = !lower_baked && (mLastLowerBodyBakedID != IMG_DEFAULT_AVATAR); | ||
7296 | use_lkg_eyes_baked = !eyes_baked && (mLastEyesBakedID != IMG_DEFAULT_AVATAR); | ||
7297 | use_lkg_skirt_baked = !skirt_baked && (mLastSkirtBakedID != IMG_DEFAULT_AVATAR); | ||
7298 | |||
7299 | if( mHeadLayerSet ) | ||
7300 | { | ||
7301 | mHeadLayerSet->destroyComposite(); | ||
7302 | } | ||
7303 | 6860 | ||
7304 | if( mUpperBodyLayerSet ) | 6861 | if (!other_culled) |
7305 | { | 6862 | { |
7306 | mUpperBodyLayerSet->destroyComposite(); | 6863 | // When an avatar is changing clothes and not in Appearance mode, |
7307 | } | 6864 | // use the last-known good baked texture until it finish the first |
7308 | 6865 | // render of the new layerset. | |
7309 | if( mLowerBodyLayerSet ) | 6866 | use_lkg_baked_layer[i] = (!is_layer_baked[i] |
7310 | { | 6867 | && (mBakedTextureData[i].mLastTextureIndex != IMG_DEFAULT_AVATAR) |
7311 | mLowerBodyLayerSet->destroyComposite(); | 6868 | && mBakedTextureData[i].mTexLayerSet |
7312 | } | 6869 | && !mBakedTextureData[i].mTexLayerSet->getComposite()->isInitialized()); |
7313 | 6870 | if (use_lkg_baked_layer[i]) | |
7314 | if( mEyesLayerSet ) | 6871 | { |
7315 | { | 6872 | mBakedTextureData[i].mTexLayerSet->setUpdatesEnabled(TRUE); |
7316 | mEyesLayerSet->destroyComposite(); | 6873 | } |
7317 | } | ||
7318 | |||
7319 | if( mSkirtLayerSet ) | ||
7320 | { | ||
7321 | mSkirtLayerSet->destroyComposite(); | ||
7322 | } | ||
7323 | |||
7324 | } | ||
7325 | else | ||
7326 | if( !self_customize ) | ||
7327 | { | ||
7328 | // When you're changing clothes and you're not in Appearance mode, | ||
7329 | // use the last-known good baked texture until you finish the first | ||
7330 | // render of the new layerset. | ||
7331 | use_lkg_head_baked = !head_baked && (mLastHeadBakedID != IMG_DEFAULT_AVATAR) && mHeadLayerSet && !mHeadLayerSet->getComposite()->isInitialized(); | ||
7332 | use_lkg_upper_baked = !upper_baked && (mLastUpperBodyBakedID != IMG_DEFAULT_AVATAR) && mUpperBodyLayerSet && !mUpperBodyLayerSet->getComposite()->isInitialized(); | ||
7333 | use_lkg_lower_baked = !lower_baked && (mLastLowerBodyBakedID != IMG_DEFAULT_AVATAR) && mLowerBodyLayerSet && !mLowerBodyLayerSet->getComposite()->isInitialized(); | ||
7334 | use_lkg_eyes_baked = !eyes_baked && (mLastEyesBakedID != IMG_DEFAULT_AVATAR) && mEyesLayerSet && !mEyesLayerSet->getComposite()->isInitialized(); | ||
7335 | use_lkg_skirt_baked = !skirt_baked && (mLastSkirtBakedID != IMG_DEFAULT_AVATAR) && mSkirtLayerSet && !mSkirtLayerSet->getComposite()->isInitialized(); | ||
7336 | |||
7337 | if( use_lkg_head_baked ) | ||
7338 | { | ||
7339 | mHeadLayerSet->setUpdatesEnabled( TRUE ); | ||
7340 | } | ||
7341 | |||
7342 | if( use_lkg_upper_baked ) | ||
7343 | { | ||
7344 | mUpperBodyLayerSet->setUpdatesEnabled( TRUE ); | ||
7345 | } | ||
7346 | |||
7347 | if( use_lkg_lower_baked ) | ||
7348 | { | ||
7349 | mLowerBodyLayerSet->setUpdatesEnabled( TRUE ); | ||
7350 | } | 6874 | } |
7351 | 6875 | else | |
7352 | if( use_lkg_eyes_baked ) | ||
7353 | { | 6876 | { |
7354 | mEyesLayerSet->setUpdatesEnabled( TRUE ); | 6877 | use_lkg_baked_layer[i] = (!is_layer_baked[i] |
6878 | && mBakedTextureData[i].mLastTextureIndex != IMG_DEFAULT_AVATAR); | ||
6879 | if (mBakedTextureData[i].mTexLayerSet) | ||
6880 | { | ||
6881 | mBakedTextureData[i].mTexLayerSet->destroyComposite(); | ||
6882 | } | ||
7355 | } | 6883 | } |
7356 | 6884 | ||
7357 | if( use_lkg_skirt_baked ) | ||
7358 | { | ||
7359 | mSkirtLayerSet->setUpdatesEnabled( TRUE ); | ||
7360 | } | ||
7361 | } | 6885 | } |
7362 | 6886 | ||
7363 | // Baked textures should be requested from the sim this avatar is on. JC | 6887 | // Baked textures should be requested from the sim this avatar is on. JC |
7364 | LLHost target_host = getObjectHost(); | 6888 | const LLHost target_host = getObjectHost(); |
7365 | if (!target_host.isOk()) | 6889 | if (!target_host.isOk()) |
7366 | { | 6890 | { |
7367 | llwarns << "updateMeshTextures: invalid host for object: " << getID() << llendl; | 6891 | llwarns << "updateMeshTextures: invalid host for object: " << getID() << llendl; |
7368 | } | 6892 | } |
7369 | 6893 | ||
7370 | // Head | 6894 | for (U32 i=0; i < mBakedTextureData.size(); i++) |
7371 | if( use_lkg_head_baked ) | ||
7372 | { | ||
7373 | LLViewerImage* baked = gImageList.getImageFromHost( mLastHeadBakedID, target_host ); | ||
7374 | mHeadMesh0.setTexture( baked ); | ||
7375 | mHeadMesh1.setTexture( baked ); | ||
7376 | mHeadMesh2.setTexture( baked ); | ||
7377 | mHeadMesh3.setTexture( baked ); | ||
7378 | mHeadMesh4.setTexture( baked ); | ||
7379 | mEyeLashMesh0.setTexture( baked ); | ||
7380 | } | ||
7381 | else | ||
7382 | if( !self_customize && head_baked ) | ||
7383 | { | 6895 | { |
7384 | LLViewerImage* baked = getTEImage( TEX_HEAD_BAKED ); | 6896 | if (use_lkg_baked_layer[i] && !self_customizing ) |
7385 | if( baked->getID() == mLastHeadBakedID ) | ||
7386 | { | 6897 | { |
7387 | // Even though the file may not be finished loading, we'll consider it loaded and use it (rather than doing compositing). | 6898 | LLViewerImage* baked_img = gImageList.getImageFromHost( mBakedTextureData[i].mLastTextureIndex, target_host ); |
7388 | useBakedTexture( baked->getID() ); | 6899 | for (U32 k=0; k < mBakedTextureData[i].mMeshes.size(); k++) |
7389 | } | 6900 | { |
7390 | else | 6901 | mBakedTextureData[i].mMeshes[k]->setTexture( baked_img ); |
7391 | { | 6902 | } |
7392 | mHeadBakedLoaded = FALSE; | ||
7393 | mHeadMaskDiscard = -1; | ||
7394 | baked->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID )); | ||
7395 | baked->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ) ); | ||
7396 | } | 6903 | } |
7397 | } | 6904 | else if (!self_customizing && is_layer_baked[i]) |
7398 | else | ||
7399 | if( mHeadLayerSet && !other_culled ) | ||
7400 | { | ||
7401 | mHeadLayerSet->createComposite(); | ||
7402 | mHeadLayerSet->setUpdatesEnabled( TRUE ); | ||
7403 | mHeadMesh0.setLayerSet( mHeadLayerSet ); | ||
7404 | mHeadMesh1.setLayerSet( mHeadLayerSet ); | ||
7405 | mHeadMesh2.setLayerSet( mHeadLayerSet ); | ||
7406 | mHeadMesh3.setLayerSet( mHeadLayerSet ); | ||
7407 | mHeadMesh4.setLayerSet( mHeadLayerSet ); | ||
7408 | mEyeLashMesh0.setLayerSet( mHeadLayerSet ); | ||
7409 | } | ||
7410 | else | ||
7411 | { | ||
7412 | mHeadMesh0.setTexture( default_tex ); | ||
7413 | mHeadMesh1.setTexture( default_tex ); | ||
7414 | mHeadMesh2.setTexture( default_tex ); | ||
7415 | mHeadMesh3.setTexture( default_tex ); | ||
7416 | mHeadMesh4.setTexture( default_tex ); | ||
7417 | mEyeLashMesh0.setTexture( default_tex ); | ||
7418 | } | ||
7419 | |||
7420 | // Upper body | ||
7421 | if( use_lkg_upper_baked ) | ||
7422 | { | ||
7423 | LLViewerImage* baked = gImageList.getImageFromHost( mLastUpperBodyBakedID, target_host ); | ||
7424 | mUpperBodyMesh0.setTexture( baked ); | ||
7425 | mUpperBodyMesh1.setTexture( baked ); | ||
7426 | mUpperBodyMesh2.setTexture( baked ); | ||
7427 | mUpperBodyMesh3.setTexture( baked ); | ||
7428 | mUpperBodyMesh4.setTexture( baked ); | ||
7429 | } | ||
7430 | else | ||
7431 | if( !self_customize && upper_baked ) | ||
7432 | { | ||
7433 | LLViewerImage* baked = getTEImage( TEX_UPPER_BAKED ); | ||
7434 | |||
7435 | if( baked->getID() == mLastUpperBodyBakedID ) | ||
7436 | { | 6905 | { |
7437 | // Even though the file may not be finished loading, we'll consider it loaded and use it (rather than doing compositing). | 6906 | LLViewerImage* baked_img = getTEImage( mBakedTextureData[i].mTextureIndex ); |
7438 | useBakedTexture( baked->getID() ); | 6907 | if( baked_img->getID() == mBakedTextureData[i].mLastTextureIndex ) |
6908 | { | ||
6909 | // Even though the file may not be finished loading, we'll consider it loaded and use it (rather than doing compositing). | ||
6910 | useBakedTexture( baked_img->getID() ); | ||
6911 | } | ||
6912 | else | ||
6913 | { | ||
6914 | mBakedTextureData[i].mIsLoaded = FALSE; | ||
6915 | if ( (i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER) ) | ||
6916 | { | ||
6917 | baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID )); | ||
6918 | } | ||
6919 | baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ) ); | ||
6920 | } | ||
7439 | } | 6921 | } |
7440 | else | 6922 | else if (mBakedTextureData[i].mTexLayerSet |
6923 | && !other_culled | ||
6924 | && (i != BAKED_HAIR || is_layer_baked[i] || mIsSelf)) // ! BACKWARDS COMPATIBILITY ! workaround for old viewers. | ||
7441 | { | 6925 | { |
7442 | mUpperBakedLoaded = FALSE; | 6926 | mBakedTextureData[i].mTexLayerSet->createComposite(); |
7443 | mUpperMaskDiscard = -1; | 6927 | mBakedTextureData[i].mTexLayerSet->setUpdatesEnabled( TRUE ); |
7444 | baked->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID )); | 6928 | for (U32 k=0; k < mBakedTextureData[i].mMeshes.size(); k++) |
7445 | baked->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ) ); | 6929 | { |
6930 | mBakedTextureData[i].mMeshes[k]->setLayerSet( mBakedTextureData[i].mTexLayerSet ); | ||
6931 | } | ||
7446 | } | 6932 | } |
7447 | } | 6933 | } |
7448 | else | 6934 | |
7449 | if( mUpperBodyLayerSet && !other_culled ) | 6935 | // ! BACKWARDS COMPATIBILITY ! |
7450 | { | 6936 | // Workaround for viewing avatars from old viewers that haven't baked hair textures. |
7451 | mUpperBodyLayerSet->createComposite(); | 6937 | // if (!isTextureDefined(mBakedTextureData[BAKED_HAIR].mTextureIndex)) |
7452 | mUpperBodyLayerSet->setUpdatesEnabled( TRUE ); | 6938 | if (!is_layer_baked[BAKED_HAIR]) |
7453 | mUpperBodyMesh0.setLayerSet( mUpperBodyLayerSet ); | ||
7454 | mUpperBodyMesh1.setLayerSet( mUpperBodyLayerSet ); | ||
7455 | mUpperBodyMesh2.setLayerSet( mUpperBodyLayerSet ); | ||
7456 | mUpperBodyMesh3.setLayerSet( mUpperBodyLayerSet ); | ||
7457 | mUpperBodyMesh4.setLayerSet( mUpperBodyLayerSet ); | ||
7458 | } | ||
7459 | else | ||
7460 | { | ||
7461 | mUpperBodyMesh0.setTexture( default_tex ); | ||
7462 | mUpperBodyMesh1.setTexture( default_tex ); | ||
7463 | mUpperBodyMesh2.setTexture( default_tex ); | ||
7464 | mUpperBodyMesh3.setTexture( default_tex ); | ||
7465 | mUpperBodyMesh4.setTexture( default_tex ); | ||
7466 | } | ||
7467 | |||
7468 | // Lower body | ||
7469 | if( use_lkg_lower_baked ) | ||
7470 | { | ||
7471 | LLViewerImage* baked = gImageList.getImageFromHost( mLastLowerBodyBakedID, target_host ); | ||
7472 | mLowerBodyMesh0.setTexture( baked ); | ||
7473 | mLowerBodyMesh1.setTexture( baked ); | ||
7474 | mLowerBodyMesh2.setTexture( baked ); | ||
7475 | mLowerBodyMesh3.setTexture( baked ); | ||
7476 | mLowerBodyMesh4.setTexture( baked ); | ||
7477 | } | ||
7478 | else | ||
7479 | if( !self_customize && lower_baked ) | ||
7480 | { | 6939 | { |
7481 | LLViewerImage* baked = getTEImage( TEX_LOWER_BAKED ); | 6940 | const LLColor4 color = mTexHairColor ? mTexHairColor->getColor() : LLColor4(1,1,1,1); |
7482 | if( baked->getID() == mLastLowerBodyBakedID ) | 6941 | LLViewerImage* hair_img = getTEImage( TEX_HAIR ); |
7483 | { | 6942 | for (U32 i = 0; i < mBakedTextureData[BAKED_HAIR].mMeshes.size(); i++) |
7484 | // Even though the file may not be finished loading, we'll consider it loaded and use it (rather than doing compositing). | ||
7485 | useBakedTexture( baked->getID() ); | ||
7486 | } | ||
7487 | else | ||
7488 | { | 6943 | { |
7489 | mLowerBakedLoaded = FALSE; | 6944 | mBakedTextureData[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); |
7490 | mLowerMaskDiscard = -1; | 6945 | mBakedTextureData[BAKED_HAIR].mMeshes[i]->setTexture( hair_img ); |
7491 | baked->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID )); | ||
7492 | baked->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ) ); | ||
7493 | } | 6946 | } |
7494 | } | 6947 | mHasBakedHair = FALSE; |
7495 | else | 6948 | } |
7496 | if( mLowerBodyLayerSet && !other_culled ) | 6949 | else |
7497 | { | ||
7498 | mLowerBodyLayerSet->createComposite(); | ||
7499 | mLowerBodyLayerSet->setUpdatesEnabled( TRUE ); | ||
7500 | mLowerBodyMesh0.setLayerSet( mLowerBodyLayerSet ); | ||
7501 | mLowerBodyMesh1.setLayerSet( mLowerBodyLayerSet ); | ||
7502 | mLowerBodyMesh2.setLayerSet( mLowerBodyLayerSet ); | ||
7503 | mLowerBodyMesh3.setLayerSet( mLowerBodyLayerSet ); | ||
7504 | mLowerBodyMesh4.setLayerSet( mLowerBodyLayerSet ); | ||
7505 | } | ||
7506 | else | ||
7507 | { | ||
7508 | mLowerBodyMesh0.setTexture( default_tex ); | ||
7509 | mLowerBodyMesh1.setTexture( default_tex ); | ||
7510 | mLowerBodyMesh2.setTexture( default_tex ); | ||
7511 | mLowerBodyMesh3.setTexture( default_tex ); | ||
7512 | mLowerBodyMesh4.setTexture( default_tex ); | ||
7513 | } | ||
7514 | |||
7515 | // Eyes | ||
7516 | if( use_lkg_eyes_baked ) | ||
7517 | { | ||
7518 | LLViewerImage* baked = gImageList.getImageFromHost( mLastEyesBakedID, target_host ); | ||
7519 | mEyeBallLeftMesh0.setTexture( baked ); | ||
7520 | mEyeBallLeftMesh1.setTexture( baked ); | ||
7521 | mEyeBallRightMesh0.setTexture( baked ); | ||
7522 | mEyeBallRightMesh1.setTexture( baked ); | ||
7523 | } | ||
7524 | else | ||
7525 | if( !self_customize && eyes_baked ) | ||
7526 | { | 6950 | { |
7527 | LLViewerImage* baked = getTEImage( TEX_EYES_BAKED ); | 6951 | for (U32 i = 0; i < mBakedTextureData[BAKED_HAIR].mMeshes.size(); i++) |
7528 | if( baked->getID() == mLastEyesBakedID ) | ||
7529 | { | 6952 | { |
7530 | // Even though the file may not be finished loading, we'll consider it loaded and use it (rather than doing compositing). | 6953 | mBakedTextureData[BAKED_HAIR].mMeshes[i]->setColor( 1.f, 1.f, 1.f, 1.f ); |
7531 | useBakedTexture( baked->getID() ); | ||
7532 | } | 6954 | } |
7533 | else | 6955 | mHasBakedHair = TRUE; |
7534 | { | ||
7535 | mEyesBakedLoaded = FALSE; | ||
7536 | baked->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ) ); | ||
7537 | } | ||
7538 | } | ||
7539 | else | ||
7540 | if( mEyesLayerSet && !other_culled ) | ||
7541 | { | ||
7542 | mEyesLayerSet->createComposite(); | ||
7543 | mEyesLayerSet->setUpdatesEnabled( TRUE ); | ||
7544 | mEyeBallLeftMesh0.setLayerSet( mEyesLayerSet ); | ||
7545 | mEyeBallLeftMesh1.setLayerSet( mEyesLayerSet ); | ||
7546 | mEyeBallRightMesh0.setLayerSet( mEyesLayerSet ); | ||
7547 | mEyeBallRightMesh1.setLayerSet( mEyesLayerSet ); | ||
7548 | } | ||
7549 | else | ||
7550 | { | ||
7551 | mEyeBallLeftMesh0.setTexture( default_tex ); | ||
7552 | mEyeBallLeftMesh1.setTexture( default_tex ); | ||
7553 | mEyeBallRightMesh0.setTexture( default_tex ); | ||
7554 | mEyeBallRightMesh1.setTexture( default_tex ); | ||
7555 | } | 6956 | } |
7556 | 6957 | ||
7557 | // Skirt | 6958 | /* // Head |
7558 | if( use_lkg_skirt_baked ) | 6959 | BOOL head_baked_ready = (is_layer_baked[BAKED_HEAD] && mBakedTextureData[BAKED_HEAD].mIsLoaded) || other_culled; |
7559 | { | 6960 | setLocalTexture( TEX_HEAD_BODYPAINT, getTEImage( TEX_HEAD_BODYPAINT ), head_baked_ready ); */ |
7560 | LLViewerImage* baked = gImageList.getImageFromHost( mLastSkirtBakedID, target_host ); | 6961 | for (LLVOAvatarDictionary::baked_map_t::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); |
7561 | mSkirtMesh0.setTexture( baked ); | 6962 | baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); |
7562 | mSkirtMesh1.setTexture( baked ); | 6963 | baked_iter++) |
7563 | mSkirtMesh2.setTexture( baked ); | 6964 | { |
7564 | mSkirtMesh3.setTexture( baked ); | 6965 | const EBakedTextureIndex baked_index = baked_iter->first; |
7565 | mSkirtMesh4.setTexture( baked ); | 6966 | const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = baked_iter->second; |
7566 | } | 6967 | |
7567 | else | 6968 | for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); |
7568 | if( !self_customize && skirt_baked ) | 6969 | local_tex_iter != baked_dict->mLocalTextures.end(); |
7569 | { | 6970 | local_tex_iter++) |
7570 | LLViewerImage* baked = getTEImage( TEX_SKIRT_BAKED ); | ||
7571 | if( baked->getID() == mLastSkirtBakedID ) | ||
7572 | { | ||
7573 | // Even though the file may not be finished loading, we'll consider it loaded and use it (rather than doing compositing). | ||
7574 | useBakedTexture( baked->getID() ); | ||
7575 | } | ||
7576 | else | ||
7577 | { | 6971 | { |
7578 | mSkirtBakedLoaded = FALSE; | 6972 | const ETextureIndex texture_index = *local_tex_iter; |
7579 | baked->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ) ); | 6973 | const BOOL is_baked_ready = (is_layer_baked[baked_index] && mBakedTextureData[baked_index].mIsLoaded) || other_culled; |
6974 | setLocalTexture(texture_index, getTEImage(texture_index), is_baked_ready ); | ||
7580 | } | 6975 | } |
7581 | } | 6976 | } |
7582 | else | ||
7583 | if( mSkirtLayerSet && !other_culled) | ||
7584 | { | ||
7585 | mSkirtLayerSet->createComposite(); | ||
7586 | mSkirtLayerSet->setUpdatesEnabled( TRUE ); | ||
7587 | mSkirtMesh0.setLayerSet( mSkirtLayerSet ); | ||
7588 | mSkirtMesh1.setLayerSet( mSkirtLayerSet ); | ||
7589 | mSkirtMesh2.setLayerSet( mSkirtLayerSet ); | ||
7590 | mSkirtMesh3.setLayerSet( mSkirtLayerSet ); | ||
7591 | mSkirtMesh4.setLayerSet( mSkirtLayerSet ); | ||
7592 | } | ||
7593 | else | ||
7594 | { | ||
7595 | mSkirtMesh0.setTexture( default_tex ); | ||
7596 | mSkirtMesh1.setTexture( default_tex ); | ||
7597 | mSkirtMesh2.setTexture( default_tex ); | ||
7598 | mSkirtMesh3.setTexture( default_tex ); | ||
7599 | mSkirtMesh4.setTexture( default_tex ); | ||
7600 | } | ||
7601 | |||
7602 | mHairMesh0.setTexture( getTEImage( TEX_HAIR ) ); | ||
7603 | mHairMesh1.setTexture( getTEImage( TEX_HAIR ) ); | ||
7604 | mHairMesh2.setTexture( getTEImage( TEX_HAIR ) ); | ||
7605 | mHairMesh3.setTexture( getTEImage( TEX_HAIR ) ); | ||
7606 | mHairMesh4.setTexture( getTEImage( TEX_HAIR ) ); | ||
7607 | mHairMesh5.setTexture( getTEImage( TEX_HAIR ) ); | ||
7608 | |||
7609 | if( mTexHairColor ) | ||
7610 | { | ||
7611 | LLColor4 color = mTexHairColor->getColor(); | ||
7612 | mHairMesh0.setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); | ||
7613 | mHairMesh1.setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); | ||
7614 | mHairMesh2.setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); | ||
7615 | mHairMesh3.setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); | ||
7616 | mHairMesh4.setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); | ||
7617 | mHairMesh5.setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); | ||
7618 | } | ||
7619 | |||
7620 | // Head | ||
7621 | BOOL head_baked_ready = (head_baked && mHeadBakedLoaded) || other_culled; | ||
7622 | setLocalTexture( LOCTEX_HEAD_BODYPAINT, getTEImage( TEX_HEAD_BODYPAINT ), head_baked_ready ); | ||
7623 | |||
7624 | // Upper body | ||
7625 | BOOL upper_baked_ready = (upper_baked && mUpperBakedLoaded) || other_culled; | ||
7626 | setLocalTexture( LOCTEX_UPPER_SHIRT, getTEImage( TEX_UPPER_SHIRT ), upper_baked_ready ); | ||
7627 | setLocalTexture( LOCTEX_UPPER_BODYPAINT, getTEImage( TEX_UPPER_BODYPAINT ), upper_baked_ready ); | ||
7628 | setLocalTexture( LOCTEX_UPPER_JACKET, getTEImage( TEX_UPPER_JACKET ), upper_baked_ready ); | ||
7629 | setLocalTexture( LOCTEX_UPPER_GLOVES, getTEImage( TEX_UPPER_GLOVES ), upper_baked_ready ); | ||
7630 | setLocalTexture( LOCTEX_UPPER_UNDERSHIRT, getTEImage( TEX_UPPER_UNDERSHIRT ), upper_baked_ready ); | ||
7631 | |||
7632 | // Lower body | ||
7633 | BOOL lower_baked_ready = (lower_baked && mLowerBakedLoaded) || other_culled; | ||
7634 | setLocalTexture( LOCTEX_LOWER_PANTS, getTEImage( TEX_LOWER_PANTS ), lower_baked_ready ); | ||
7635 | setLocalTexture( LOCTEX_LOWER_BODYPAINT, getTEImage( TEX_LOWER_BODYPAINT ), lower_baked_ready ); | ||
7636 | setLocalTexture( LOCTEX_LOWER_SHOES, getTEImage( TEX_LOWER_SHOES ), lower_baked_ready ); | ||
7637 | setLocalTexture( LOCTEX_LOWER_SOCKS, getTEImage( TEX_LOWER_SOCKS ), lower_baked_ready ); | ||
7638 | setLocalTexture( LOCTEX_LOWER_JACKET, getTEImage( TEX_LOWER_JACKET ), lower_baked_ready ); | ||
7639 | setLocalTexture( LOCTEX_LOWER_UNDERPANTS, getTEImage( TEX_LOWER_UNDERPANTS ), lower_baked_ready ); | ||
7640 | |||
7641 | // Eyes | ||
7642 | BOOL eyes_baked_ready = (eyes_baked && mEyesBakedLoaded) || other_culled; | ||
7643 | setLocalTexture( LOCTEX_EYES_IRIS, getTEImage( TEX_EYES_IRIS ), eyes_baked_ready ); | ||
7644 | |||
7645 | // Skirt | ||
7646 | BOOL skirt_baked_ready = (skirt_baked && mSkirtBakedLoaded) || other_culled; | ||
7647 | setLocalTexture( LOCTEX_SKIRT, getTEImage( TEX_SKIRT ), skirt_baked_ready ); | ||
7648 | |||
7649 | removeMissingBakedTextures(); | 6977 | removeMissingBakedTextures(); |
7650 | } | 6978 | } |
7651 | 6979 | ||
7652 | //----------------------------------------------------------------------------- | 6980 | //----------------------------------------------------------------------------- |
7653 | // setLocalTexture() | 6981 | // setLocalTexture() |
7654 | //----------------------------------------------------------------------------- | 6982 | //----------------------------------------------------------------------------- |
7655 | void LLVOAvatar::setLocalTexture( ELocTexIndex idx, LLViewerImage* tex, BOOL baked_version_ready ) | 6983 | void LLVOAvatar::setLocalTexture( ETextureIndex index, LLViewerImage* tex, BOOL baked_version_ready ) |
7656 | { | 6984 | { |
6985 | if (!isIndexLocalTexture(index)) return; | ||
6986 | |||
7657 | S32 desired_discard = mIsSelf ? 0 : 2; | 6987 | S32 desired_discard = mIsSelf ? 0 : 2; |
6988 | LocalTextureData &local_tex_data = mLocalTextureData[index]; | ||
7658 | if (!baked_version_ready) | 6989 | if (!baked_version_ready) |
7659 | { | 6990 | { |
7660 | if (tex != mLocalTexture[idx] || mLocalTextureBaked[idx]) | 6991 | if (tex != local_tex_data.mImage || local_tex_data.mIsBakedReady) |
7661 | { | 6992 | { |
7662 | mLocalTextureDiscard[idx] = MAX_DISCARD_LEVEL+1; | 6993 | local_tex_data.mDiscard = MAX_DISCARD_LEVEL+1; |
7663 | } | 6994 | } |
7664 | if (tex->getID() != IMG_DEFAULT_AVATAR) | 6995 | if (tex->getID() != IMG_DEFAULT_AVATAR) |
7665 | { | 6996 | { |
7666 | if (mLocalTextureDiscard[idx] > desired_discard) | 6997 | if (local_tex_data.mDiscard > desired_discard) |
7667 | { | 6998 | { |
7668 | S32 tex_discard = tex->getDiscardLevel(); | 6999 | S32 tex_discard = tex->getDiscardLevel(); |
7669 | if (tex_discard >= 0 && tex_discard <= desired_discard) | 7000 | if (tex_discard >= 0 && tex_discard <= desired_discard) |
7670 | { | 7001 | { |
7671 | mLocalTextureDiscard[idx] = tex_discard; | 7002 | local_tex_data.mDiscard = tex_discard; |
7672 | requestLayerSetUpdate( idx ); | 7003 | if( mIsSelf && !gAgent.cameraCustomizeAvatar() ) |
7673 | if( mIsSelf && gAgent.cameraCustomizeAvatar() ) | 7004 | { |
7005 | requestLayerSetUpdate( index ); | ||
7006 | } | ||
7007 | else if( mIsSelf && gAgent.cameraCustomizeAvatar() ) | ||
7674 | { | 7008 | { |
7675 | LLVisualParamHint::requestHintUpdates(); | 7009 | LLVisualParamHint::requestHintUpdates(); |
7676 | } | 7010 | } |
7677 | } | 7011 | } |
7678 | else | 7012 | else |
7679 | { | 7013 | { |
7680 | tex->setLoadedCallback( onLocalTextureLoaded, desired_discard, TRUE, FALSE, new LLAvatarTexData(getID(), idx) ); | 7014 | tex->setLoadedCallback( onLocalTextureLoaded, desired_discard, TRUE, FALSE, new LLAvatarTexData(getID(), index) ); |
7681 | } | 7015 | } |
7682 | } | 7016 | } |
7683 | tex->setMinDiscardLevel(desired_discard); | 7017 | tex->setMinDiscardLevel(desired_discard); |
7684 | } | 7018 | } |
7685 | } | 7019 | } |
7686 | mLocalTextureBaked[idx] = baked_version_ready; | 7020 | local_tex_data.mIsBakedReady = baked_version_ready; |
7687 | mLocalTexture[idx] = tex; | 7021 | local_tex_data.mImage = tex; |
7688 | } | 7022 | } |
7689 | 7023 | ||
7690 | //----------------------------------------------------------------------------- | 7024 | //----------------------------------------------------------------------------- |
@@ -7692,35 +7026,13 @@ void LLVOAvatar::setLocalTexture( ELocTexIndex idx, LLViewerImage* tex, BOOL bak | |||
7692 | //----------------------------------------------------------------------------- | 7026 | //----------------------------------------------------------------------------- |
7693 | void LLVOAvatar::requestLayerSetUploads() | 7027 | void LLVOAvatar::requestLayerSetUploads() |
7694 | { | 7028 | { |
7695 | BOOL upper_baked = (getTEImage( TEX_UPPER_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | 7029 | for (U32 i = 0; i < mBakedTextureData.size(); i++) |
7696 | BOOL lower_baked = (getTEImage( TEX_LOWER_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
7697 | BOOL head_baked = (getTEImage( TEX_HEAD_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
7698 | BOOL eyes_baked = (getTEImage( TEX_EYES_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
7699 | BOOL skirt_baked = (getTEImage( TEX_SKIRT_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
7700 | |||
7701 | if( !head_baked && mHeadLayerSet ) | ||
7702 | { | 7030 | { |
7703 | mHeadLayerSet->requestUpload(); | 7031 | bool layer_baked = isTextureDefined(mBakedTextureData[i].mTextureIndex); |
7704 | } | 7032 | if ( !layer_baked && mBakedTextureData[i].mTexLayerSet ) |
7705 | 7033 | { | |
7706 | if( !upper_baked && mUpperBodyLayerSet ) | 7034 | mBakedTextureData[i].mTexLayerSet->requestUpload(); |
7707 | { | 7035 | } |
7708 | mUpperBodyLayerSet->requestUpload(); | ||
7709 | } | ||
7710 | |||
7711 | if( !lower_baked && mLowerBodyLayerSet ) | ||
7712 | { | ||
7713 | mLowerBodyLayerSet->requestUpload(); | ||
7714 | } | ||
7715 | |||
7716 | if( !eyes_baked && mEyesLayerSet ) | ||
7717 | { | ||
7718 | mEyesLayerSet->requestUpload(); | ||
7719 | } | ||
7720 | |||
7721 | if( !skirt_baked && mSkirtLayerSet ) | ||
7722 | { | ||
7723 | mSkirtLayerSet->requestUpload(); | ||
7724 | } | 7036 | } |
7725 | } | 7037 | } |
7726 | 7038 | ||
@@ -7730,31 +7042,13 @@ void LLVOAvatar::requestLayerSetUploads() | |||
7730 | //----------------------------------------------------------------------------- | 7042 | //----------------------------------------------------------------------------- |
7731 | void LLVOAvatar::setCompositeUpdatesEnabled( BOOL b ) | 7043 | void LLVOAvatar::setCompositeUpdatesEnabled( BOOL b ) |
7732 | { | 7044 | { |
7733 | if( mHeadLayerSet ) | 7045 | for (U32 i = 0; i < mBakedTextureData.size(); i++) |
7734 | { | ||
7735 | mHeadLayerSet->setUpdatesEnabled( b ); | ||
7736 | } | ||
7737 | |||
7738 | if( mUpperBodyLayerSet ) | ||
7739 | { | ||
7740 | mUpperBodyLayerSet->setUpdatesEnabled( b ); | ||
7741 | } | ||
7742 | |||
7743 | if( mLowerBodyLayerSet ) | ||
7744 | { | 7046 | { |
7745 | mLowerBodyLayerSet->setUpdatesEnabled( b ); | 7047 | if (mBakedTextureData[i].mTexLayerSet ) |
7746 | } | 7048 | { |
7747 | 7049 | mBakedTextureData[i].mTexLayerSet->setUpdatesEnabled( b ); | |
7748 | if( mEyesLayerSet ) | 7050 | } |
7749 | { | ||
7750 | mEyesLayerSet->setUpdatesEnabled( b ); | ||
7751 | } | ||
7752 | |||
7753 | if( mSkirtLayerSet ) | ||
7754 | { | ||
7755 | mSkirtLayerSet->setUpdatesEnabled( b ); | ||
7756 | } | 7051 | } |
7757 | |||
7758 | } | 7052 | } |
7759 | 7053 | ||
7760 | void LLVOAvatar::addChat(const LLChat& chat) | 7054 | void LLVOAvatar::addChat(const LLChat& chat) |
@@ -7786,14 +7080,16 @@ void LLVOAvatar::clearChat() | |||
7786 | mChats.clear(); | 7080 | mChats.clear(); |
7787 | } | 7081 | } |
7788 | 7082 | ||
7789 | S32 LLVOAvatar::getLocalDiscardLevel( S32 index ) | 7083 | S32 LLVOAvatar::getLocalDiscardLevel( ETextureIndex index ) |
7790 | { | 7084 | { |
7085 | if (!isIndexLocalTexture(index)) return FALSE; | ||
7086 | |||
7087 | LocalTextureData &local_tex_data = mLocalTextureData[index]; | ||
7791 | if (index >= 0 | 7088 | if (index >= 0 |
7792 | && mLocalTexture[index].notNull() | 7089 | && getLocalTextureID(index) != IMG_DEFAULT_AVATAR |
7793 | && (mLocalTexture[index]->getID() != IMG_DEFAULT_AVATAR) | 7090 | && !local_tex_data.mImage->isMissingAsset()) |
7794 | && !mLocalTexture[index]->isMissingAsset()) | ||
7795 | { | 7091 | { |
7796 | return mLocalTexture[index]->getDiscardLevel(); | 7092 | return local_tex_data.mImage->getDiscardLevel(); |
7797 | } | 7093 | } |
7798 | else | 7094 | else |
7799 | { | 7095 | { |
@@ -7804,39 +7100,27 @@ S32 LLVOAvatar::getLocalDiscardLevel( S32 index ) | |||
7804 | 7100 | ||
7805 | //----------------------------------------------------------------------------- | 7101 | //----------------------------------------------------------------------------- |
7806 | // isLocalTextureDataFinal() | 7102 | // isLocalTextureDataFinal() |
7807 | // Returns true is the highest quality discard level exists for every texture | 7103 | // Returns true if the highest quality discard level exists for every texture |
7808 | // in the layerset. | 7104 | // in the layerset. |
7809 | //----------------------------------------------------------------------------- | 7105 | //----------------------------------------------------------------------------- |
7810 | BOOL LLVOAvatar::isLocalTextureDataFinal( LLTexLayerSet* layerset ) | 7106 | BOOL LLVOAvatar::isLocalTextureDataFinal( LLTexLayerSet* layerset ) |
7811 | { | 7107 | { |
7812 | if( layerset == mHeadLayerSet ) | 7108 | for (U32 i = 0; i < mBakedTextureData.size(); i++) |
7813 | { | 7109 | { |
7814 | return getLocalDiscardLevel( LOCTEX_HEAD_BODYPAINT ) == 0; | 7110 | if (layerset == mBakedTextureData[i].mTexLayerSet) |
7815 | } | 7111 | { |
7816 | else if( layerset == mUpperBodyLayerSet ) | 7112 | const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); |
7817 | { | 7113 | for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); |
7818 | return getLocalDiscardLevel( LOCTEX_UPPER_SHIRT ) == 0 && | 7114 | local_tex_iter != baked_dict->mLocalTextures.end(); |
7819 | getLocalDiscardLevel( LOCTEX_UPPER_BODYPAINT ) == 0 && | 7115 | local_tex_iter++) |
7820 | getLocalDiscardLevel( LOCTEX_UPPER_JACKET ) == 0 && | 7116 | { |
7821 | getLocalDiscardLevel( LOCTEX_UPPER_GLOVES ) == 0 && | 7117 | if (getLocalDiscardLevel(*local_tex_iter) != 0) |
7822 | getLocalDiscardLevel( LOCTEX_UPPER_UNDERSHIRT ) == 0; | 7118 | { |
7823 | } | 7119 | return FALSE; |
7824 | else if( layerset == mLowerBodyLayerSet ) | 7120 | } |
7825 | { | 7121 | } |
7826 | return getLocalDiscardLevel( LOCTEX_LOWER_PANTS ) == 0 && | 7122 | return TRUE; |
7827 | getLocalDiscardLevel( LOCTEX_LOWER_BODYPAINT ) == 0 && | 7123 | } |
7828 | getLocalDiscardLevel( LOCTEX_LOWER_SHOES ) == 0 && | ||
7829 | getLocalDiscardLevel( LOCTEX_LOWER_SOCKS ) == 0 && | ||
7830 | getLocalDiscardLevel( LOCTEX_LOWER_JACKET ) == 0 && | ||
7831 | getLocalDiscardLevel( LOCTEX_LOWER_UNDERPANTS ) == 0; | ||
7832 | } | ||
7833 | else if( layerset == mEyesLayerSet ) | ||
7834 | { | ||
7835 | return getLocalDiscardLevel( LOCTEX_EYES_IRIS ) == 0; | ||
7836 | } | ||
7837 | else if( layerset == mSkirtLayerSet ) | ||
7838 | { | ||
7839 | return getLocalDiscardLevel( LOCTEX_SKIRT ) == 0; | ||
7840 | } | 7124 | } |
7841 | 7125 | ||
7842 | llassert(0); | 7126 | llassert(0); |
@@ -7845,41 +7129,31 @@ BOOL LLVOAvatar::isLocalTextureDataFinal( LLTexLayerSet* layerset ) | |||
7845 | 7129 | ||
7846 | //----------------------------------------------------------------------------- | 7130 | //----------------------------------------------------------------------------- |
7847 | // isLocalTextureDataAvailable() | 7131 | // isLocalTextureDataAvailable() |
7848 | // Returns true is at least the lowest quality discard level exists for every texture | 7132 | // Returns true if at least the lowest quality discard level exists for every texture |
7849 | // in the layerset. | 7133 | // in the layerset. |
7850 | //----------------------------------------------------------------------------- | 7134 | //----------------------------------------------------------------------------- |
7851 | BOOL LLVOAvatar::isLocalTextureDataAvailable( LLTexLayerSet* layerset ) | 7135 | BOOL LLVOAvatar::isLocalTextureDataAvailable( LLTexLayerSet* layerset ) |
7852 | { | 7136 | { |
7853 | if( layerset == mHeadLayerSet ) | 7137 | /* if( layerset == mBakedTextureData[BAKED_HEAD].mTexLayerSet ) |
7138 | return getLocalDiscardLevel( TEX_HEAD_BODYPAINT ) >= 0; */ | ||
7139 | for (LLVOAvatarDictionary::baked_map_t::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); | ||
7140 | baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); | ||
7141 | baked_iter++) | ||
7854 | { | 7142 | { |
7855 | return getLocalDiscardLevel( LOCTEX_HEAD_BODYPAINT ) >= 0; | 7143 | const EBakedTextureIndex baked_index = baked_iter->first; |
7856 | } | 7144 | if (layerset == mBakedTextureData[baked_index].mTexLayerSet) |
7857 | else if( layerset == mUpperBodyLayerSet ) | 7145 | { |
7858 | { | 7146 | bool ret = true; |
7859 | return getLocalDiscardLevel( LOCTEX_UPPER_SHIRT ) >= 0 && | 7147 | const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = baked_iter->second; |
7860 | getLocalDiscardLevel( LOCTEX_UPPER_BODYPAINT ) >= 0 && | 7148 | for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); |
7861 | getLocalDiscardLevel( LOCTEX_UPPER_JACKET ) >= 0 && | 7149 | local_tex_iter != baked_dict->mLocalTextures.end(); |
7862 | getLocalDiscardLevel( LOCTEX_UPPER_GLOVES ) >= 0 && | 7150 | local_tex_iter++) |
7863 | getLocalDiscardLevel( LOCTEX_UPPER_UNDERSHIRT ) >= 0; | 7151 | { |
7864 | } | 7152 | ret &= (getLocalDiscardLevel(*local_tex_iter) >= 0); |
7865 | else if( layerset == mLowerBodyLayerSet ) | 7153 | } |
7866 | { | 7154 | return ret; |
7867 | return getLocalDiscardLevel( LOCTEX_LOWER_PANTS ) >= 0 && | 7155 | } |
7868 | getLocalDiscardLevel( LOCTEX_LOWER_BODYPAINT ) >= 0 && | ||
7869 | getLocalDiscardLevel( LOCTEX_LOWER_SHOES ) >= 0 && | ||
7870 | getLocalDiscardLevel( LOCTEX_LOWER_SOCKS ) >= 0 && | ||
7871 | getLocalDiscardLevel( LOCTEX_LOWER_JACKET ) >= 0 && | ||
7872 | getLocalDiscardLevel( LOCTEX_LOWER_UNDERPANTS ) >= 0; | ||
7873 | } | ||
7874 | else if( layerset == mEyesLayerSet ) | ||
7875 | { | ||
7876 | return getLocalDiscardLevel( LOCTEX_EYES_IRIS ) >= 0; | ||
7877 | } | ||
7878 | else if( layerset == mSkirtLayerSet ) | ||
7879 | { | ||
7880 | return getLocalDiscardLevel( LOCTEX_SKIRT ) >= 0; | ||
7881 | } | 7156 | } |
7882 | |||
7883 | llassert(0); | 7157 | llassert(0); |
7884 | return FALSE; | 7158 | return FALSE; |
7885 | } | 7159 | } |
@@ -7889,31 +7163,14 @@ BOOL LLVOAvatar::isLocalTextureDataAvailable( LLTexLayerSet* layerset ) | |||
7889 | // getBakedTE() | 7163 | // getBakedTE() |
7890 | // Used by the LayerSet. (Layer sets don't in general know what textures depend on them.) | 7164 | // Used by the LayerSet. (Layer sets don't in general know what textures depend on them.) |
7891 | //----------------------------------------------------------------------------- | 7165 | //----------------------------------------------------------------------------- |
7892 | LLVOAvatar::ETextureIndex LLVOAvatar::getBakedTE( LLTexLayerSet* layerset ) | 7166 | ETextureIndex LLVOAvatar::getBakedTE( LLTexLayerSet* layerset ) |
7893 | { | 7167 | { |
7894 | if( layerset == mHeadLayerSet ) | 7168 | for (U32 i = 0; i < mBakedTextureData.size(); i++) |
7895 | { | 7169 | { |
7896 | return TEX_HEAD_BAKED; | 7170 | if (layerset == mBakedTextureData[i].mTexLayerSet ) |
7897 | } | 7171 | { |
7898 | else | 7172 | return mBakedTextureData[i].mTextureIndex; |
7899 | if( layerset == mUpperBodyLayerSet ) | 7173 | } |
7900 | { | ||
7901 | return TEX_UPPER_BAKED; | ||
7902 | } | ||
7903 | else | ||
7904 | if( layerset == mLowerBodyLayerSet ) | ||
7905 | { | ||
7906 | return TEX_LOWER_BAKED; | ||
7907 | } | ||
7908 | else | ||
7909 | if( layerset == mEyesLayerSet ) | ||
7910 | { | ||
7911 | return TEX_EYES_BAKED; | ||
7912 | } | ||
7913 | else | ||
7914 | if( layerset == mSkirtLayerSet ) | ||
7915 | { | ||
7916 | return TEX_SKIRT_BAKED; | ||
7917 | } | 7174 | } |
7918 | 7175 | ||
7919 | llassert(0); | 7176 | llassert(0); |
@@ -7932,28 +7189,21 @@ void LLVOAvatar::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid ) | |||
7932 | updateMeshTextures(); | 7189 | updateMeshTextures(); |
7933 | dirtyMesh(); | 7190 | dirtyMesh(); |
7934 | 7191 | ||
7192 | |||
7935 | LLVOAvatar::cullAvatarsByPixelArea(); | 7193 | LLVOAvatar::cullAvatarsByPixelArea(); |
7936 | 7194 | ||
7937 | switch( te ) | 7195 | /* switch(te) |
7196 | case TEX_HEAD_BAKED: | ||
7197 | llinfos << "New baked texture: HEAD" << llendl; */ | ||
7198 | const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(te); | ||
7199 | if (text_dict->mIsBakedTexture) | ||
7200 | { | ||
7201 | llinfos << "New baked texture: " << text_dict->mName << " UUID: " << uuid <<llendl; | ||
7202 | mBakedTextureData[text_dict->mBakedTextureIndex].mTexLayerSet->requestUpdate(); | ||
7203 | } | ||
7204 | else | ||
7938 | { | 7205 | { |
7939 | case TEX_HEAD_BAKED: | ||
7940 | llinfos << "New baked texture: HEAD" << llendl; | ||
7941 | break; | ||
7942 | case TEX_UPPER_BAKED: | ||
7943 | llinfos << "New baked texture: UPPER" << llendl; | ||
7944 | break; | ||
7945 | case TEX_LOWER_BAKED: | ||
7946 | llinfos << "New baked texture: LOWER" << llendl; | ||
7947 | break; | ||
7948 | case TEX_EYES_BAKED: | ||
7949 | llinfos << "New baked texture: EYES" << llendl; | ||
7950 | break; | ||
7951 | case TEX_SKIRT_BAKED: | ||
7952 | llinfos << "New baked texture: SKIRT" << llendl; | ||
7953 | break; | ||
7954 | default: | ||
7955 | llwarns << "New baked texture: unknown te " << te << llendl; | 7206 | llwarns << "New baked texture: unknown te " << te << llendl; |
7956 | break; | ||
7957 | } | 7207 | } |
7958 | 7208 | ||
7959 | // dumpAvatarTEs( "setNewBakedTexture() send" ); | 7209 | // dumpAvatarTEs( "setNewBakedTexture() send" ); |
@@ -7966,28 +7216,15 @@ void LLVOAvatar::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid ) | |||
7966 | 7216 | ||
7967 | bool LLVOAvatar::hasPendingBakedUploads() | 7217 | bool LLVOAvatar::hasPendingBakedUploads() |
7968 | { | 7218 | { |
7969 | bool head_pending = (mHeadLayerSet && mHeadLayerSet->getComposite()->uploadPending()); | 7219 | for (U32 i = 0; i < mBakedTextureData.size(); i++) |
7970 | bool upper_pending = (mUpperBodyLayerSet && mUpperBodyLayerSet->getComposite()->uploadPending()); | ||
7971 | bool lower_pending = (mLowerBodyLayerSet && mLowerBodyLayerSet->getComposite()->uploadPending()); | ||
7972 | bool eyes_pending = (mEyesLayerSet && mEyesLayerSet->getComposite()->uploadPending()); | ||
7973 | bool skirt_pending = (mSkirtLayerSet && mSkirtLayerSet->getComposite()->uploadPending()); | ||
7974 | |||
7975 | //llinfos << "TAT: LLVOAvatar::hasPendingBakedUploads()" | ||
7976 | // << " head_pending " << head_pending | ||
7977 | // << " upper_pending " << upper_pending | ||
7978 | // << " lower_pending " << lower_pending | ||
7979 | // << " eyes_pending " << eyes_pending | ||
7980 | // << " skirt_pending " << skirt_pending | ||
7981 | // << llendl; | ||
7982 | |||
7983 | if (head_pending || upper_pending || lower_pending || eyes_pending || skirt_pending) | ||
7984 | { | 7220 | { |
7985 | return true; | 7221 | bool upload_pending = (mBakedTextureData[i].mTexLayerSet && mBakedTextureData[i].mTexLayerSet->getComposite()->uploadPending()); |
7986 | } | 7222 | if (upload_pending) |
7987 | else | 7223 | { |
7988 | { | 7224 | return true; |
7989 | return false; | 7225 | } |
7990 | } | 7226 | } |
7227 | return false; | ||
7991 | } | 7228 | } |
7992 | 7229 | ||
7993 | //----------------------------------------------------------------------------- | 7230 | //----------------------------------------------------------------------------- |
@@ -7998,56 +7235,50 @@ void LLVOAvatar::setCachedBakedTexture( ETextureIndex te, const LLUUID& uuid ) | |||
7998 | { | 7235 | { |
7999 | setTETexture( te, uuid ); | 7236 | setTETexture( te, uuid ); |
8000 | 7237 | ||
8001 | switch(te) | 7238 | /* switch(te) |
7239 | case TEX_HEAD_BAKED: | ||
7240 | if( mHeadLayerSet ) | ||
7241 | mHeadLayerSet->cancelUpload(); */ | ||
7242 | for (U32 i = 0; i < mBakedTextureData.size(); i++) | ||
8002 | { | 7243 | { |
8003 | case TEX_HEAD_BAKED: | 7244 | if ( mBakedTextureData[i].mTextureIndex == te && mBakedTextureData[i].mTexLayerSet) |
8004 | if( mHeadLayerSet ) | ||
8005 | { | ||
8006 | mHeadLayerSet->cancelUpload(); | ||
8007 | } | ||
8008 | break; | ||
8009 | case TEX_UPPER_BAKED: | ||
8010 | if( mUpperBodyLayerSet ) | ||
8011 | { | 7245 | { |
8012 | mUpperBodyLayerSet->cancelUpload(); | 7246 | mBakedTextureData[i].mTexLayerSet->cancelUpload(); |
8013 | } | 7247 | } |
8014 | break; | 7248 | } |
8015 | case TEX_LOWER_BAKED: | 7249 | } |
8016 | if( mLowerBodyLayerSet ) | 7250 | |
7251 | //----------------------------------------------------------------------------- | ||
7252 | // releaseUnneccesaryTextures() | ||
7253 | // release any component texture UUIDs for which we have a baked texture | ||
7254 | //----------------------------------------------------------------------------- | ||
7255 | void LLVOAvatar::releaseUnnecessaryTextures() | ||
7256 | { | ||
7257 | // Backwards Compat: detect if the baked hair texture actually wasn't sent, and if so set to default | ||
7258 | if (isTextureDefined(TEX_HAIR_BAKED) && getTEImage(TEX_HAIR_BAKED)->getID() == getTEImage(TEX_SKIRT_BAKED)->getID()) | ||
7259 | { | ||
7260 | if (getTEImage(TEX_HAIR_BAKED)->getID() != IMG_INVISIBLE) | ||
8017 | { | 7261 | { |
8018 | mLowerBodyLayerSet->cancelUpload(); | 7262 | // Regression case of messaging system. Expected 21 textures, received 20. last texture is not valid so set to default |
7263 | setTETexture(TEX_HAIR_BAKED, IMG_DEFAULT_AVATAR); | ||
8019 | } | 7264 | } |
8020 | break; | 7265 | } |
8021 | case TEX_EYES_BAKED: | 7266 | |
8022 | if( mEyesLayerSet ) | 7267 | for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) |
7268 | { | ||
7269 | const LLVOAvatarDictionary::BakedDictionaryEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); | ||
7270 | // skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID | ||
7271 | if (!isTextureDefined(bakedDicEntry->mTextureIndex) | ||
7272 | && ( (baked_index != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) )) | ||
8023 | { | 7273 | { |
8024 | mEyesLayerSet->cancelUpload(); | 7274 | continue; |
8025 | } | 7275 | } |
8026 | break; | 7276 | |
8027 | case TEX_SKIRT_BAKED: | 7277 | for (U8 texture = 0; texture < bakedDicEntry->mLocalTextures.size(); texture++) |
8028 | if( mSkirtLayerSet ) | ||
8029 | { | 7278 | { |
8030 | mSkirtLayerSet->cancelUpload(); | 7279 | const U8 te = (ETextureIndex)bakedDicEntry->mLocalTextures[texture]; |
7280 | setTETexture(te, IMG_DEFAULT_AVATAR); | ||
8031 | } | 7281 | } |
8032 | break; | ||
8033 | |||
8034 | case TEX_HEAD_BODYPAINT: | ||
8035 | case TEX_UPPER_SHIRT: | ||
8036 | case TEX_LOWER_PANTS: | ||
8037 | case TEX_EYES_IRIS: | ||
8038 | case TEX_HAIR: | ||
8039 | case TEX_UPPER_BODYPAINT: | ||
8040 | case TEX_LOWER_BODYPAINT: | ||
8041 | case TEX_LOWER_SHOES: | ||
8042 | case TEX_LOWER_SOCKS: | ||
8043 | case TEX_UPPER_JACKET: | ||
8044 | case TEX_LOWER_JACKET: | ||
8045 | case TEX_UPPER_GLOVES: | ||
8046 | case TEX_UPPER_UNDERSHIRT: | ||
8047 | case TEX_LOWER_UNDERPANTS: | ||
8048 | case TEX_SKIRT: | ||
8049 | case TEX_NUM_ENTRIES: | ||
8050 | break; | ||
8051 | } | 7282 | } |
8052 | } | 7283 | } |
8053 | 7284 | ||
@@ -8057,21 +7288,9 @@ void LLVOAvatar::setCachedBakedTexture( ETextureIndex te, const LLUUID& uuid ) | |||
8057 | //----------------------------------------------------------------------------- | 7288 | //----------------------------------------------------------------------------- |
8058 | void LLVOAvatar::onCustomizeStart() | 7289 | void LLVOAvatar::onCustomizeStart() |
8059 | { | 7290 | { |
8060 | LLVOAvatar* avatar = gAgent.getAvatarObject(); | 7291 | // We're no longer doing any baking or invalidating on entering |
8061 | if( avatar ) | 7292 | // appearance editing mode. Leaving function in place in case |
8062 | { | 7293 | // further changes require us to do something at this point - Nyx |
8063 | for( S32 i = 0; i < BAKED_TEXTURE_COUNT; i++ ) | ||
8064 | { | ||
8065 | S32 tex_index = sBakedTextureIndices[i]; | ||
8066 | avatar->mSavedTE[ tex_index ] = avatar->getTEImage(tex_index)->getID(); | ||
8067 | avatar->setTEImage( tex_index, gImageList.getImage(IMG_DEFAULT_AVATAR) ); | ||
8068 | } | ||
8069 | |||
8070 | avatar->updateMeshTextures(); | ||
8071 | |||
8072 | // avatar->dumpAvatarTEs( "onCustomizeStart() send" ); | ||
8073 | gAgent.sendAgentSetAppearance(); | ||
8074 | } | ||
8075 | } | 7294 | } |
8076 | 7295 | ||
8077 | //----------------------------------------------------------------------------- | 7296 | //----------------------------------------------------------------------------- |
@@ -8080,29 +7299,31 @@ void LLVOAvatar::onCustomizeStart() | |||
8080 | //----------------------------------------------------------------------------- | 7299 | //----------------------------------------------------------------------------- |
8081 | void LLVOAvatar::onCustomizeEnd() | 7300 | void LLVOAvatar::onCustomizeEnd() |
8082 | { | 7301 | { |
8083 | LLVOAvatar* avatar = gAgent.getAvatarObject(); | 7302 | LLVOAvatar *avatarp = gAgent.getAvatarObject(); |
8084 | if( !avatar ) return; | 7303 | if (avatarp) |
7304 | { | ||
7305 | avatarp->invalidateAll(); | ||
7306 | avatarp->requestLayerSetUploads(); | ||
7307 | } | ||
7308 | } | ||
8085 | 7309 | ||
8086 | LLHost target_host = avatar->getObjectHost(); | 7310 | void LLVOAvatar::onChangeSelfInvisible(BOOL newvalue) |
8087 | for( S32 i = 0; i < BAKED_TEXTURE_COUNT; i++ ) | 7311 | { |
7312 | LLVOAvatar *avatarp = gAgent.getAvatarObject(); | ||
7313 | if (avatarp) | ||
7314 | { | ||
7315 | if (newvalue) | ||
8088 | { | 7316 | { |
8089 | S32 tex_index = sBakedTextureIndices[i]; | 7317 | // we have just requested to set the avatar's baked textures to invisible |
8090 | const LLUUID& saved = avatar->mSavedTE[ tex_index ]; | 7318 | avatarp->setInvisible(TRUE); |
8091 | if( !saved.isNull() ) | ||
8092 | { | ||
8093 | avatar->setTEImage( tex_index, gImageList.getImageFromHost( saved, target_host ) ); | ||
8094 | } | ||
8095 | } | 7319 | } |
8096 | 7320 | else | |
8097 | avatar->updateMeshTextures(); | ||
8098 | |||
8099 | if( !LLApp::isExiting()) | ||
8100 | { | 7321 | { |
8101 | avatar->requestLayerSetUploads(); | 7322 | avatarp->setInvisible(FALSE); |
8102 | } | 7323 | } |
8103 | |||
8104 | gAgent.sendAgentSetAppearance(); | ||
8105 | } | 7324 | } |
7325 | } | ||
7326 | |||
8106 | 7327 | ||
8107 | BOOL LLVOAvatar::teToColorParams( ETextureIndex te, const char* param_name[3] ) | 7328 | BOOL LLVOAvatar::teToColorParams( ETextureIndex te, const char* param_name[3] ) |
8108 | { | 7329 | { |
@@ -8182,7 +7403,7 @@ void LLVOAvatar::setClothesColor( ETextureIndex te, const LLColor4& new_color, B | |||
8182 | } | 7403 | } |
8183 | } | 7404 | } |
8184 | 7405 | ||
8185 | LLColor4 LLVOAvatar::getClothesColor( ETextureIndex te ) | 7406 | LLColor4 LLVOAvatar::getClothesColor( ETextureIndex te ) |
8186 | { | 7407 | { |
8187 | LLColor4 color; | 7408 | LLColor4 color; |
8188 | const char* param_name[3]; | 7409 | const char* param_name[3]; |
@@ -8199,56 +7420,36 @@ LLColor4 LLVOAvatar::getClothesColor( ETextureIndex te ) | |||
8199 | 7420 | ||
8200 | 7421 | ||
8201 | void LLVOAvatar::dumpAvatarTEs( const std::string& context ) | 7422 | void LLVOAvatar::dumpAvatarTEs( const std::string& context ) |
8202 | { | 7423 | { |
7424 | /* const char* te_name[] = { | ||
7425 | "TEX_HEAD_BODYPAINT ", | ||
7426 | "TEX_UPPER_SHIRT ", */ | ||
8203 | llinfos << (mIsSelf ? "Self: " : "Other: ") << context << llendl; | 7427 | llinfos << (mIsSelf ? "Self: " : "Other: ") << context << llendl; |
8204 | for( S32 i=0; i<TEX_NUM_ENTRIES; i++ ) | 7428 | for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); |
7429 | iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); | ||
7430 | iter++) | ||
8205 | { | 7431 | { |
8206 | const char* te_name[] = { | 7432 | const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; |
8207 | "TEX_HEAD_BODYPAINT ", | 7433 | const LLViewerImage* te_image = getTEImage(iter->first); |
8208 | "TEX_UPPER_SHIRT ", | ||
8209 | "TEX_LOWER_PANTS ", | ||
8210 | "TEX_EYES_IRIS ", | ||
8211 | "TEX_HAIR ", | ||
8212 | "TEX_UPPER_BODYPAINT ", | ||
8213 | "TEX_LOWER_BODYPAINT ", | ||
8214 | "TEX_LOWER_SHOES ", | ||
8215 | "TEX_HEAD_BAKED ", | ||
8216 | "TEX_UPPER_BAKED ", | ||
8217 | "TEX_LOWER_BAKED ", | ||
8218 | "TEX_EYES_BAKED ", | ||
8219 | "TEX_LOWER_SOCKS ", | ||
8220 | "TEX_UPPER_JACKET ", | ||
8221 | "TEX_LOWER_JACKET ", | ||
8222 | "TEX_UPPER_GLOVES ", | ||
8223 | "TEX_UPPER_UNDERSHIRT ", | ||
8224 | "TEX_LOWER_UNDERPANTS ", | ||
8225 | "TEX_SKIRT ", | ||
8226 | "TEX_SKIRT_BAKED " | ||
8227 | }; | ||
8228 | |||
8229 | LLViewerImage* te_image = getTEImage(i); | ||
8230 | if( !te_image ) | 7434 | if( !te_image ) |
8231 | { | 7435 | { |
8232 | llinfos << " " << te_name[i] << ": null ptr" << llendl; | 7436 | llinfos << " " << text_dict->mName << ": null ptr" << llendl; |
8233 | } | 7437 | } |
8234 | else | 7438 | else if( te_image->getID().isNull() ) |
8235 | if( te_image->getID().isNull() ) | ||
8236 | { | 7439 | { |
8237 | llinfos << " " << te_name[i] << ": null UUID" << llendl; | 7440 | llinfos << " " << text_dict->mName << ": null UUID" << llendl; |
8238 | } | 7441 | } |
8239 | else | 7442 | else if( te_image->getID() == IMG_DEFAULT ) |
8240 | if( te_image->getID() == IMG_DEFAULT ) | ||
8241 | { | 7443 | { |
8242 | llinfos << " " << te_name[i] << ": IMG_DEFAULT" << llendl; | 7444 | llinfos << " " << text_dict->mName << ": IMG_DEFAULT" << llendl; |
8243 | } | 7445 | } |
8244 | else | 7446 | else if( te_image->getID() == IMG_DEFAULT_AVATAR ) |
8245 | if( te_image->getID() == IMG_DEFAULT_AVATAR ) | ||
8246 | { | 7447 | { |
8247 | llinfos << " " << te_name[i] << ": IMG_DEFAULT_AVATAR" << llendl; | 7448 | llinfos << " " << text_dict->mName << ": IMG_DEFAULT_AVATAR" << llendl; |
8248 | } | 7449 | } |
8249 | else | 7450 | else |
8250 | { | 7451 | { |
8251 | llinfos << " " << te_name[i] << ": " << te_image->getID() << llendl; | 7452 | llinfos << " " << text_dict->mName << ": " << te_image->getID() << llendl; |
8252 | } | 7453 | } |
8253 | } | 7454 | } |
8254 | } | 7455 | } |
@@ -8291,80 +7492,56 @@ void LLVOAvatar::updateAttachmentVisibility(U32 camera_mode) | |||
8291 | 7492 | ||
8292 | // Given a texture entry, determine which wearable type owns it. | 7493 | // Given a texture entry, determine which wearable type owns it. |
8293 | // static | 7494 | // static |
8294 | LLUUID LLVOAvatar::getDefaultTEImageID( S32 te ) | 7495 | LLUUID LLVOAvatar::getDefaultTEImageID(ETextureIndex index ) |
8295 | { | 7496 | { |
8296 | switch( te ) | 7497 | /* switch( index ) |
7498 | case TEX_UPPER_SHIRT: return LLUUID( gSavedSettings.getString("UIImgDefaultShirtUUID") ); */ | ||
7499 | const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); | ||
7500 | const std::string &default_image_name = text_dict->mDefaultImageName; | ||
7501 | if (default_image_name == "") | ||
8297 | { | 7502 | { |
8298 | case TEX_UPPER_SHIRT: return LLUUID( gSavedSettings.getString("UIImgDefaultShirtUUID") ); | 7503 | return IMG_DEFAULT_AVATAR; |
8299 | case TEX_LOWER_PANTS: return LLUUID( gSavedSettings.getString("UIImgDefaultPantsUUID") ); | 7504 | } |
8300 | case TEX_EYES_IRIS: return LLUUID( gSavedSettings.getString("UIImgDefaultEyesUUID") ); | 7505 | else |
8301 | case TEX_HAIR: return LLUUID( gSavedSettings.getString("UIImgDefaultHairUUID") ); | 7506 | { |
8302 | case TEX_LOWER_SHOES: return LLUUID( gSavedSettings.getString("UIImgDefaultShoesUUID") ); | 7507 | return LLUUID(gSavedSettings.getString(default_image_name)); |
8303 | case TEX_LOWER_SOCKS: return LLUUID( gSavedSettings.getString("UIImgDefaultSocksUUID") ); | 7508 | } |
8304 | case TEX_UPPER_GLOVES: return LLUUID( gSavedSettings.getString("UIImgDefaultGlovesUUID") ); | 7509 | } |
8305 | |||
8306 | case TEX_UPPER_JACKET: | ||
8307 | case TEX_LOWER_JACKET: return LLUUID( gSavedSettings.getString("UIImgDefaultJacketUUID") ); | ||
8308 | |||
8309 | case TEX_UPPER_UNDERSHIRT: | ||
8310 | case TEX_LOWER_UNDERPANTS: return LLUUID( gSavedSettings.getString("UIImgDefaultUnderwearUUID") ); | ||
8311 | 7510 | ||
8312 | case TEX_SKIRT: return LLUUID( gSavedSettings.getString("UIImgDefaultSkirtUUID") ); | ||
8313 | 7511 | ||
8314 | default: return IMG_DEFAULT_AVATAR; | 7512 | void LLVOAvatar::setInvisible(BOOL newvalue) |
7513 | { | ||
7514 | if (newvalue) | ||
7515 | { | ||
7516 | setCompositeUpdatesEnabled(FALSE); | ||
7517 | for (U32 i = 0; i < mBakedTextureData.size(); i++ ) | ||
7518 | { | ||
7519 | setNewBakedTexture(mBakedTextureData[i].mTextureIndex, IMG_INVISIBLE); | ||
7520 | } | ||
7521 | gAgent.sendAgentSetAppearance(); | ||
7522 | } | ||
7523 | else | ||
7524 | { | ||
7525 | setCompositeUpdatesEnabled(TRUE); | ||
7526 | invalidateAll(); | ||
7527 | requestLayerSetUploads(); | ||
7528 | gAgent.sendAgentSetAppearance(); | ||
8315 | } | 7529 | } |
8316 | } | 7530 | } |
8317 | 7531 | ||
8318 | 7532 | LLColor4 LLVOAvatar::getDummyColor() | |
7533 | { | ||
7534 | return DUMMY_COLOR; | ||
7535 | } | ||
8319 | 7536 | ||
8320 | // Given a texture entry, determine which wearable type owns it. | 7537 | // Given a texture entry, determine which wearable type owns it. |
8321 | // static | 7538 | // static |
8322 | EWearableType LLVOAvatar::getTEWearableType( S32 te ) | 7539 | EWearableType LLVOAvatar::getTEWearableType(ETextureIndex index ) |
8323 | { | 7540 | { |
8324 | switch( te ) | 7541 | /* switch(index) |
8325 | { | 7542 | case TEX_UPPER_SHIRT: |
8326 | case TEX_UPPER_SHIRT: | 7543 | return WT_SHIRT; */ |
8327 | return WT_SHIRT; | 7544 | return LLVOAvatarDictionary::getInstance()->getTexture(index)->mWearableType; |
8328 | |||
8329 | case TEX_LOWER_PANTS: | ||
8330 | return WT_PANTS; | ||
8331 | |||
8332 | case TEX_EYES_IRIS: | ||
8333 | return WT_EYES; | ||
8334 | |||
8335 | case TEX_HAIR: | ||
8336 | return WT_HAIR; | ||
8337 | |||
8338 | case TEX_HEAD_BODYPAINT: | ||
8339 | case TEX_UPPER_BODYPAINT: | ||
8340 | case TEX_LOWER_BODYPAINT: | ||
8341 | return WT_SKIN; | ||
8342 | |||
8343 | case TEX_LOWER_SHOES: | ||
8344 | return WT_SHOES; | ||
8345 | |||
8346 | case TEX_LOWER_SOCKS: | ||
8347 | return WT_SOCKS; | ||
8348 | |||
8349 | case TEX_UPPER_JACKET: | ||
8350 | case TEX_LOWER_JACKET: | ||
8351 | return WT_JACKET; | ||
8352 | |||
8353 | case TEX_UPPER_GLOVES: | ||
8354 | return WT_GLOVES; | ||
8355 | |||
8356 | case TEX_UPPER_UNDERSHIRT: | ||
8357 | return WT_UNDERSHIRT; | ||
8358 | |||
8359 | case TEX_LOWER_UNDERPANTS: | ||
8360 | return WT_UNDERPANTS; | ||
8361 | |||
8362 | case TEX_SKIRT: | ||
8363 | return WT_SKIRT; | ||
8364 | |||
8365 | default: | ||
8366 | return WT_INVALID; | ||
8367 | } | ||
8368 | } | 7545 | } |
8369 | 7546 | ||
8370 | // Unlike most wearable functions, this works for both self and other. | 7547 | // Unlike most wearable functions, this works for both self and other. |
@@ -8372,57 +7549,102 @@ BOOL LLVOAvatar::isWearingWearableType( EWearableType type ) | |||
8372 | { | 7549 | { |
8373 | if (mIsDummy) return TRUE; | 7550 | if (mIsDummy) return TRUE; |
8374 | 7551 | ||
8375 | ETextureIndex indicator_te; | ||
8376 | switch( type ) | 7552 | switch( type ) |
8377 | { | 7553 | { |
8378 | case WT_SHIRT: | ||
8379 | indicator_te = TEX_UPPER_SHIRT; | ||
8380 | break; | ||
8381 | |||
8382 | case WT_PANTS: | ||
8383 | indicator_te = TEX_LOWER_PANTS; | ||
8384 | break; | ||
8385 | |||
8386 | case WT_SHOES: | ||
8387 | indicator_te = TEX_LOWER_SHOES; | ||
8388 | break; | ||
8389 | |||
8390 | case WT_SOCKS: | ||
8391 | indicator_te = TEX_LOWER_SOCKS; | ||
8392 | break; | ||
8393 | |||
8394 | case WT_JACKET: | ||
8395 | indicator_te = TEX_UPPER_JACKET; | ||
8396 | // Note: no need to test both upper and lower jacket | ||
8397 | break; | ||
8398 | |||
8399 | case WT_GLOVES: | ||
8400 | indicator_te = TEX_UPPER_GLOVES; | ||
8401 | break; | ||
8402 | |||
8403 | case WT_UNDERSHIRT: | ||
8404 | indicator_te = TEX_UPPER_UNDERSHIRT; | ||
8405 | break; | ||
8406 | |||
8407 | case WT_UNDERPANTS: | ||
8408 | indicator_te = TEX_LOWER_UNDERPANTS; | ||
8409 | break; | ||
8410 | |||
8411 | case WT_SKIRT: | ||
8412 | indicator_te = TEX_SKIRT; | ||
8413 | break; | ||
8414 | |||
8415 | case WT_SHAPE: | 7554 | case WT_SHAPE: |
8416 | case WT_SKIN: | 7555 | case WT_SKIN: |
8417 | case WT_HAIR: | 7556 | case WT_HAIR: |
8418 | case WT_EYES: | 7557 | case WT_EYES: |
8419 | return TRUE; // everyone has all bodyparts | 7558 | return TRUE; // everyone has all bodyparts |
8420 | |||
8421 | default: | 7559 | default: |
7560 | break; // Do nothing | ||
7561 | } | ||
7562 | |||
7563 | /* switch(type) | ||
7564 | case WT_SHIRT: | ||
7565 | indicator_te = TEX_UPPER_SHIRT; */ | ||
7566 | for (LLVOAvatarDictionary::texture_map_t::const_iterator tex_iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); | ||
7567 | tex_iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); | ||
7568 | tex_iter++) | ||
7569 | { | ||
7570 | const LLVOAvatarDefines::ETextureIndex index = tex_iter->first; | ||
7571 | const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = tex_iter->second; | ||
7572 | if (text_dict->mWearableType == type) | ||
7573 | { | ||
7574 | // If you're checking your own clothing, check the component texture | ||
7575 | if (mIsSelf) | ||
7576 | { | ||
7577 | if (isTextureDefined(index)) | ||
7578 | { | ||
7579 | return TRUE; | ||
7580 | } | ||
7581 | else | ||
7582 | { | ||
7583 | return FALSE; | ||
7584 | } | ||
7585 | } | ||
7586 | |||
7587 | // If you're checking another avatar's clothing, you don't have component textures. | ||
7588 | // Thus, you must check to see if the corresponding baked texture is defined. | ||
7589 | // NOTE: this is a poor substitute if you actually want to know about individual pieces of clothing | ||
7590 | // this works for detecting a skirt (most important), but is ineffective at any piece of clothing that | ||
7591 | // gets baked into a texture that always exists (upper or lower). | ||
7592 | const std::string name = text_dict->mName; | ||
7593 | for (LLVOAvatarDictionary::baked_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); | ||
7594 | iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); | ||
7595 | iter++) | ||
7596 | { | ||
7597 | const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = iter->second; | ||
7598 | if (baked_dict->mName == name) | ||
7599 | { | ||
7600 | if (isTextureDefined(baked_dict->mTextureIndex)) | ||
7601 | { | ||
7602 | return TRUE; | ||
7603 | } | ||
7604 | else | ||
7605 | { | ||
7606 | return FALSE; | ||
7607 | } | ||
7608 | } | ||
7609 | } | ||
8422 | return FALSE; | 7610 | return FALSE; |
7611 | } | ||
8423 | } | 7612 | } |
7613 | return FALSE; | ||
7614 | } | ||
8424 | 7615 | ||
8425 | return ( getTEImage(indicator_te)->getID() != IMG_DEFAULT_AVATAR ); | 7616 | //----------------------------------------------------------------------------- |
7617 | // updatedWearable( EWearableType type ) | ||
7618 | // forces an update to any baked textures relevant to type. | ||
7619 | // Should be called only on saving the wearable | ||
7620 | //----------------------------------------------------------------------------- | ||
7621 | void LLVOAvatar::wearableUpdated( EWearableType type ) | ||
7622 | { | ||
7623 | for (LLVOAvatarDictionary::wearable_map_t::const_iterator wearable_iter = LLVOAvatarDictionary::getInstance()->getWearables().begin(); | ||
7624 | wearable_iter != LLVOAvatarDictionary::getInstance()->getWearables().end(); | ||
7625 | wearable_iter++) | ||
7626 | { | ||
7627 | const LLVOAvatarDictionary::WearableDictionaryEntry *wearable_dict = wearable_iter->second; | ||
7628 | const LLVOAvatarDefines::EBakedTextureIndex index = wearable_iter->first; | ||
7629 | if (wearable_dict) | ||
7630 | { | ||
7631 | for (LLVOAvatarDefines::wearables_vec_t::const_iterator type_iter = wearable_dict->mWearablesVec.begin(); | ||
7632 | type_iter != wearable_dict->mWearablesVec.end(); | ||
7633 | type_iter++) | ||
7634 | { | ||
7635 | const EWearableType comp_type = *type_iter; | ||
7636 | if (comp_type == type) | ||
7637 | { | ||
7638 | if (mBakedTextureData[index].mTexLayerSet) | ||
7639 | { | ||
7640 | mBakedTextureData[index].mTexLayerSet->requestUpdate(); | ||
7641 | mBakedTextureData[index].mTexLayerSet->requestUpload(); | ||
7642 | } | ||
7643 | break; | ||
7644 | } | ||
7645 | } | ||
7646 | } | ||
7647 | } | ||
8426 | } | 7648 | } |
8427 | 7649 | ||
8428 | 7650 | ||
@@ -8447,12 +7669,12 @@ void LLVOAvatar::clampAttachmentPositions() | |||
8447 | } | 7669 | } |
8448 | } | 7670 | } |
8449 | 7671 | ||
8450 | BOOL LLVOAvatar::hasHUDAttachment() | 7672 | BOOL LLVOAvatar::hasHUDAttachment() const |
8451 | { | 7673 | { |
8452 | for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); | 7674 | for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); |
8453 | iter != mAttachmentPoints.end(); ) | 7675 | iter != mAttachmentPoints.end(); ) |
8454 | { | 7676 | { |
8455 | attachment_map_t::iterator curiter = iter++; | 7677 | attachment_map_t::const_iterator curiter = iter++; |
8456 | LLViewerJointAttachment* attachment = curiter->second; | 7678 | LLViewerJointAttachment* attachment = curiter->second; |
8457 | if (attachment->getIsHUDAttachment() && attachment->getObject()) | 7679 | if (attachment->getIsHUDAttachment() && attachment->getObject()) |
8458 | { | 7680 | { |
@@ -8462,13 +7684,13 @@ BOOL LLVOAvatar::hasHUDAttachment() | |||
8462 | return FALSE; | 7684 | return FALSE; |
8463 | } | 7685 | } |
8464 | 7686 | ||
8465 | LLBBox LLVOAvatar::getHUDBBox() | 7687 | LLBBox LLVOAvatar::getHUDBBox() const |
8466 | { | 7688 | { |
8467 | LLBBox bbox; | 7689 | LLBBox bbox; |
8468 | for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); | 7690 | for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); |
8469 | iter != mAttachmentPoints.end(); ) | 7691 | iter != mAttachmentPoints.end(); ) |
8470 | { | 7692 | { |
8471 | attachment_map_t::iterator curiter = iter++; | 7693 | attachment_map_t::const_iterator curiter = iter++; |
8472 | LLViewerJointAttachment* attachment = curiter->second; | 7694 | LLViewerJointAttachment* attachment = curiter->second; |
8473 | if (attachment->getIsHUDAttachment() && attachment->getObject()) | 7695 | if (attachment->getIsHUDAttachment() && attachment->getObject()) |
8474 | { | 7696 | { |
@@ -8504,50 +7726,23 @@ void LLVOAvatar::onFirstTEMessageReceived() | |||
8504 | { | 7726 | { |
8505 | mFirstTEMessageReceived = TRUE; | 7727 | mFirstTEMessageReceived = TRUE; |
8506 | 7728 | ||
8507 | BOOL head_baked = ( getTEImage( TEX_HEAD_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | 7729 | for (U32 i = 0; i < mBakedTextureData.size(); i++) |
8508 | BOOL upper_baked = ( getTEImage( TEX_UPPER_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
8509 | BOOL lower_baked = ( getTEImage( TEX_LOWER_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
8510 | BOOL eyes_baked = ( getTEImage( TEX_EYES_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
8511 | BOOL skirt_baked = ( getTEImage( TEX_SKIRT_BAKED )->getID() != IMG_DEFAULT_AVATAR ); | ||
8512 | |||
8513 | // Use any baked textures that we have even if they haven't downloaded yet. | ||
8514 | // (That is, don't do a transition from unbaked to baked.) | ||
8515 | if( head_baked ) | ||
8516 | { | ||
8517 | mLastHeadBakedID = getTEImage( TEX_HEAD_BAKED )->getID(); | ||
8518 | LLViewerImage* image = getTEImage( TEX_HEAD_BAKED ); | ||
8519 | image->setLoadedCallback( onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID )); | ||
8520 | image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ) ); | ||
8521 | } | ||
8522 | |||
8523 | if( upper_baked ) | ||
8524 | { | 7730 | { |
8525 | mLastUpperBodyBakedID = getTEImage( TEX_UPPER_BAKED )->getID(); | 7731 | bool layer_baked = isTextureDefined(mBakedTextureData[i].mTextureIndex); |
8526 | LLViewerImage* image = getTEImage( TEX_UPPER_BAKED ); | ||
8527 | image->setLoadedCallback( onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID )); | ||
8528 | image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ) ); | ||
8529 | } | ||
8530 | |||
8531 | if( lower_baked ) | ||
8532 | { | ||
8533 | mLastLowerBodyBakedID = getTEImage( TEX_LOWER_BAKED )->getID(); | ||
8534 | LLViewerImage* image = getTEImage( TEX_LOWER_BAKED ); | ||
8535 | image->setLoadedCallback( onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID )); | ||
8536 | image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ) ); | ||
8537 | } | ||
8538 | |||
8539 | if( eyes_baked ) | ||
8540 | { | ||
8541 | mLastEyesBakedID = getTEImage( TEX_EYES_BAKED )->getID(); | ||
8542 | LLViewerImage* image = getTEImage( TEX_EYES_BAKED ); | ||
8543 | image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ) ); | ||
8544 | } | ||
8545 | 7732 | ||
8546 | if( skirt_baked ) | 7733 | // Use any baked textures that we have even if they haven't downloaded yet. |
8547 | { | 7734 | // (That is, don't do a transition from unbaked to baked.) |
8548 | mLastSkirtBakedID = getTEImage( TEX_SKIRT_BAKED )->getID(); | 7735 | if (layer_baked) |
8549 | LLViewerImage* image = getTEImage( TEX_SKIRT_BAKED ); | 7736 | { |
8550 | image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ) ); | 7737 | LLViewerImage* image = getTEImage( mBakedTextureData[i].mTextureIndex ); |
7738 | mBakedTextureData[i].mLastTextureIndex = image->getID(); | ||
7739 | // If we have more than one texture for the other baked layers, we'll want to call this for them too. | ||
7740 | if ( (i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER) ) | ||
7741 | { | ||
7742 | image->setLoadedCallback( onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID )); | ||
7743 | } | ||
7744 | image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ) ); | ||
7745 | } | ||
8551 | } | 7746 | } |
8552 | 7747 | ||
8553 | updateMeshTextures(); | 7748 | updateMeshTextures(); |
@@ -8594,11 +7789,13 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) | |||
8594 | unpackTEMessage(mesgsys, _PREHASH_ObjectData); | 7789 | unpackTEMessage(mesgsys, _PREHASH_ObjectData); |
8595 | // dumpAvatarTEs( "POST processAvatarAppearance()" ); | 7790 | // dumpAvatarTEs( "POST processAvatarAppearance()" ); |
8596 | 7791 | ||
8597 | // llinfos << "Received AvatarAppearance: " << (mIsSelf ? "(self): " : "(other): " ) << | 7792 | //llinfos << "Received AvatarAppearance: " << (mIsSelf ? "(self): " : "(other): ") << std::endl << |
8598 | // (( getTEImage( TEX_HEAD_BAKED )->getID() != IMG_DEFAULT_AVATAR ) ? "HEAD " : "head " ) << | 7793 | // (isTextureDefined(TEX_HEAD_BAKED) ? "HEAD " : "head " ) << (getTEImage(TEX_HEAD_BAKED)->getID()) << std::endl << |
8599 | // (( getTEImage( TEX_UPPER_BAKED )->getID() != IMG_DEFAULT_AVATAR ) ? "UPPER " : "upper " ) << | 7794 | // (isTextureDefined(TEX_UPPER_BAKED) ? "UPPER " : "upper " ) << (getTEImage(TEX_UPPER_BAKED)->getID()) << std::endl << |
8600 | // (( getTEImage( TEX_LOWER_BAKED )->getID() != IMG_DEFAULT_AVATAR ) ? "LOWER " : "lower " ) << | 7795 | // (isTextureDefined(TEX_LOWER_BAKED) ? "LOWER " : "lower " ) << (getTEImage(TEX_LOWER_BAKED)->getID()) << std::endl << |
8601 | // (( getTEImage( TEX_EYES_BAKED )->getID() != IMG_DEFAULT_AVATAR ) ? "EYES" : "eyes" ) << llendl; | 7796 | // (isTextureDefined(TEX_SKIRT_BAKED) ? "SKIRT " : "skirt " ) << (getTEImage(TEX_SKIRT_BAKED)->getID()) << std::endl << |
7797 | // (isTextureDefined(TEX_HAIR_BAKED) ? "HAIR" : "hair " ) << (getTEImage(TEX_HAIR_BAKED)->getID()) << std::endl << | ||
7798 | // (isTextureDefined(TEX_EYES_BAKED) ? "EYES" : "eyes" ) << (getTEImage(TEX_EYES_BAKED)->getID()) << llendl ; | ||
8602 | 7799 | ||
8603 | if( !mFirstTEMessageReceived ) | 7800 | if( !mFirstTEMessageReceived ) |
8604 | { | 7801 | { |
@@ -8606,6 +7803,12 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) | |||
8606 | } | 7803 | } |
8607 | 7804 | ||
8608 | setCompositeUpdatesEnabled( FALSE ); | 7805 | setCompositeUpdatesEnabled( FALSE ); |
7806 | |||
7807 | if (!mIsSelf) | ||
7808 | { | ||
7809 | releaseUnnecessaryTextures(); | ||
7810 | } | ||
7811 | |||
8609 | updateMeshTextures(); // enables updates for laysets without baked textures. | 7812 | updateMeshTextures(); // enables updates for laysets without baked textures. |
8610 | 7813 | ||
8611 | // parse visual params | 7814 | // parse visual params |
@@ -8653,7 +7856,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) | |||
8653 | param->setAnimationTarget(newWeight, FALSE); | 7856 | param->setAnimationTarget(newWeight, FALSE); |
8654 | } | 7857 | } |
8655 | } | 7858 | } |
8656 | |||
8657 | param = getNextVisualParam(); | 7859 | param = getNextVisualParam(); |
8658 | } | 7860 | } |
8659 | } | 7861 | } |
@@ -8727,28 +7929,20 @@ void LLVOAvatar::getAnimNames( LLDynamicArray<std::string>* names ) | |||
8727 | 7929 | ||
8728 | void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) | 7930 | void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) |
8729 | { | 7931 | { |
8730 | //llinfos << "onBakedTextureMasksLoaded: " << src_vi->getID() << llendl; | 7932 | if (!userdata) return; |
8731 | LLMemType mt(LLMemType::MTYPE_AVATAR); | ||
8732 | |||
8733 | LLUUID id = src_vi->getID(); | ||
8734 | 7933 | ||
8735 | if (!userdata) | 7934 | //llinfos << "onBakedTextureMasksLoaded: " << src_vi->getID() << llendl; |
8736 | { | 7935 | const LLMemType mt(LLMemType::MTYPE_AVATAR); |
8737 | return; | 7936 | const LLUUID id = src_vi->getID(); |
8738 | } | ||
8739 | 7937 | ||
8740 | LLTextureMaskData* maskData = (LLTextureMaskData*) userdata; | 7938 | LLTextureMaskData* maskData = (LLTextureMaskData*) userdata; |
8741 | LLVOAvatar* self = (LLVOAvatar*) gObjectList.findObject( maskData->mAvatarID ); | 7939 | LLVOAvatar* self = (LLVOAvatar*) gObjectList.findObject( maskData->mAvatarID ); |
8742 | 7940 | ||
8743 | // if discard level is 2 less than last discard level we processed, or we hit 0, | 7941 | // if discard level is 2 less than last discard level we processed, or we hit 0, |
8744 | // then generate morph masks | 7942 | // then generate morph masks |
8745 | if( self && success && (discard_level < maskData->mLastDiscardLevel - 2 || discard_level == 0) ) | 7943 | if(self && success && (discard_level < maskData->mLastDiscardLevel - 2 || discard_level == 0)) |
8746 | { | 7944 | { |
8747 | LLViewerImage* head_baked = self->getTEImage( TEX_HEAD_BAKED ); | 7945 | if(aux_src && aux_src->getComponents() == 1) |
8748 | LLViewerImage* upper_baked = self->getTEImage( TEX_UPPER_BAKED ); | ||
8749 | LLViewerImage* lower_baked = self->getTEImage( TEX_LOWER_BAKED ); | ||
8750 | |||
8751 | if( aux_src && aux_src->getComponents() == 1 ) | ||
8752 | { | 7946 | { |
8753 | if (!aux_src->getData()) | 7947 | if (!aux_src->getData()) |
8754 | { | 7948 | { |
@@ -8757,85 +7951,63 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerImage *src_vi, | |||
8757 | } | 7951 | } |
8758 | 7952 | ||
8759 | U32 gl_name; | 7953 | U32 gl_name; |
8760 | glGenTextures(1, (GLuint*) &gl_name ); | 7954 | LLImageGL::generateTextures(1, &gl_name ); |
8761 | stop_glerror(); | 7955 | stop_glerror(); |
8762 | 7956 | ||
8763 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, gl_name); | 7957 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, gl_name); |
8764 | stop_glerror(); | 7958 | stop_glerror(); |
8765 | 7959 | ||
8766 | glTexImage2D( | 7960 | LLImageGL::setManualImage( |
8767 | GL_TEXTURE_2D, 0, GL_ALPHA8, | 7961 | GL_TEXTURE_2D, 0, GL_ALPHA8, |
8768 | aux_src->getWidth(), aux_src->getHeight(), | 7962 | aux_src->getWidth(), aux_src->getHeight(), |
8769 | 0, GL_ALPHA, GL_UNSIGNED_BYTE, aux_src->getData()); | 7963 | GL_ALPHA, GL_UNSIGNED_BYTE, aux_src->getData()); |
8770 | stop_glerror(); | 7964 | stop_glerror(); |
8771 | 7965 | ||
8772 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 7966 | gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); |
8773 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | ||
8774 | 7967 | ||
8775 | if( id == head_baked->getID() ) | 7968 | /* if( id == head_baked->getID() ) |
8776 | { | 7969 | if (self->mBakedTextureData[BAKED_HEAD].mTexLayerSet) |
8777 | if (self->mHeadLayerSet) | 7970 | //llinfos << "onBakedTextureMasksLoaded for head " << id << " discard = " << discard_level << llendl; |
8778 | { | 7971 | self->mBakedTextureData[BAKED_HEAD].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); |
8779 | //llinfos << "onBakedTextureMasksLoaded for head " << id << " discard = " << discard_level << llendl; | 7972 | maskData->mLastDiscardLevel = discard_level; */ |
8780 | self->mHeadLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); | 7973 | bool found_texture_id = false; |
8781 | maskData->mLastDiscardLevel = discard_level; | 7974 | for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); |
8782 | self->mHeadMaskDiscard = discard_level; | 7975 | iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); |
8783 | if (self->mHeadMaskTexName) | 7976 | iter++) |
8784 | { | ||
8785 | glDeleteTextures(1, (GLuint*) &self->mHeadMaskTexName); | ||
8786 | } | ||
8787 | self->mHeadMaskTexName = gl_name; | ||
8788 | } | ||
8789 | else | ||
8790 | { | ||
8791 | llwarns << "onBakedTextureMasksLoaded: no mHeadLayerSet." << llendl; | ||
8792 | } | ||
8793 | } | ||
8794 | else | ||
8795 | if( id == upper_baked->getID() ) | ||
8796 | { | 7977 | { |
8797 | if ( self->mUpperBodyLayerSet) | 7978 | |
8798 | { | 7979 | const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; |
8799 | //llinfos << "onBakedTextureMasksLoaded for upper body " << id << " discard = " << discard_level << llendl; | 7980 | if (text_dict->mIsUsedByBakedTexture) |
8800 | self->mUpperBodyLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); | ||
8801 | maskData->mLastDiscardLevel = discard_level; | ||
8802 | self->mUpperMaskDiscard = discard_level; | ||
8803 | if (self->mUpperMaskTexName) | ||
8804 | { | ||
8805 | glDeleteTextures(1, (GLuint*) &self->mUpperMaskTexName); | ||
8806 | } | ||
8807 | self->mUpperMaskTexName = gl_name; | ||
8808 | } | ||
8809 | else | ||
8810 | { | ||
8811 | llwarns << "onBakedTextureMasksLoaded: no mHeadLayerSet." << llendl; | ||
8812 | } | ||
8813 | } | ||
8814 | else | ||
8815 | if( id == lower_baked->getID() ) | ||
8816 | { | ||
8817 | if ( self->mLowerBodyLayerSet ) | ||
8818 | { | 7981 | { |
8819 | //llinfos << "onBakedTextureMasksLoaded for lower body " << id << " discard = " << discard_level << llendl; | 7982 | const ETextureIndex texture_index = iter->first; |
8820 | self->mLowerBodyLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); | 7983 | const LLViewerImage *baked_img = self->getTEImage(texture_index); |
8821 | maskData->mLastDiscardLevel = discard_level; | 7984 | if (id == baked_img->getID()) |
8822 | self->mLowerMaskDiscard = discard_level; | ||
8823 | if (self->mLowerMaskTexName) | ||
8824 | { | 7985 | { |
8825 | glDeleteTextures(1, (GLuint*) &self->mLowerMaskTexName); | 7986 | const EBakedTextureIndex baked_index = text_dict->mBakedTextureIndex; |
7987 | if (self->mBakedTextureData[baked_index].mTexLayerSet) | ||
7988 | { | ||
7989 | //llinfos << "onBakedTextureMasksLoaded for " << text_dict->mName << " " << id << " discard = " << discard_level << llendl; | ||
7990 | self->mBakedTextureData[baked_index].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); | ||
7991 | maskData->mLastDiscardLevel = discard_level; | ||
7992 | if (self->mBakedTextureData[baked_index].mMaskTexName) | ||
7993 | { | ||
7994 | LLImageGL::deleteTextures(1, &(self->mBakedTextureData[baked_index].mMaskTexName)); | ||
7995 | } | ||
7996 | self->mBakedTextureData[baked_index].mMaskTexName = gl_name; | ||
7997 | } | ||
7998 | else | ||
7999 | { | ||
8000 | llwarns << "onBakedTextureMasksLoaded: no LayerSet for " << text_dict->mName << "." << llendl; | ||
8001 | } | ||
8002 | found_texture_id = true; | ||
8003 | break; | ||
8826 | } | 8004 | } |
8827 | self->mLowerMaskTexName = gl_name; | ||
8828 | } | ||
8829 | else | ||
8830 | { | ||
8831 | llwarns << "onBakedTextureMasksLoaded: no mHeadLayerSet." << llendl; | ||
8832 | } | 8005 | } |
8833 | } | 8006 | } |
8834 | else | 8007 | if (!found_texture_id) |
8835 | { | 8008 | { |
8836 | llinfos << "onBakedTextureMasksLoaded(): unexpected image id: " << id << llendl; | 8009 | llinfos << "onBakedTextureMasksLoaded(): unexpected image id: " << id << llendl; |
8837 | } | 8010 | } |
8838 | |||
8839 | self->dirtyMesh(); | 8011 | self->dirtyMesh(); |
8840 | } | 8012 | } |
8841 | else | 8013 | else |
@@ -8850,7 +8022,6 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerImage *src_vi, | |||
8850 | { | 8022 | { |
8851 | delete maskData; | 8023 | delete maskData; |
8852 | } | 8024 | } |
8853 | |||
8854 | } | 8025 | } |
8855 | 8026 | ||
8856 | // static | 8027 | // static |
@@ -8897,109 +8068,34 @@ void LLVOAvatar::onBakedTextureLoaded(BOOL success, LLViewerImage *src_vi, LLIma | |||
8897 | // Called when baked texture is loaded and also when we start up with a baked texture | 8068 | // Called when baked texture is loaded and also when we start up with a baked texture |
8898 | void LLVOAvatar::useBakedTexture( const LLUUID& id ) | 8069 | void LLVOAvatar::useBakedTexture( const LLUUID& id ) |
8899 | { | 8070 | { |
8900 | // llinfos << "useBakedTexture" << llendl; | 8071 | /* if(id == head_baked->getID()) |
8901 | LLViewerImage* head_baked = getTEImage( TEX_HEAD_BAKED ); | 8072 | mHeadBakedLoaded = TRUE; |
8902 | LLViewerImage* upper_baked = getTEImage( TEX_UPPER_BAKED ); | 8073 | mLastHeadBakedID = id; |
8903 | LLViewerImage* lower_baked = getTEImage( TEX_LOWER_BAKED ); | 8074 | mHeadMesh0.setTexture( head_baked ); |
8904 | LLViewerImage* eyes_baked = getTEImage( TEX_EYES_BAKED ); | 8075 | mHeadMesh1.setTexture( head_baked ); */ |
8905 | LLViewerImage* skirt_baked = getTEImage( TEX_SKIRT_BAKED ); | 8076 | for (U32 i = 0; i < mBakedTextureData.size(); i++) |
8906 | |||
8907 | if( id == head_baked->getID() ) | ||
8908 | { | ||
8909 | mHeadBakedLoaded = TRUE; | ||
8910 | |||
8911 | mLastHeadBakedID = id; | ||
8912 | mHeadMesh0.setTexture( head_baked ); | ||
8913 | mHeadMesh1.setTexture( head_baked ); | ||
8914 | mHeadMesh2.setTexture( head_baked ); | ||
8915 | mHeadMesh3.setTexture( head_baked ); | ||
8916 | mHeadMesh4.setTexture( head_baked ); | ||
8917 | mEyeLashMesh0.setTexture( head_baked ); | ||
8918 | if( mHeadLayerSet ) | ||
8919 | { | ||
8920 | mHeadLayerSet->destroyComposite(); | ||
8921 | } | ||
8922 | setLocalTexture( LOCTEX_HEAD_BODYPAINT, getTEImage( TEX_HEAD_BODYPAINT ), TRUE ); | ||
8923 | } | ||
8924 | else | ||
8925 | if( id == upper_baked->getID() ) | ||
8926 | { | 8077 | { |
8927 | mUpperBakedLoaded = TRUE; | 8078 | LLViewerImage* image_baked = getTEImage( mBakedTextureData[i].mTextureIndex ); |
8928 | 8079 | if (id == image_baked->getID()) | |
8929 | mLastUpperBodyBakedID = id; | ||
8930 | mUpperBodyMesh0.setTexture( upper_baked ); | ||
8931 | mUpperBodyMesh1.setTexture( upper_baked ); | ||
8932 | mUpperBodyMesh2.setTexture( upper_baked ); | ||
8933 | mUpperBodyMesh3.setTexture( upper_baked ); | ||
8934 | mUpperBodyMesh4.setTexture( upper_baked ); | ||
8935 | if( mUpperBodyLayerSet ) | ||
8936 | { | 8080 | { |
8937 | mUpperBodyLayerSet->destroyComposite(); | 8081 | mBakedTextureData[i].mIsLoaded = true; |
8938 | } | 8082 | mBakedTextureData[i].mLastTextureIndex = id; |
8939 | 8083 | for (U32 k = 0; k < mBakedTextureData[i].mMeshes.size(); k++) | |
8940 | setLocalTexture( LOCTEX_UPPER_SHIRT, getTEImage( TEX_UPPER_SHIRT ), TRUE ); | 8084 | { |
8941 | setLocalTexture( LOCTEX_UPPER_BODYPAINT, getTEImage( TEX_UPPER_BODYPAINT ), TRUE ); | 8085 | mBakedTextureData[i].mMeshes[k]->setTexture( image_baked ); |
8942 | setLocalTexture( LOCTEX_UPPER_JACKET, getTEImage( TEX_UPPER_JACKET ), TRUE ); | 8086 | } |
8943 | setLocalTexture( LOCTEX_UPPER_GLOVES, getTEImage( TEX_UPPER_GLOVES ), TRUE ); | 8087 | if (mBakedTextureData[i].mTexLayerSet) |
8944 | setLocalTexture( LOCTEX_UPPER_UNDERSHIRT, getTEImage( TEX_UPPER_UNDERSHIRT ), TRUE ); | 8088 | { |
8945 | } | 8089 | mBakedTextureData[i].mTexLayerSet->destroyComposite(); |
8946 | else | 8090 | } |
8947 | if( id == lower_baked->getID() ) | 8091 | const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); |
8948 | { | 8092 | for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); |
8949 | mLowerBakedLoaded = TRUE; | 8093 | local_tex_iter != baked_dict->mLocalTextures.end(); |
8950 | 8094 | local_tex_iter++) | |
8951 | mLastLowerBodyBakedID = id; | 8095 | { |
8952 | mLowerBodyMesh0.setTexture( lower_baked ); | 8096 | setLocalTexture(*local_tex_iter, getTEImage(*local_tex_iter), TRUE); |
8953 | mLowerBodyMesh1.setTexture( lower_baked ); | 8097 | } |
8954 | mLowerBodyMesh2.setTexture( lower_baked ); | ||
8955 | mLowerBodyMesh3.setTexture( lower_baked ); | ||
8956 | mLowerBodyMesh4.setTexture( lower_baked ); | ||
8957 | if( mLowerBodyLayerSet ) | ||
8958 | { | ||
8959 | mLowerBodyLayerSet->destroyComposite(); | ||
8960 | } | ||
8961 | |||
8962 | setLocalTexture( LOCTEX_LOWER_PANTS, getTEImage( TEX_LOWER_PANTS ), TRUE ); | ||
8963 | setLocalTexture( LOCTEX_LOWER_BODYPAINT, getTEImage( TEX_LOWER_BODYPAINT ), TRUE ); | ||
8964 | setLocalTexture( LOCTEX_LOWER_SHOES, getTEImage( TEX_LOWER_SHOES ), TRUE ); | ||
8965 | setLocalTexture( LOCTEX_LOWER_SOCKS, getTEImage( TEX_LOWER_SOCKS ), TRUE ); | ||
8966 | setLocalTexture( LOCTEX_LOWER_JACKET, getTEImage( TEX_LOWER_JACKET ), TRUE ); | ||
8967 | setLocalTexture( LOCTEX_LOWER_UNDERPANTS, getTEImage( TEX_LOWER_UNDERPANTS ), TRUE ); | ||
8968 | } | ||
8969 | else | ||
8970 | if( id == eyes_baked->getID() ) | ||
8971 | { | ||
8972 | mEyesBakedLoaded = TRUE; | ||
8973 | |||
8974 | mLastEyesBakedID = id; | ||
8975 | mEyeBallLeftMesh0.setTexture( eyes_baked ); | ||
8976 | mEyeBallLeftMesh1.setTexture( eyes_baked ); | ||
8977 | mEyeBallRightMesh0.setTexture( eyes_baked ); | ||
8978 | mEyeBallRightMesh1.setTexture( eyes_baked ); | ||
8979 | if( mEyesLayerSet ) | ||
8980 | { | ||
8981 | mEyesLayerSet->destroyComposite(); | ||
8982 | } | ||
8983 | |||
8984 | setLocalTexture( LOCTEX_EYES_IRIS, getTEImage( TEX_EYES_IRIS ), TRUE ); | ||
8985 | } | ||
8986 | else | ||
8987 | if( id == skirt_baked->getID() ) | ||
8988 | { | ||
8989 | mSkirtBakedLoaded = TRUE; | ||
8990 | |||
8991 | mLastSkirtBakedID = id; | ||
8992 | mSkirtMesh0.setTexture( skirt_baked ); | ||
8993 | mSkirtMesh1.setTexture( skirt_baked ); | ||
8994 | mSkirtMesh2.setTexture( skirt_baked ); | ||
8995 | mSkirtMesh3.setTexture( skirt_baked ); | ||
8996 | mSkirtMesh4.setTexture( skirt_baked ); | ||
8997 | if( mSkirtLayerSet ) | ||
8998 | { | ||
8999 | mSkirtLayerSet->destroyComposite(); | ||
9000 | } | 8098 | } |
9001 | |||
9002 | setLocalTexture( LOCTEX_SKIRT, getTEImage( TEX_SKIRT ), TRUE ); | ||
9003 | } | 8099 | } |
9004 | 8100 | ||
9005 | dirtyMesh(); | 8101 | dirtyMesh(); |
@@ -9009,7 +8105,9 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) | |||
9009 | void LLVOAvatar::dumpArchetypeXML( void* ) | 8105 | void LLVOAvatar::dumpArchetypeXML( void* ) |
9010 | { | 8106 | { |
9011 | LLVOAvatar* avatar = gAgent.getAvatarObject(); | 8107 | LLVOAvatar* avatar = gAgent.getAvatarObject(); |
9012 | apr_file_t* file = ll_apr_file_open(gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"new archetype.xml"), LL_APR_WB ); | 8108 | LLAPRFile outfile ; |
8109 | outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"new archetype.xml"), LL_APR_WB ); | ||
8110 | apr_file_t* file = outfile.getFileHandle() ; | ||
9013 | if( !file ) | 8111 | if( !file ) |
9014 | { | 8112 | { |
9015 | return; | 8113 | return; |
@@ -9036,11 +8134,11 @@ void LLVOAvatar::dumpArchetypeXML( void* ) | |||
9036 | } | 8134 | } |
9037 | } | 8135 | } |
9038 | 8136 | ||
9039 | for( S32 te = 0; te < TEX_NUM_ENTRIES; te++ ) | 8137 | for(U8 te = 0; te < TEX_NUM_INDICES; te++) |
9040 | { | 8138 | { |
9041 | if( LLVOAvatar::getTEWearableType( te ) == type ) | 8139 | if( LLVOAvatar::getTEWearableType((ETextureIndex)te) == type ) |
9042 | { | 8140 | { |
9043 | LLViewerImage* te_image = avatar->getTEImage( te ); | 8141 | LLViewerImage* te_image = avatar->getTEImage((ETextureIndex)te); |
9044 | if( te_image ) | 8142 | if( te_image ) |
9045 | { | 8143 | { |
9046 | std::string uuid_str; | 8144 | std::string uuid_str; |
@@ -9052,7 +8150,6 @@ void LLVOAvatar::dumpArchetypeXML( void* ) | |||
9052 | } | 8150 | } |
9053 | apr_file_printf( file, "\t</archetype>\n" ); | 8151 | apr_file_printf( file, "\t</archetype>\n" ); |
9054 | apr_file_printf( file, "\n</linden_genepool>\n" ); | 8152 | apr_file_printf( file, "\n</linden_genepool>\n" ); |
9055 | apr_file_close( file ); | ||
9056 | } | 8153 | } |
9057 | 8154 | ||
9058 | 8155 | ||
@@ -9068,33 +8165,7 @@ void LLVOAvatar::setVisibilityRank(U32 rank) | |||
9068 | return; | 8165 | return; |
9069 | } | 8166 | } |
9070 | 8167 | ||
9071 | BOOL stale = gFrameTimeSeconds - mLastFadeTime > 10.f; | 8168 | mVisibilityRank = rank; |
9072 | |||
9073 | //only raise visibility rank or trigger a fade out every 10 seconds | ||
9074 | if (mVisibilityRank >= (U32) LLVOAvatar::sMaxVisible && rank < (U32) LLVOAvatar::sMaxVisible || | ||
9075 | (stale && mVisibilityRank < (U32) LLVOAvatar::sMaxVisible && rank >= (U32) LLVOAvatar::sMaxVisible)) | ||
9076 | { //remember the time we became visible/invisible based on visibility rank | ||
9077 | mVisibilityRank = rank; | ||
9078 | mLastFadeTime = gFrameTimeSeconds; | ||
9079 | mLastFadeDistance = mDrawable->mDistanceWRTCamera; | ||
9080 | |||
9081 | F32 blend = gFrameTimeSeconds - mFadeTime; | ||
9082 | mFadeTime = gFrameTimeSeconds; | ||
9083 | if (blend < 1.f) | ||
9084 | { //move the blend time back if a blend is already in progress (prevent flashes) | ||
9085 | mFadeTime -= 1.f-blend; | ||
9086 | } | ||
9087 | } | ||
9088 | else if (stale) | ||
9089 | { | ||
9090 | mLastFadeTime = gFrameTimeSeconds; | ||
9091 | mLastFadeDistance = mDrawable->mDistanceWRTCamera; | ||
9092 | mVisibilityRank = rank; | ||
9093 | } | ||
9094 | else | ||
9095 | { | ||
9096 | mVisibilityRank = llmin(mVisibilityRank, rank); | ||
9097 | } | ||
9098 | } | 8169 | } |
9099 | 8170 | ||
9100 | // Assumes LLVOAvatar::sInstances has already been sorted. | 8171 | // Assumes LLVOAvatar::sInstances has already been sorted. |
@@ -9120,39 +8191,39 @@ S32 LLVOAvatar::getUnbakedPixelAreaRank() | |||
9120 | return 0; | 8191 | return 0; |
9121 | } | 8192 | } |
9122 | 8193 | ||
8194 | struct CompareScreenAreaGreater | ||
8195 | { | ||
8196 | bool operator()(const LLCharacter* const& lhs, const LLCharacter* const& rhs) | ||
8197 | { | ||
8198 | return lhs->getPixelArea() > rhs->getPixelArea(); | ||
8199 | } | ||
8200 | }; | ||
8201 | |||
9123 | // static | 8202 | // static |
9124 | void LLVOAvatar::cullAvatarsByPixelArea() | 8203 | void LLVOAvatar::cullAvatarsByPixelArea() |
9125 | { | 8204 | { |
9126 | std::sort(LLCharacter::sInstances.begin(), LLCharacter::sInstances.end(), CompareScreenAreaGreater()); | 8205 | std::sort(LLCharacter::sInstances.begin(), LLCharacter::sInstances.end(), CompareScreenAreaGreater()); |
9127 | 8206 | ||
9128 | // Update the avatars that have changed status | 8207 | // Update the avatars that have changed status |
9129 | S32 comp_rank = 1; | ||
9130 | U32 rank = 0; | 8208 | U32 rank = 0; |
9131 | for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); | 8209 | for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); |
9132 | iter != LLCharacter::sInstances.end(); ++iter) | 8210 | iter != LLCharacter::sInstances.end(); ++iter) |
9133 | { | 8211 | { |
9134 | LLVOAvatar* inst = (LLVOAvatar*) *iter; | 8212 | LLVOAvatar* inst = (LLVOAvatar*) *iter; |
9135 | BOOL culled; | 8213 | BOOL culled; |
9136 | if( inst->isDead() ) | 8214 | if (inst->isSelf() || inst->isFullyBaked()) |
9137 | { | ||
9138 | culled = TRUE; | ||
9139 | } | ||
9140 | else if( inst->isSelf() || inst->isFullyBaked() ) | ||
9141 | { | 8215 | { |
9142 | culled = FALSE; | 8216 | culled = FALSE; |
9143 | } | 8217 | } |
9144 | else | 8218 | else |
9145 | { | 8219 | { |
9146 | culled = (comp_rank > LLVOAvatar::sMaxOtherAvatarsToComposite) || (inst->mPixelArea < MIN_PIXEL_AREA_FOR_COMPOSITE); | 8220 | culled = TRUE; |
9147 | comp_rank++; | ||
9148 | } | 8221 | } |
9149 | 8222 | ||
9150 | if( inst->mCulled != culled ) | 8223 | if (inst->mCulled != culled) |
9151 | { | 8224 | { |
9152 | inst->mCulled = culled; | 8225 | inst->mCulled = culled; |
9153 | |||
9154 | lldebugs << "avatar " << inst->getID() << (culled ? " start culled" : " start not culled" ) << llendl; | 8226 | lldebugs << "avatar " << inst->getID() << (culled ? " start culled" : " start not culled" ) << llendl; |
9155 | |||
9156 | inst->updateMeshTextures(); | 8227 | inst->updateMeshTextures(); |
9157 | } | 8228 | } |
9158 | 8229 | ||
@@ -9167,9 +8238,9 @@ void LLVOAvatar::cullAvatarsByPixelArea() | |||
9167 | } | 8238 | } |
9168 | 8239 | ||
9169 | S32 grey_avatars = 0; | 8240 | S32 grey_avatars = 0; |
9170 | if( LLVOAvatar::areAllNearbyInstancesBaked(grey_avatars) ) | 8241 | if ( LLVOAvatar::areAllNearbyInstancesBaked(grey_avatars) ) |
9171 | { | 8242 | { |
9172 | LLVOAvatar::deleteCachedImages(); | 8243 | LLVOAvatar::deleteCachedImages(false); |
9173 | } | 8244 | } |
9174 | else | 8245 | else |
9175 | { | 8246 | { |
@@ -9201,52 +8272,31 @@ const LLUUID& LLVOAvatar::grabLocalTexture(ETextureIndex index) | |||
9201 | BOOL LLVOAvatar::canGrabLocalTexture(ETextureIndex index) | 8272 | BOOL LLVOAvatar::canGrabLocalTexture(ETextureIndex index) |
9202 | { | 8273 | { |
9203 | // Check if the texture hasn't been baked yet. | 8274 | // Check if the texture hasn't been baked yet. |
9204 | if ( getTEImage( index )->getID() == IMG_DEFAULT_AVATAR ) | 8275 | if (!isTextureDefined(index)) |
9205 | { | 8276 | { |
9206 | lldebugs << "getTEImage( " << (U32) index << " )->getID() == IMG_DEFAULT_AVATAR" << llendl; | 8277 | lldebugs << "getTEImage( " << (U32) index << " )->getID() == IMG_DEFAULT_AVATAR" << llendl; |
9207 | return FALSE; | 8278 | return FALSE; |
9208 | } | 8279 | } |
9209 | 8280 | ||
8281 | if (gAgent.isGodlike()) | ||
8282 | return TRUE; | ||
8283 | |||
9210 | // Check permissions of textures that show up in the | 8284 | // Check permissions of textures that show up in the |
9211 | // baked texture. We don't want people copying people's | 8285 | // baked texture. We don't want people copying people's |
9212 | // work via baked textures. | 8286 | // work via baked textures. |
9213 | std::vector<ETextureIndex> textures; | 8287 | /* switch(index) |
9214 | switch (index) | 8288 | case TEX_EYES_BAKED: |
9215 | { | 8289 | textures.push_back(TEX_EYES_IRIS); */ |
9216 | case TEX_EYES_BAKED: | 8290 | const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); |
9217 | textures.push_back(TEX_EYES_IRIS); | 8291 | if (!text_dict->mIsUsedByBakedTexture) return FALSE; |
9218 | break; | 8292 | |
9219 | case TEX_HEAD_BAKED: | 8293 | const EBakedTextureIndex baked_index = text_dict->mBakedTextureIndex; |
9220 | textures.push_back(TEX_HEAD_BODYPAINT); | 8294 | const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index); |
9221 | break; | 8295 | for (texture_vec_t::const_iterator iter = baked_dict->mLocalTextures.begin(); |
9222 | case TEX_UPPER_BAKED: | 8296 | iter != baked_dict->mLocalTextures.end(); |
9223 | textures.push_back(TEX_UPPER_BODYPAINT); | 8297 | iter++) |
9224 | textures.push_back(TEX_UPPER_UNDERSHIRT); | 8298 | { |
9225 | textures.push_back(TEX_UPPER_SHIRT); | 8299 | const ETextureIndex t_index = (*iter); |
9226 | textures.push_back(TEX_UPPER_JACKET); | ||
9227 | textures.push_back(TEX_UPPER_GLOVES); | ||
9228 | break; | ||
9229 | case TEX_LOWER_BAKED: | ||
9230 | textures.push_back(TEX_LOWER_BODYPAINT); | ||
9231 | textures.push_back(TEX_LOWER_UNDERPANTS); | ||
9232 | textures.push_back(TEX_LOWER_PANTS); | ||
9233 | textures.push_back(TEX_LOWER_JACKET); | ||
9234 | textures.push_back(TEX_LOWER_SOCKS); | ||
9235 | textures.push_back(TEX_LOWER_SHOES); | ||
9236 | break; | ||
9237 | case TEX_SKIRT_BAKED: | ||
9238 | textures.push_back(TEX_SKIRT); | ||
9239 | break; | ||
9240 | default: | ||
9241 | return FALSE; | ||
9242 | break; | ||
9243 | } | ||
9244 | |||
9245 | std::vector<ETextureIndex>::iterator iter = textures.begin(); | ||
9246 | std::vector<ETextureIndex>::iterator end = textures.end(); | ||
9247 | for (; iter != end; ++iter) | ||
9248 | { | ||
9249 | ETextureIndex t_index = (*iter); | ||
9250 | lldebugs << "Checking index " << (U32) t_index << llendl; | 8300 | lldebugs << "Checking index " << (U32) t_index << llendl; |
9251 | const LLUUID& texture_id = getTEImage( t_index )->getID(); | 8301 | const LLUUID& texture_id = getTEImage( t_index )->getID(); |
9252 | if (texture_id != IMG_DEFAULT_AVATAR) | 8302 | if (texture_id != IMG_DEFAULT_AVATAR) |
@@ -9293,62 +8343,43 @@ void LLVOAvatar::dumpLocalTextures() | |||
9293 | { | 8343 | { |
9294 | llinfos << "Local Textures:" << llendl; | 8344 | llinfos << "Local Textures:" << llendl; |
9295 | 8345 | ||
9296 | const char* names[] = { | 8346 | /* ETextureIndex baked_equiv[] = { |
9297 | "Shirt ", | ||
9298 | "UpperTatoo", | ||
9299 | "Pants ", | ||
9300 | "LowerTatoo", | ||
9301 | "Head Tatoo", | ||
9302 | "Shoes ", | ||
9303 | "Socks ", | ||
9304 | "Upper Jckt", | ||
9305 | "Lower Jckt", | ||
9306 | "Gloves ", | ||
9307 | "Undershirt", | ||
9308 | "Underpants", | ||
9309 | "Iris ", | ||
9310 | "Skirt "}; | ||
9311 | |||
9312 | ETextureIndex baked_equiv[] = { | ||
9313 | TEX_UPPER_BAKED, | 8347 | TEX_UPPER_BAKED, |
9314 | TEX_UPPER_BAKED, | 8348 | if (isTextureDefined(baked_equiv[i])) */ |
9315 | TEX_LOWER_BAKED, | 8349 | for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); |
9316 | TEX_LOWER_BAKED, | 8350 | iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); |
9317 | TEX_HEAD_BAKED, | 8351 | iter++) |
9318 | TEX_LOWER_BAKED, | 8352 | { |
9319 | TEX_LOWER_BAKED, | 8353 | const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; |
9320 | TEX_UPPER_BAKED, | 8354 | if (!text_dict->mIsLocalTexture || !text_dict->mIsUsedByBakedTexture) |
9321 | TEX_LOWER_BAKED, | 8355 | continue; |
9322 | TEX_UPPER_BAKED, | ||
9323 | TEX_UPPER_BAKED, | ||
9324 | TEX_LOWER_BAKED, | ||
9325 | TEX_EYES_BAKED, | ||
9326 | TEX_SKIRT_BAKED }; | ||
9327 | 8356 | ||
8357 | const EBakedTextureIndex baked_index = text_dict->mBakedTextureIndex; | ||
8358 | const ETextureIndex baked_equiv = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex; | ||
9328 | 8359 | ||
9329 | for( S32 i = 0; i < LOCTEX_NUM_ENTRIES; i++ ) | 8360 | const std::string &name = text_dict->mName; |
9330 | { | 8361 | const LocalTextureData &local_tex_data = mLocalTextureData[iter->first]; |
9331 | if( getTEImage( baked_equiv[i] )->getID() != IMG_DEFAULT_AVATAR ) | 8362 | if (isTextureDefined(baked_equiv)) |
9332 | { | 8363 | { |
9333 | #if LL_RELEASE_FOR_DOWNLOAD | 8364 | #if LL_RELEASE_FOR_DOWNLOAD |
9334 | // End users don't get to trivially see avatar texture IDs, makes textures | 8365 | // End users don't get to trivially see avatar texture IDs, makes textures |
9335 | // easier to steal. JC | 8366 | // easier to steal. JC |
9336 | llinfos << "LocTex " << names[i] << ": Baked " << llendl; | 8367 | llinfos << "LocTex " << name << ": Baked " << llendl; |
9337 | #else | 8368 | #else |
9338 | llinfos << "LocTex " << names[i] << ": Baked " << getTEImage( baked_equiv[i] )->getID() << llendl; | 8369 | llinfos << "LocTex " << name << ": Baked " << getTEImage( baked_equiv )->getID() << llendl; |
9339 | #endif | 8370 | #endif |
9340 | } | 8371 | } |
9341 | else if (mLocalTexture[i].notNull()) | 8372 | else if (local_tex_data.mImage.notNull()) |
9342 | { | 8373 | { |
9343 | if( mLocalTexture[i]->getID() == IMG_DEFAULT_AVATAR ) | 8374 | if( local_tex_data.mImage->getID() == IMG_DEFAULT_AVATAR ) |
9344 | { | 8375 | { |
9345 | llinfos << "LocTex " << names[i] << ": None" << llendl; | 8376 | llinfos << "LocTex " << name << ": None" << llendl; |
9346 | } | 8377 | } |
9347 | else | 8378 | else |
9348 | { | 8379 | { |
9349 | LLViewerImage* image = mLocalTexture[i]; | 8380 | const LLViewerImage* image = local_tex_data.mImage; |
9350 | 8381 | ||
9351 | llinfos << "LocTex " << names[i] << ": " | 8382 | llinfos << "LocTex " << name << ": " |
9352 | << "Discard " << image->getDiscardLevel() << ", " | 8383 | << "Discard " << image->getDiscardLevel() << ", " |
9353 | << "(" << image->getWidth() << ", " << image->getHeight() << ") " | 8384 | << "(" << image->getWidth() << ", " << image->getHeight() << ") " |
9354 | #if !LL_RELEASE_FOR_DOWNLOAD | 8385 | #if !LL_RELEASE_FOR_DOWNLOAD |
@@ -9362,7 +8393,7 @@ void LLVOAvatar::dumpLocalTextures() | |||
9362 | } | 8393 | } |
9363 | else | 8394 | else |
9364 | { | 8395 | { |
9365 | llinfos << "LocTex " << names[i] << ": No LLViewerImage" << llendl; | 8396 | llinfos << "LocTex " << name << ": No LLViewerImage" << llendl; |
9366 | } | 8397 | } |
9367 | } | 8398 | } |
9368 | } | 8399 | } |
@@ -9381,30 +8412,25 @@ void LLVOAvatar::startAppearanceAnimation(BOOL set_by_user, BOOL play_sound) | |||
9381 | 8412 | ||
9382 | void LLVOAvatar::removeMissingBakedTextures() | 8413 | void LLVOAvatar::removeMissingBakedTextures() |
9383 | { | 8414 | { |
9384 | if (!mIsSelf) | 8415 | if (!mIsSelf) return; |
9385 | { | ||
9386 | return; | ||
9387 | } | ||
9388 | BOOL removed = FALSE; | ||
9389 | 8416 | ||
9390 | for( S32 i = 0; i < BAKED_TEXTURE_COUNT; i++ ) | 8417 | BOOL removed = FALSE; |
8418 | for (U32 i = 0; i < mBakedTextureData.size(); i++) | ||
9391 | { | 8419 | { |
9392 | S32 te = sBakedTextureIndices[i]; | 8420 | const S32 te = mBakedTextureData[i].mTextureIndex; |
9393 | 8421 | if (getTEImage(te)->isMissingAsset()) | |
9394 | if( getTEImage( te )->isMissingAsset() ) | ||
9395 | { | 8422 | { |
9396 | setTEImage( te, gImageList.getImage(IMG_DEFAULT_AVATAR) ); | 8423 | setTEImage(te, gImageList.getImage(IMG_DEFAULT_AVATAR)); |
9397 | removed = TRUE; | 8424 | removed = TRUE; |
9398 | } | 8425 | } |
9399 | } | 8426 | } |
9400 | 8427 | ||
9401 | if( removed ) | 8428 | if (removed) |
9402 | { | 8429 | { |
9403 | invalidateComposite( mEyesLayerSet, FALSE ); | 8430 | for(U32 i = 0; i < mBakedTextureData.size(); i++) |
9404 | invalidateComposite( mHeadLayerSet, FALSE ); | 8431 | { |
9405 | invalidateComposite( mUpperBodyLayerSet, FALSE ); | 8432 | invalidateComposite(mBakedTextureData[i].mTexLayerSet, FALSE); |
9406 | invalidateComposite( mLowerBodyLayerSet, FALSE ); | 8433 | } |
9407 | invalidateComposite( mSkirtLayerSet, FALSE ); | ||
9408 | updateMeshTextures(); | 8434 | updateMeshTextures(); |
9409 | requestLayerSetUploads(); | 8435 | requestLayerSetUploads(); |
9410 | } | 8436 | } |
@@ -9412,15 +8438,15 @@ void LLVOAvatar::removeMissingBakedTextures() | |||
9412 | 8438 | ||
9413 | 8439 | ||
9414 | //----------------------------------------------------------------------------- | 8440 | //----------------------------------------------------------------------------- |
9415 | // LLVOAvatarInfo | 8441 | // LLVOAvatarXmlInfo |
9416 | //----------------------------------------------------------------------------- | 8442 | //----------------------------------------------------------------------------- |
9417 | 8443 | ||
9418 | LLVOAvatarInfo::LLVOAvatarInfo() | 8444 | LLVOAvatarXmlInfo::LLVOAvatarXmlInfo() |
9419 | : mTexSkinColorInfo(0), mTexHairColorInfo(0), mTexEyeColorInfo(0) | 8445 | : mTexSkinColorInfo(0), mTexHairColorInfo(0), mTexEyeColorInfo(0) |
9420 | { | 8446 | { |
9421 | } | 8447 | } |
9422 | 8448 | ||
9423 | LLVOAvatarInfo::~LLVOAvatarInfo() | 8449 | LLVOAvatarXmlInfo::~LLVOAvatarXmlInfo() |
9424 | { | 8450 | { |
9425 | std::for_each(mMeshInfoList.begin(), mMeshInfoList.end(), DeletePointer()); | 8451 | std::for_each(mMeshInfoList.begin(), mMeshInfoList.end(), DeletePointer()); |
9426 | std::for_each(mSkeletalDistortionInfoList.begin(), mSkeletalDistortionInfoList.end(), DeletePointer()); | 8452 | std::for_each(mSkeletalDistortionInfoList.begin(), mSkeletalDistortionInfoList.end(), DeletePointer()); |
@@ -9541,7 +8567,7 @@ BOOL LLVOAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node) | |||
9541 | //----------------------------------------------------------------------------- | 8567 | //----------------------------------------------------------------------------- |
9542 | // parseXmlSkeletonNode(): parses <skeleton> nodes from XML tree | 8568 | // parseXmlSkeletonNode(): parses <skeleton> nodes from XML tree |
9543 | //----------------------------------------------------------------------------- | 8569 | //----------------------------------------------------------------------------- |
9544 | BOOL LLVOAvatarInfo::parseXmlSkeletonNode(LLXmlTreeNode* root) | 8570 | BOOL LLVOAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* root) |
9545 | { | 8571 | { |
9546 | LLXmlTreeNode* node = root->getChildByName( "skeleton" ); | 8572 | LLXmlTreeNode* node = root->getChildByName( "skeleton" ); |
9547 | if( !node ) | 8573 | if( !node ) |
@@ -9647,7 +8673,7 @@ BOOL LLVOAvatarInfo::parseXmlSkeletonNode(LLXmlTreeNode* root) | |||
9647 | //----------------------------------------------------------------------------- | 8673 | //----------------------------------------------------------------------------- |
9648 | // parseXmlMeshNodes(): parses <mesh> nodes from XML tree | 8674 | // parseXmlMeshNodes(): parses <mesh> nodes from XML tree |
9649 | //----------------------------------------------------------------------------- | 8675 | //----------------------------------------------------------------------------- |
9650 | BOOL LLVOAvatarInfo::parseXmlMeshNodes(LLXmlTreeNode* root) | 8676 | BOOL LLVOAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) |
9651 | { | 8677 | { |
9652 | for (LLXmlTreeNode* node = root->getChildByName( "mesh" ); | 8678 | for (LLXmlTreeNode* node = root->getChildByName( "mesh" ); |
9653 | node; | 8679 | node; |
@@ -9737,7 +8763,7 @@ BOOL LLVOAvatarInfo::parseXmlMeshNodes(LLXmlTreeNode* root) | |||
9737 | //----------------------------------------------------------------------------- | 8763 | //----------------------------------------------------------------------------- |
9738 | // parseXmlColorNodes(): parses <global_color> nodes from XML tree | 8764 | // parseXmlColorNodes(): parses <global_color> nodes from XML tree |
9739 | //----------------------------------------------------------------------------- | 8765 | //----------------------------------------------------------------------------- |
9740 | BOOL LLVOAvatarInfo::parseXmlColorNodes(LLXmlTreeNode* root) | 8766 | BOOL LLVOAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root) |
9741 | { | 8767 | { |
9742 | for (LLXmlTreeNode* color_node = root->getChildByName( "global_color" ); | 8768 | for (LLXmlTreeNode* color_node = root->getChildByName( "global_color" ); |
9743 | color_node; | 8769 | color_node; |
@@ -9799,7 +8825,7 @@ BOOL LLVOAvatarInfo::parseXmlColorNodes(LLXmlTreeNode* root) | |||
9799 | //----------------------------------------------------------------------------- | 8825 | //----------------------------------------------------------------------------- |
9800 | // parseXmlLayerNodes(): parses <layer_set> nodes from XML tree | 8826 | // parseXmlLayerNodes(): parses <layer_set> nodes from XML tree |
9801 | //----------------------------------------------------------------------------- | 8827 | //----------------------------------------------------------------------------- |
9802 | BOOL LLVOAvatarInfo::parseXmlLayerNodes(LLXmlTreeNode* root) | 8828 | BOOL LLVOAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root) |
9803 | { | 8829 | { |
9804 | for (LLXmlTreeNode* layer_node = root->getChildByName( "layer_set" ); | 8830 | for (LLXmlTreeNode* layer_node = root->getChildByName( "layer_set" ); |
9805 | layer_node; | 8831 | layer_node; |
@@ -9823,7 +8849,7 @@ BOOL LLVOAvatarInfo::parseXmlLayerNodes(LLXmlTreeNode* root) | |||
9823 | //----------------------------------------------------------------------------- | 8849 | //----------------------------------------------------------------------------- |
9824 | // parseXmlDriverNodes(): parses <driver_parameters> nodes from XML tree | 8850 | // parseXmlDriverNodes(): parses <driver_parameters> nodes from XML tree |
9825 | //----------------------------------------------------------------------------- | 8851 | //----------------------------------------------------------------------------- |
9826 | BOOL LLVOAvatarInfo::parseXmlDriverNodes(LLXmlTreeNode* root) | 8852 | BOOL LLVOAvatarXmlInfo::parseXmlDriverNodes(LLXmlTreeNode* root) |
9827 | { | 8853 | { |
9828 | LLXmlTreeNode* driver = root->getChildByName( "driver_parameters" ); | 8854 | LLXmlTreeNode* driver = root->getChildByName( "driver_parameters" ); |
9829 | if( driver ) | 8855 | if( driver ) |
@@ -9901,41 +8927,17 @@ std::string LLVOAvatar::getFullname() const | |||
9901 | 8927 | ||
9902 | LLTexLayerSet* LLVOAvatar::getLayerSet(ETextureIndex index) const | 8928 | LLTexLayerSet* LLVOAvatar::getLayerSet(ETextureIndex index) const |
9903 | { | 8929 | { |
9904 | switch( index ) | 8930 | /* switch(index) |
8931 | case TEX_HEAD_BAKED: | ||
8932 | case TEX_HEAD_BODYPAINT: | ||
8933 | return mHeadLayerSet; */ | ||
8934 | const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); | ||
8935 | if (text_dict->mIsUsedByBakedTexture) | ||
9905 | { | 8936 | { |
9906 | case TEX_HEAD_BAKED: | 8937 | const EBakedTextureIndex baked_index = text_dict->mBakedTextureIndex; |
9907 | case TEX_HEAD_BODYPAINT: | 8938 | return mBakedTextureData[baked_index].mTexLayerSet; |
9908 | return mHeadLayerSet; | ||
9909 | |||
9910 | case TEX_UPPER_BAKED: | ||
9911 | case TEX_UPPER_SHIRT: | ||
9912 | case TEX_UPPER_BODYPAINT: | ||
9913 | case TEX_UPPER_JACKET: | ||
9914 | case TEX_UPPER_GLOVES: | ||
9915 | case TEX_UPPER_UNDERSHIRT: | ||
9916 | return mUpperBodyLayerSet; | ||
9917 | |||
9918 | case TEX_LOWER_BAKED: | ||
9919 | case TEX_LOWER_PANTS: | ||
9920 | case TEX_LOWER_BODYPAINT: | ||
9921 | case TEX_LOWER_SHOES: | ||
9922 | case TEX_LOWER_SOCKS: | ||
9923 | case TEX_LOWER_JACKET: | ||
9924 | case TEX_LOWER_UNDERPANTS: | ||
9925 | return mLowerBodyLayerSet; | ||
9926 | |||
9927 | case TEX_EYES_BAKED: | ||
9928 | case TEX_EYES_IRIS: | ||
9929 | return mEyesLayerSet; | ||
9930 | |||
9931 | case TEX_SKIRT_BAKED: | ||
9932 | case TEX_SKIRT: | ||
9933 | return mSkirtLayerSet; | ||
9934 | |||
9935 | case TEX_HAIR: | ||
9936 | default: | ||
9937 | return NULL; | ||
9938 | } | 8939 | } |
8940 | return NULL; | ||
9939 | } | 8941 | } |
9940 | 8942 | ||
9941 | LLHost LLVOAvatar::getObjectHost() const | 8943 | LLHost LLVOAvatar::getObjectHost() const |
@@ -9956,15 +8958,15 @@ void LLVOAvatar::updateFreezeCounter(S32 counter) | |||
9956 | { | 8958 | { |
9957 | if(counter) | 8959 | if(counter) |
9958 | { | 8960 | { |
9959 | sFreezeCounter = counter ; | 8961 | sFreezeCounter = counter; |
9960 | } | 8962 | } |
9961 | else if(sFreezeCounter > 0) | 8963 | else if(sFreezeCounter > 0) |
9962 | { | 8964 | { |
9963 | sFreezeCounter-- ; | 8965 | sFreezeCounter--; |
9964 | } | 8966 | } |
9965 | else | 8967 | else |
9966 | { | 8968 | { |
9967 | sFreezeCounter = 0 ; | 8969 | sFreezeCounter = 0; |
9968 | } | 8970 | } |
9969 | } | 8971 | } |
9970 | 8972 | ||
@@ -10016,13 +9018,13 @@ void LLVOAvatar::updateImpostors() | |||
10016 | 9018 | ||
10017 | BOOL LLVOAvatar::isImpostor() const | 9019 | BOOL LLVOAvatar::isImpostor() const |
10018 | { | 9020 | { |
10019 | return (sUseImpostors && mUpdatePeriod >= VOAVATAR_IMPOSTOR_PERIOD) ? TRUE : FALSE; | 9021 | return (sUseImpostors && mUpdatePeriod >= IMPOSTOR_PERIOD) ? TRUE : FALSE; |
10020 | } | 9022 | } |
10021 | 9023 | ||
10022 | 9024 | ||
10023 | BOOL LLVOAvatar::needsImpostorUpdate() const | 9025 | BOOL LLVOAvatar::needsImpostorUpdate() const |
10024 | { | 9026 | { |
10025 | return mNeedsImpostorUpdate ; | 9027 | return mNeedsImpostorUpdate; |
10026 | } | 9028 | } |
10027 | 9029 | ||
10028 | const LLVector3& LLVOAvatar::getImpostorOffset() const | 9030 | const LLVector3& LLVOAvatar::getImpostorOffset() const |
@@ -10045,7 +9047,7 @@ void LLVOAvatar::cacheImpostorValues() | |||
10045 | getImpostorValues(mImpostorExtents, mImpostorAngle, mImpostorDistance); | 9047 | getImpostorValues(mImpostorExtents, mImpostorAngle, mImpostorDistance); |
10046 | } | 9048 | } |
10047 | 9049 | ||
10048 | void LLVOAvatar::getImpostorValues(LLVector3* extents, LLVector3& angle, F32& distance) | 9050 | void LLVOAvatar::getImpostorValues(LLVector3* extents, LLVector3& angle, F32& distance) const |
10049 | { | 9051 | { |
10050 | const LLVector3* ext = mDrawable->getSpatialExtents(); | 9052 | const LLVector3* ext = mDrawable->getSpatialExtents(); |
10051 | extents[0] = ext[0]; | 9053 | extents[0] = ext[0]; |
@@ -10059,6 +9061,85 @@ void LLVOAvatar::getImpostorValues(LLVector3* extents, LLVector3& angle, F32& di | |||
10059 | angle.mV[2] = da; | 9061 | angle.mV[2] = da; |
10060 | } | 9062 | } |
10061 | 9063 | ||
9064 | void LLVOAvatar::idleUpdateRenderCost() | ||
9065 | { | ||
9066 | if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHAME)) | ||
9067 | { | ||
9068 | return; | ||
9069 | } | ||
9070 | |||
9071 | U32 shame = 1; | ||
9072 | |||
9073 | std::set<LLUUID> textures; | ||
9074 | |||
9075 | attachment_map_t::const_iterator iter; | ||
9076 | for (iter = mAttachmentPoints.begin(); | ||
9077 | iter != mAttachmentPoints.end(); | ||
9078 | ++iter) | ||
9079 | { | ||
9080 | LLViewerJointAttachment* attachment = iter->second; | ||
9081 | LLViewerObject* object = attachment->getObject(); | ||
9082 | if (object && !object->isHUDAttachment()) | ||
9083 | { | ||
9084 | LLDrawable* drawable = object->mDrawable; | ||
9085 | if (drawable) | ||
9086 | { | ||
9087 | shame += 10; | ||
9088 | LLVOVolume* volume = drawable->getVOVolume(); | ||
9089 | if (volume) | ||
9090 | { | ||
9091 | shame += calc_shame(volume, textures); | ||
9092 | } | ||
9093 | } | ||
9094 | } | ||
9095 | } | ||
9096 | |||
9097 | shame += textures.size() * 5; | ||
9098 | |||
9099 | setDebugText(llformat("%d", shame)); | ||
9100 | F32 green = 1.f-llclamp(((F32) shame-1024.f)/1024.f, 0.f, 1.f); | ||
9101 | F32 red = llmin((F32) shame/1024.f, 1.f); | ||
9102 | mText->setColor(LLColor4(red,green,0,1)); | ||
9103 | } | ||
9104 | |||
9105 | // static | ||
9106 | BOOL LLVOAvatar::isIndexLocalTexture(ETextureIndex index) | ||
9107 | { | ||
9108 | if (index < 0 || index >= TEX_NUM_INDICES) return false; | ||
9109 | return LLVOAvatarDictionary::getInstance()->getTexture(index)->mIsLocalTexture; | ||
9110 | } | ||
9111 | |||
9112 | // static | ||
9113 | BOOL LLVOAvatar::isIndexBakedTexture(ETextureIndex index) | ||
9114 | { | ||
9115 | if (index < 0 || index >= TEX_NUM_INDICES) return false; | ||
9116 | return LLVOAvatarDictionary::getInstance()->getTexture(index)->mIsBakedTexture; | ||
9117 | } | ||
9118 | |||
9119 | const std::string LLVOAvatar::getBakedStatusForPrintout() const | ||
9120 | { | ||
9121 | std::string line; | ||
9122 | |||
9123 | for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); | ||
9124 | iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); | ||
9125 | iter++) | ||
9126 | { | ||
9127 | const ETextureIndex index = iter->first; | ||
9128 | const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; | ||
9129 | if (text_dict->mIsBakedTexture) | ||
9130 | { | ||
9131 | line += text_dict->mName; | ||
9132 | if (isTextureDefined(index)) | ||
9133 | { | ||
9134 | line += "_baked"; | ||
9135 | } | ||
9136 | line += " "; | ||
9137 | } | ||
9138 | } | ||
9139 | return line; | ||
9140 | } | ||
9141 | |||
9142 | |||
10062 | U32 calc_shame(LLVOVolume* volume, std::set<LLUUID> &textures) | 9143 | U32 calc_shame(LLVOVolume* volume, std::set<LLUUID> &textures) |
10063 | { | 9144 | { |
10064 | if (!volume) | 9145 | if (!volume) |
@@ -10163,45 +9244,11 @@ U32 calc_shame(LLVOVolume* volume, std::set<LLUUID> &textures) | |||
10163 | return shame; | 9244 | return shame; |
10164 | } | 9245 | } |
10165 | 9246 | ||
10166 | void LLVOAvatar::idleUpdateRenderCost() | 9247 | //----------------------------------------------------------------------------- |
10167 | { | 9248 | // Utility functions |
10168 | if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHAME)) | 9249 | //----------------------------------------------------------------------------- |
10169 | { | ||
10170 | return; | ||
10171 | } | ||
10172 | |||
10173 | U32 shame = 1; | ||
10174 | |||
10175 | std::set<LLUUID> textures; | ||
10176 | |||
10177 | attachment_map_t::const_iterator iter; | ||
10178 | for (iter = mAttachmentPoints.begin(); | ||
10179 | iter != mAttachmentPoints.end(); | ||
10180 | ++iter) | ||
10181 | { | ||
10182 | LLViewerJointAttachment* attachment = iter->second; | ||
10183 | LLViewerObject* object = attachment->getObject(); | ||
10184 | if (object && !object->isHUDAttachment()) | ||
10185 | { | ||
10186 | LLDrawable* drawable = object->mDrawable; | ||
10187 | if (drawable) | ||
10188 | { | ||
10189 | shame += 10; | ||
10190 | LLVOVolume* volume = drawable->getVOVolume(); | ||
10191 | if (volume) | ||
10192 | { | ||
10193 | shame += calc_shame(volume, textures); | ||
10194 | } | ||
10195 | } | ||
10196 | } | ||
10197 | } | ||
10198 | |||
10199 | shame += textures.size() * 5; | ||
10200 | 9250 | ||
10201 | setDebugText(llformat("%d", shame)); | 9251 | F32 calc_bouncy_animation(F32 x) |
10202 | F32 green = 1.f-llclamp(((F32) shame-1024.f)/1024.f, 0.f, 1.f); | 9252 | { |
10203 | F32 red = llmin((F32) shame/1024.f, 1.f); | 9253 | return -(cosf(x * F_PI * 2.5f - F_PI_BY_TWO))*(0.4f + x * -0.1f) + x * 1.3f; |
10204 | mText->setColor(LLColor4(red,green,0,1)); | ||
10205 | } | 9254 | } |
10206 | |||
10207 | |||