diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/lldrawpoolavatar.cpp | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2 meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz |
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/newview/lldrawpoolavatar.cpp')
-rw-r--r-- | linden/indra/newview/lldrawpoolavatar.cpp | 309 |
1 files changed, 189 insertions, 120 deletions
diff --git a/linden/indra/newview/lldrawpoolavatar.cpp b/linden/indra/newview/lldrawpoolavatar.cpp index 6e22632..5518a93 100644 --- a/linden/indra/newview/lldrawpoolavatar.cpp +++ b/linden/indra/newview/lldrawpoolavatar.cpp | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "llviewerprecompiledheaders.h" | 32 | #include "llviewerprecompiledheaders.h" |
33 | 33 | ||
34 | #include "lldrawpoolavatar.h" | 34 | #include "lldrawpoolavatar.h" |
35 | #include "llglimmediate.h" | ||
35 | 36 | ||
36 | #include "llvoavatar.h" | 37 | #include "llvoavatar.h" |
37 | #include "m3math.h" | 38 | #include "m3math.h" |
@@ -142,20 +143,33 @@ LLMatrix4& LLDrawPoolAvatar::getModelView() | |||
142 | 143 | ||
143 | S32 LLDrawPoolAvatar::getNumPasses() | 144 | S32 LLDrawPoolAvatar::getNumPasses() |
144 | { | 145 | { |
145 | return 3; | 146 | return LLPipeline::sImpostorRender ? 1 : 3; |
146 | } | 147 | } |
147 | 148 | ||
148 | void LLDrawPoolAvatar::render(S32 pass) | 149 | void LLDrawPoolAvatar::render(S32 pass) |
149 | { | 150 | { |
150 | LLFastTimer t(LLFastTimer::FTM_RENDER_CHARACTERS); | 151 | LLFastTimer t(LLFastTimer::FTM_RENDER_CHARACTERS); |
152 | if (LLPipeline::sImpostorRender) | ||
153 | { | ||
154 | renderAvatars(NULL, 2); | ||
155 | return; | ||
156 | } | ||
157 | |||
151 | renderAvatars(NULL, pass); // render all avatars | 158 | renderAvatars(NULL, pass); // render all avatars |
152 | } | 159 | } |
153 | 160 | ||
154 | void LLDrawPoolAvatar::beginRenderPass(S32 pass) | 161 | void LLDrawPoolAvatar::beginRenderPass(S32 pass) |
155 | { | 162 | { |
163 | LLFastTimer t(LLFastTimer::FTM_RENDER_CHARACTERS); | ||
156 | //reset vertex buffer mappings | 164 | //reset vertex buffer mappings |
157 | LLVertexBuffer::unbind(); | 165 | LLVertexBuffer::unbind(); |
158 | 166 | ||
167 | if (LLPipeline::sImpostorRender) | ||
168 | { | ||
169 | beginSkinned(); | ||
170 | return; | ||
171 | } | ||
172 | |||
159 | switch (pass) | 173 | switch (pass) |
160 | { | 174 | { |
161 | case 0: | 175 | case 0: |
@@ -172,6 +186,14 @@ void LLDrawPoolAvatar::beginRenderPass(S32 pass) | |||
172 | 186 | ||
173 | void LLDrawPoolAvatar::endRenderPass(S32 pass) | 187 | void LLDrawPoolAvatar::endRenderPass(S32 pass) |
174 | { | 188 | { |
189 | LLFastTimer t(LLFastTimer::FTM_RENDER_CHARACTERS); | ||
190 | |||
191 | if (LLPipeline::sImpostorRender) | ||
192 | { | ||
193 | endSkinned(); | ||
194 | return; | ||
195 | } | ||
196 | |||
175 | switch (pass) | 197 | switch (pass) |
176 | { | 198 | { |
177 | case 0: | 199 | case 0: |
@@ -187,31 +209,47 @@ void LLDrawPoolAvatar::endRenderPass(S32 pass) | |||
187 | 209 | ||
188 | void LLDrawPoolAvatar::beginFootShadow() | 210 | void LLDrawPoolAvatar::beginFootShadow() |
189 | { | 211 | { |
190 | glDepthMask(GL_FALSE); | 212 | if (!LLPipeline::sReflectionRender) |
213 | { | ||
214 | LLVOAvatar::sRenderDistance = llclamp(LLVOAvatar::sRenderDistance, 16.f, 256.f); | ||
215 | LLVOAvatar::sNumVisibleAvatars = 0; | ||
216 | } | ||
217 | |||
191 | gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); | 218 | gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); |
192 | glEnableClientState(GL_TEXTURE_COORD_ARRAY); | 219 | glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
193 | } | 220 | } |
194 | 221 | ||
195 | void LLDrawPoolAvatar::endFootShadow() | 222 | void LLDrawPoolAvatar::endFootShadow() |
196 | { | 223 | { |
197 | gPipeline.enableLightsDynamic(1.f); | 224 | gPipeline.enableLightsDynamic(); |
198 | glDepthMask(GL_TRUE); | ||
199 | glDisableClientState(GL_TEXTURE_COORD_ARRAY); | 225 | glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
200 | } | 226 | } |
201 | 227 | ||
202 | void LLDrawPoolAvatar::beginRigid() | 228 | void LLDrawPoolAvatar::beginRigid() |
203 | { | 229 | { |
204 | sVertexProgram = NULL; | 230 | if (gPipeline.canUseVertexShaders()) |
205 | sShaderLevel = 0; | 231 | { |
232 | if (LLPipeline::sUnderWaterRender) | ||
233 | { | ||
234 | sVertexProgram = &gObjectSimpleWaterProgram; | ||
235 | } | ||
236 | else | ||
237 | { | ||
238 | sVertexProgram = &gObjectSimpleProgram; | ||
239 | } | ||
240 | |||
241 | if (sVertexProgram != NULL) | ||
242 | { //eyeballs render with the specular shader | ||
243 | sVertexProgram->bind(); | ||
244 | } | ||
245 | } | ||
246 | else | ||
247 | { | ||
248 | sVertexProgram = NULL; | ||
249 | } | ||
250 | |||
206 | glEnableClientState(GL_NORMAL_ARRAY); | 251 | glEnableClientState(GL_NORMAL_ARRAY); |
207 | glEnableClientState(GL_TEXTURE_COORD_ARRAY); | 252 | glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
208 | |||
209 | /*if (sShaderLevel > 0) | ||
210 | { //eyeballs render with the specular shader | ||
211 | gAvatarEyeballProgram.bind(); | ||
212 | gMaterialIndex = gAvatarEyeballProgram.mAttribute[LLShaderMgr::MATERIAL_COLOR]; | ||
213 | gSpecularIndex = gAvatarEyeballProgram.mAttribute[LLShaderMgr::SPECULAR_COLOR]; | ||
214 | }*/ | ||
215 | } | 253 | } |
216 | 254 | ||
217 | void LLDrawPoolAvatar::endRigid() | 255 | void LLDrawPoolAvatar::endRigid() |
@@ -219,6 +257,10 @@ void LLDrawPoolAvatar::endRigid() | |||
219 | sShaderLevel = mVertexShaderLevel; | 257 | sShaderLevel = mVertexShaderLevel; |
220 | glDisableClientState(GL_NORMAL_ARRAY); | 258 | glDisableClientState(GL_NORMAL_ARRAY); |
221 | glDisableClientState(GL_TEXTURE_COORD_ARRAY); | 259 | glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
260 | if (sVertexProgram != NULL) | ||
261 | { | ||
262 | sVertexProgram->unbind(); | ||
263 | } | ||
222 | } | 264 | } |
223 | 265 | ||
224 | void LLDrawPoolAvatar::beginSkinned() | 266 | void LLDrawPoolAvatar::beginSkinned() |
@@ -226,17 +268,35 @@ void LLDrawPoolAvatar::beginSkinned() | |||
226 | glEnableClientState(GL_NORMAL_ARRAY); | 268 | glEnableClientState(GL_NORMAL_ARRAY); |
227 | glEnableClientState(GL_TEXTURE_COORD_ARRAY); | 269 | glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
228 | 270 | ||
229 | sVertexProgram = &gAvatarProgram; | 271 | if (sShaderLevel > 0) |
230 | 272 | { | |
273 | if (LLPipeline::sUnderWaterRender) | ||
274 | { | ||
275 | sVertexProgram = &gAvatarWaterProgram; | ||
276 | sShaderLevel = llmin((U32) 1, sShaderLevel); | ||
277 | } | ||
278 | else | ||
279 | { | ||
280 | sVertexProgram = &gAvatarProgram; | ||
281 | } | ||
282 | } | ||
283 | else | ||
284 | { | ||
285 | if (LLPipeline::sUnderWaterRender) | ||
286 | { | ||
287 | sVertexProgram = &gObjectSimpleWaterProgram; | ||
288 | } | ||
289 | else | ||
290 | { | ||
291 | sVertexProgram = &gObjectSimpleProgram; | ||
292 | } | ||
293 | } | ||
294 | |||
231 | if (sShaderLevel > 0) // for hardware blending | 295 | if (sShaderLevel > 0) // for hardware blending |
232 | { | 296 | { |
233 | sRenderingSkinned = TRUE; | 297 | sRenderingSkinned = TRUE; |
234 | glClientActiveTextureARB(GL_TEXTURE1_ARB); | 298 | glClientActiveTextureARB(GL_TEXTURE1_ARB); |
235 | if (sShaderLevel >= SHADER_LEVEL_BUMP) | 299 | |
236 | { | ||
237 | gMaterialIndex = sVertexProgram->mAttribute[LLShaderMgr::MATERIAL_COLOR]; | ||
238 | gSpecularIndex = sVertexProgram->mAttribute[LLShaderMgr::SPECULAR_COLOR]; | ||
239 | } | ||
240 | sVertexProgram->bind(); | 300 | sVertexProgram->bind(); |
241 | if (sShaderLevel >= SHADER_LEVEL_CLOTH) | 301 | if (sShaderLevel >= SHADER_LEVEL_CLOTH) |
242 | { | 302 | { |
@@ -252,6 +312,15 @@ void LLDrawPoolAvatar::beginSkinned() | |||
252 | sVertexProgram->enableTexture(LLShaderMgr::BUMP_MAP); | 312 | sVertexProgram->enableTexture(LLShaderMgr::BUMP_MAP); |
253 | glActiveTextureARB(GL_TEXTURE0_ARB); | 313 | glActiveTextureARB(GL_TEXTURE0_ARB); |
254 | } | 314 | } |
315 | else | ||
316 | { | ||
317 | if(gPipeline.canUseVertexShaders()) | ||
318 | { | ||
319 | // software skinning, use a basic shader for windlight. | ||
320 | // TODO: find a better fallback method for software skinning. | ||
321 | sVertexProgram->bind(); | ||
322 | } | ||
323 | } | ||
255 | } | 324 | } |
256 | 325 | ||
257 | void LLDrawPoolAvatar::endSkinned() | 326 | void LLDrawPoolAvatar::endSkinned() |
@@ -274,6 +343,16 @@ void LLDrawPoolAvatar::endSkinned() | |||
274 | } | 343 | } |
275 | 344 | ||
276 | sVertexProgram->unbind(); | 345 | sVertexProgram->unbind(); |
346 | sShaderLevel = mVertexShaderLevel; | ||
347 | } | ||
348 | else | ||
349 | { | ||
350 | if(gPipeline.canUseVertexShaders()) | ||
351 | { | ||
352 | // software skinning, use a basic shader for windlight. | ||
353 | // TODO: find a better fallback method for software skinning. | ||
354 | sVertexProgram->unbind(); | ||
355 | } | ||
277 | } | 356 | } |
278 | 357 | ||
279 | glActiveTextureARB(GL_TEXTURE0_ARB); | 358 | glActiveTextureARB(GL_TEXTURE0_ARB); |
@@ -299,6 +378,8 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) | |||
299 | return; | 378 | return; |
300 | } | 379 | } |
301 | 380 | ||
381 | |||
382 | |||
302 | if (!gRenderAvatar) | 383 | if (!gRenderAvatar) |
303 | { | 384 | { |
304 | return; | 385 | return; |
@@ -330,60 +411,50 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) | |||
330 | return; | 411 | return; |
331 | } | 412 | } |
332 | 413 | ||
333 | LLOverrideFaceColor color(this, 1.0f, 1.0f, 1.0f, 1.0f); | 414 | BOOL impostor = avatarp->isImpostor() && !single_avatar; |
415 | |||
416 | if (impostor && pass != 0) | ||
417 | { //don't draw anything but the impostor for impostored avatars | ||
418 | return; | ||
419 | } | ||
334 | 420 | ||
421 | if (pass == 0 && !impostor && LLPipeline::sUnderWaterRender) | ||
422 | { //don't draw foot shadows under water | ||
423 | return; | ||
424 | } | ||
425 | |||
426 | LLOverrideFaceColor color(this, 1.0f, 1.0f, 1.0f, 1.0f); | ||
427 | |||
335 | if (pass == 0) | 428 | if (pass == 0) |
336 | { | 429 | { |
337 | if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS)) | 430 | if (!LLPipeline::sReflectionRender) |
431 | { | ||
432 | LLVOAvatar::sNumVisibleAvatars++; | ||
433 | } | ||
434 | |||
435 | if (impostor) | ||
436 | { | ||
437 | avatarp->renderImpostor(); | ||
438 | } | ||
439 | else if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS)) | ||
338 | { | 440 | { |
339 | mIndicesDrawn += avatarp->renderFootShadows(); | 441 | mIndicesDrawn += avatarp->renderFootShadows(); |
340 | } | 442 | } |
341 | return; | 443 | return; |
342 | } | 444 | } |
343 | 445 | ||
344 | if (avatarp->mSpecialRenderMode == 0) // normal | 446 | if (single_avatar && avatarp->mSpecialRenderMode >= 2) // 2=image preview, 3=morph view |
345 | { | ||
346 | gPipeline.enableLightsAvatar(avatarp->mDrawable->getSunShadowFactor()); | ||
347 | } | ||
348 | else if (avatarp->mSpecialRenderMode == 1) // anim preview | ||
349 | { | ||
350 | gPipeline.enableLightsAvatarEdit(LLColor4(0.7f, 0.6f, 0.3f, 1.f)); | ||
351 | } | ||
352 | else // 2=image preview, 3=morph view | ||
353 | { | 447 | { |
354 | gPipeline.enableLightsAvatarEdit(LLColor4(.5f, .5f, .5f, 1.f)); | 448 | gPipeline.enableLightsAvatarEdit(LLColor4(.5f, .5f, .5f, 1.f)); |
355 | } | 449 | } |
356 | 450 | ||
357 | if (pass == 1) | 451 | if (pass == 1) |
358 | { | 452 | { |
359 | // render rigid meshes (eyeballs) first | 453 | // render rigid meshes (eyeballs) first |
360 | mIndicesDrawn += avatarp->renderRigid(); | 454 | mIndicesDrawn += avatarp->renderRigid(); |
361 | |||
362 | if (!gRenderForSelect && avatarp->mIsSelf && LLVOAvatar::sAvatarLoadTest) | ||
363 | { | ||
364 | LLVector3 orig_pos_root = avatarp->mRoot.getPosition(); | ||
365 | LLVector3 next_pos_root = orig_pos_root; | ||
366 | for (S32 i = 0; i < NUM_TEST_AVATARS; i++) | ||
367 | { | ||
368 | next_pos_root.mV[VX] += 1.f; | ||
369 | if (i % 5 == 0) | ||
370 | { | ||
371 | next_pos_root.mV[VY] += 1.f; | ||
372 | next_pos_root.mV[VX] = orig_pos_root.mV[VX]; | ||
373 | } | ||
374 | |||
375 | avatarp->mRoot.setPosition(next_pos_root); // avatar load test | ||
376 | avatarp->mRoot.updateWorldMatrixChildren(); // avatar load test | ||
377 | |||
378 | mIndicesDrawn += avatarp->renderRigid(); | ||
379 | } | ||
380 | avatarp->mRoot.setPosition(orig_pos_root); // avatar load test | ||
381 | avatarp->mRoot.updateWorldMatrixChildren(); // avatar load test | ||
382 | } | ||
383 | return; | 455 | return; |
384 | } | 456 | } |
385 | 457 | ||
386 | |||
387 | if (sShaderLevel > 0) | 458 | if (sShaderLevel > 0) |
388 | { | 459 | { |
389 | gAvatarMatrixParam = sVertexProgram->mUniform[LLShaderMgr::AVATAR_MATRIX]; | 460 | gAvatarMatrixParam = sVertexProgram->mUniform[LLShaderMgr::AVATAR_MATRIX]; |
@@ -427,79 +498,57 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) | |||
427 | LLGLSNoTexture gls_no_texture; | 498 | LLGLSNoTexture gls_no_texture; |
428 | LLVector3 pos = avatarp->getPositionAgent(); | 499 | LLVector3 pos = avatarp->getPositionAgent(); |
429 | 500 | ||
430 | color.setColor(1.0f, 0.0f, 0.0f, 0.8f); | 501 | gGL.color4f(1.0f, 0.0f, 0.0f, 0.8f); |
431 | glBegin(GL_LINES); | 502 | gGL.begin(GL_LINES); |
432 | { | 503 | { |
433 | glVertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); | 504 | gGL.vertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); |
434 | glVertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); | 505 | gGL.vertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); |
435 | glVertex3fv((pos - LLVector3(0.f, 0.2f, 0.f)).mV); | 506 | gGL.vertex3fv((pos - LLVector3(0.f, 0.2f, 0.f)).mV); |
436 | glVertex3fv((pos + LLVector3(0.f, 0.2f, 0.f)).mV); | 507 | gGL.vertex3fv((pos + LLVector3(0.f, 0.2f, 0.f)).mV); |
437 | glVertex3fv((pos - LLVector3(0.f, 0.f, 0.2f)).mV); | 508 | gGL.vertex3fv((pos - LLVector3(0.f, 0.f, 0.2f)).mV); |
438 | glVertex3fv((pos + LLVector3(0.f, 0.f, 0.2f)).mV); | 509 | gGL.vertex3fv((pos + LLVector3(0.f, 0.f, 0.2f)).mV); |
439 | }glEnd(); | 510 | }gGL.end(); |
440 | 511 | ||
441 | pos = avatarp->mDrawable->getPositionAgent(); | 512 | pos = avatarp->mDrawable->getPositionAgent(); |
442 | color.setColor(1.0f, 0.0f, 0.0f, 0.8f); | 513 | gGL.color4f(1.0f, 0.0f, 0.0f, 0.8f); |
443 | glBegin(GL_LINES); | 514 | gGL.begin(GL_LINES); |
444 | { | 515 | { |
445 | glVertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); | 516 | gGL.vertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); |
446 | glVertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); | 517 | gGL.vertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); |
447 | glVertex3fv((pos - LLVector3(0.f, 0.2f, 0.f)).mV); | 518 | gGL.vertex3fv((pos - LLVector3(0.f, 0.2f, 0.f)).mV); |
448 | glVertex3fv((pos + LLVector3(0.f, 0.2f, 0.f)).mV); | 519 | gGL.vertex3fv((pos + LLVector3(0.f, 0.2f, 0.f)).mV); |
449 | glVertex3fv((pos - LLVector3(0.f, 0.f, 0.2f)).mV); | 520 | gGL.vertex3fv((pos - LLVector3(0.f, 0.f, 0.2f)).mV); |
450 | glVertex3fv((pos + LLVector3(0.f, 0.f, 0.2f)).mV); | 521 | gGL.vertex3fv((pos + LLVector3(0.f, 0.f, 0.2f)).mV); |
451 | }glEnd(); | 522 | }gGL.end(); |
452 | 523 | ||
453 | pos = avatarp->mRoot.getWorldPosition(); | 524 | pos = avatarp->mRoot.getWorldPosition(); |
454 | color.setColor(1.0f, 1.0f, 1.0f, 0.8f); | 525 | gGL.color4f(1.0f, 1.0f, 1.0f, 0.8f); |
455 | glBegin(GL_LINES); | 526 | gGL.begin(GL_LINES); |
456 | { | 527 | { |
457 | glVertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); | 528 | gGL.vertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); |
458 | glVertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); | 529 | gGL.vertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); |
459 | glVertex3fv((pos - LLVector3(0.f, 0.2f, 0.f)).mV); | 530 | gGL.vertex3fv((pos - LLVector3(0.f, 0.2f, 0.f)).mV); |
460 | glVertex3fv((pos + LLVector3(0.f, 0.2f, 0.f)).mV); | 531 | gGL.vertex3fv((pos + LLVector3(0.f, 0.2f, 0.f)).mV); |
461 | glVertex3fv((pos - LLVector3(0.f, 0.f, 0.2f)).mV); | 532 | gGL.vertex3fv((pos - LLVector3(0.f, 0.f, 0.2f)).mV); |
462 | glVertex3fv((pos + LLVector3(0.f, 0.f, 0.2f)).mV); | 533 | gGL.vertex3fv((pos + LLVector3(0.f, 0.f, 0.2f)).mV); |
463 | }glEnd(); | 534 | }gGL.end(); |
464 | 535 | ||
465 | pos = avatarp->mPelvisp->getWorldPosition(); | 536 | pos = avatarp->mPelvisp->getWorldPosition(); |
466 | color.setColor(0.0f, 0.0f, 1.0f, 0.8f); | 537 | gGL.color4f(0.0f, 0.0f, 1.0f, 0.8f); |
467 | glBegin(GL_LINES); | 538 | gGL.begin(GL_LINES); |
468 | { | 539 | { |
469 | glVertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); | 540 | gGL.vertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); |
470 | glVertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); | 541 | gGL.vertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); |
471 | glVertex3fv((pos - LLVector3(0.f, 0.2f, 0.f)).mV); | 542 | gGL.vertex3fv((pos - LLVector3(0.f, 0.2f, 0.f)).mV); |
472 | glVertex3fv((pos + LLVector3(0.f, 0.2f, 0.f)).mV); | 543 | gGL.vertex3fv((pos + LLVector3(0.f, 0.2f, 0.f)).mV); |
473 | glVertex3fv((pos - LLVector3(0.f, 0.f, 0.2f)).mV); | 544 | gGL.vertex3fv((pos - LLVector3(0.f, 0.f, 0.2f)).mV); |
474 | glVertex3fv((pos + LLVector3(0.f, 0.f, 0.2f)).mV); | 545 | gGL.vertex3fv((pos + LLVector3(0.f, 0.f, 0.2f)).mV); |
475 | }glEnd(); | 546 | }gGL.end(); |
476 | 547 | ||
477 | color.setColor(1.0f, 1.0f, 1.0f, 1.0f); | 548 | color.setColor(1.0f, 1.0f, 1.0f, 1.0f); |
478 | } | 549 | } |
479 | 550 | ||
480 | mIndicesDrawn += avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE); | 551 | mIndicesDrawn += avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE); |
481 | |||
482 | if (!gRenderForSelect && avatarp->mIsSelf && LLVOAvatar::sAvatarLoadTest) | ||
483 | { | ||
484 | LLVector3 orig_pos_root = avatarp->mRoot.getPosition(); | ||
485 | LLVector3 next_pos_root = orig_pos_root; | ||
486 | for (S32 i = 0; i < NUM_TEST_AVATARS; i++) | ||
487 | { | ||
488 | next_pos_root.mV[VX] += 1.f; | ||
489 | if (i % 5 == 0) | ||
490 | { | ||
491 | next_pos_root.mV[VY] += 1.f; | ||
492 | next_pos_root.mV[VX] = orig_pos_root.mV[VX]; | ||
493 | } | ||
494 | |||
495 | avatarp->mRoot.setPosition(next_pos_root); // avatar load test | ||
496 | avatarp->mRoot.updateWorldMatrixChildren(); // avatar load test | ||
497 | |||
498 | mIndicesDrawn += avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE); | ||
499 | } | ||
500 | avatarp->mRoot.setPosition(orig_pos_root); // avatar load test | ||
501 | avatarp->mRoot.updateWorldMatrixChildren(); // avatar load test | ||
502 | } | ||
503 | } | 552 | } |
504 | } | 553 | } |
505 | 554 | ||
@@ -535,6 +584,31 @@ void LLDrawPoolAvatar::renderForSelect() | |||
535 | return; | 584 | return; |
536 | } | 585 | } |
537 | 586 | ||
587 | S32 name = avatarp->mDrawable->getVObj()->mGLName; | ||
588 | LLColor4U color((U8)(name >> 16), (U8)(name >> 8), (U8)name); | ||
589 | |||
590 | BOOL impostor = avatarp->isImpostor(); | ||
591 | if (impostor) | ||
592 | { | ||
593 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); | ||
594 | glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE); | ||
595 | glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_MODULATE); | ||
596 | |||
597 | glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PRIMARY_COLOR); | ||
598 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR); | ||
599 | |||
600 | glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE); | ||
601 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA); | ||
602 | |||
603 | glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, GL_PRIMARY_COLOR_ARB); | ||
604 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, GL_SRC_ALPHA); | ||
605 | |||
606 | avatarp->renderImpostor(color); | ||
607 | |||
608 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); | ||
609 | return; | ||
610 | } | ||
611 | |||
538 | glEnableClientState(GL_VERTEX_ARRAY); | 612 | glEnableClientState(GL_VERTEX_ARRAY); |
539 | glEnableClientState(GL_NORMAL_ARRAY); | 613 | glEnableClientState(GL_NORMAL_ARRAY); |
540 | glEnableClientState(GL_TEXTURE_COORD_ARRAY); | 614 | glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
@@ -544,15 +618,10 @@ void LLDrawPoolAvatar::renderForSelect() | |||
544 | gAvatarMatrixParam = sVertexProgram->mUniform[LLShaderMgr::AVATAR_MATRIX]; | 618 | gAvatarMatrixParam = sVertexProgram->mUniform[LLShaderMgr::AVATAR_MATRIX]; |
545 | } | 619 | } |
546 | glAlphaFunc(GL_GEQUAL, 0.2f); | 620 | glAlphaFunc(GL_GEQUAL, 0.2f); |
547 | glBlendFunc(GL_ONE, GL_ZERO); | 621 | gGL.blendFunc(GL_ONE, GL_ZERO); |
548 | 622 | ||
549 | S32 name = avatarp->mDrawable->getVObj()->mGLName; | ||
550 | LLColor4U color((U8)(name >> 16), (U8)(name >> 8), (U8)name); | ||
551 | glColor4ubv(color.mV); | 623 | glColor4ubv(color.mV); |
552 | 624 | ||
553 | // render rigid meshes (eyeballs) first | ||
554 | //mIndicesDrawn += avatarp->renderRigid(); | ||
555 | |||
556 | if ((sShaderLevel > 0) && !gUseGLPick) // for hardware blending | 625 | if ((sShaderLevel > 0) && !gUseGLPick) // for hardware blending |
557 | { | 626 | { |
558 | glClientActiveTextureARB(GL_TEXTURE0_ARB); | 627 | glClientActiveTextureARB(GL_TEXTURE0_ARB); |
@@ -572,7 +641,7 @@ void LLDrawPoolAvatar::renderForSelect() | |||
572 | } | 641 | } |
573 | 642 | ||
574 | glAlphaFunc(GL_GREATER, 0.01f); | 643 | glAlphaFunc(GL_GREATER, 0.01f); |
575 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 644 | gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
576 | 645 | ||
577 | // restore texture mode | 646 | // restore texture mode |
578 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); | 647 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |