aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerjoint.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:50 -0500
committerJacek Antonelli2008-08-15 23:44:50 -0500
commit89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch)
treebcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/newview/llviewerjoint.cpp
parentSecond Life viewer sources 1.13.3.2 (diff)
downloadmeta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz
Second Life viewer sources 1.14.0.0
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewerjoint.cpp150
1 files changed, 77 insertions, 73 deletions
diff --git a/linden/indra/newview/llviewerjoint.cpp b/linden/indra/newview/llviewerjoint.cpp
index f8fed01..a1294be 100644
--- a/linden/indra/newview/llviewerjoint.cpp
+++ b/linden/indra/newview/llviewerjoint.cpp
@@ -101,10 +101,10 @@ void LLViewerJoint::setValid( BOOL valid, BOOL recursive )
101 //---------------------------------------------------------------- 101 //----------------------------------------------------------------
102 if (recursive) 102 if (recursive)
103 { 103 {
104 for ( LLViewerJoint *joint = (LLViewerJoint*)mChildren.getFirstData(); 104 for (child_list_t::iterator iter = mChildren.begin();
105 joint != NULL; 105 iter != mChildren.end(); ++iter)
106 joint = (LLViewerJoint*)mChildren.getNextData() )
107 { 106 {
107 LLViewerJoint* joint = (LLViewerJoint*)(*iter);
108 joint->setValid(valid, TRUE); 108 joint->setValid(valid, TRUE);
109 } 109 }
110 } 110 }
@@ -217,10 +217,10 @@ void LLViewerJoint::renderSkeleton(BOOL recursive)
217 //---------------------------------------------------------------- 217 //----------------------------------------------------------------
218 if (recursive) 218 if (recursive)
219 { 219 {
220 for ( LLViewerJoint *joint = (LLViewerJoint*)mChildren.getFirstData(); 220 for (child_list_t::iterator iter = mChildren.begin();
221 joint != NULL; 221 iter != mChildren.end(); ++iter)
222 joint = (LLViewerJoint*)mChildren.getNextData() )
223 { 222 {
223 LLViewerJoint* joint = (LLViewerJoint*)(*iter);
224 joint->renderSkeleton(); 224 joint->renderSkeleton();
225 } 225 }
226 } 226 }
@@ -235,7 +235,7 @@ void LLViewerJoint::renderSkeleton(BOOL recursive)
235//-------------------------------------------------------------------- 235//--------------------------------------------------------------------
236// render() 236// render()
237//-------------------------------------------------------------------- 237//--------------------------------------------------------------------
238U32 LLViewerJoint::render( F32 pixelArea ) 238U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass )
239{ 239{
240 U32 triangle_count = 0; 240 U32 triangle_count = 0;
241 241
@@ -245,73 +245,68 @@ U32 LLViewerJoint::render( F32 pixelArea )
245 if ( mValid ) 245 if ( mValid )
246 { 246 {
247 247
248
248 //---------------------------------------------------------------- 249 //----------------------------------------------------------------
249 // if object is transparent, defer it, otherwise 250 // if object is transparent, defer it, otherwise
250 // give the joint subclass a chance to draw itself 251 // give the joint subclass a chance to draw itself
251 //---------------------------------------------------------------- 252 //----------------------------------------------------------------
252 if ( gRenderForSelect ) 253 if ( gRenderForSelect )
253 { 254 {
254 triangle_count += drawShape( pixelArea ); 255 triangle_count += drawShape( pixelArea, first_pass );
255 } 256 }
256 else if ( isTransparent() ) 257 else if ( isTransparent() )
257 { 258 {
258 LLGLEnable blend(GL_BLEND);
259 // Hair and Skirt 259 // Hair and Skirt
260 if ((pixelArea > MIN_PIXEL_AREA_3PASS_HAIR)) 260 if ((pixelArea > MIN_PIXEL_AREA_3PASS_HAIR))
261 { 261 {
262 // render all three passes 262 // render all three passes
263 LLGLEnable alpha_test(GL_ALPHA_TEST);
264 LLGLDisable cull(GL_CULL_FACE); 263 LLGLDisable cull(GL_CULL_FACE);
265 // first pass renders without writing to the z buffer 264 // first pass renders without writing to the z buffer
266 { 265 {
267 LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); 266 LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
268 triangle_count += drawShape( pixelArea ); 267 triangle_count += drawShape( pixelArea, first_pass);
269 } 268 }
270 // second pass writes to z buffer only 269 // second pass writes to z buffer only
271 glColorMask(FALSE, FALSE, FALSE, FALSE); 270 glColorMask(FALSE, FALSE, FALSE, FALSE);
272 { 271 {
273 triangle_count += drawShape( pixelArea ); 272 triangle_count += drawShape( pixelArea, FALSE );
274 } 273 }
275 // third past respects z buffer and writes color 274 // third past respects z buffer and writes color
276 glColorMask(TRUE, TRUE, TRUE, TRUE); 275 glColorMask(TRUE, TRUE, TRUE, TRUE);
277 { 276 {
278 LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); 277 LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
279 triangle_count += drawShape( pixelArea ); 278 triangle_count += drawShape( pixelArea, FALSE );
280 } 279 }
281 } 280 }
282 else 281 else
283 { 282 {
284 LLGLEnable alpha_test(GL_ALPHA_TEST);
285 // Render Inside (no Z buffer write) 283 // Render Inside (no Z buffer write)
286 glCullFace(GL_FRONT); 284 glCullFace(GL_FRONT);
287 { 285 {
288 LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); 286 LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
289 triangle_count += drawShape( pixelArea ); 287 triangle_count += drawShape( pixelArea, first_pass );
290 } 288 }
291 // Render Outside (write to the Z buffer) 289 // Render Outside (write to the Z buffer)
292 glCullFace(GL_BACK); 290 glCullFace(GL_BACK);
293 { 291 {
294 triangle_count += drawShape( pixelArea ); 292 triangle_count += drawShape( pixelArea, FALSE );
295 } 293 }
296 } 294 }
297 } 295 }
298 else 296 else
299 { 297 {
300 // set up render state 298 // set up render state
301 LLGLDisable blend(GL_BLEND); 299 triangle_count += drawShape( pixelArea, first_pass );
302 LLGLSPipelineAvatar gls_pipeline_avatar;
303 triangle_count += drawShape( pixelArea );
304 } 300 }
305 } 301 }
306 302
307 //---------------------------------------------------------------- 303 //----------------------------------------------------------------
308 // render children 304 // render children
309 //---------------------------------------------------------------- 305 //----------------------------------------------------------------
310 LLViewerJoint *joint; 306 for (child_list_t::iterator iter = mChildren.begin();
311 for ( joint = (LLViewerJoint *)mChildren.getFirstData(); 307 iter != mChildren.end(); ++iter)
312 joint != NULL;
313 joint = (LLViewerJoint *)mChildren.getNextData() )
314 { 308 {
309 LLViewerJoint* joint = (LLViewerJoint*)(*iter);
315 F32 jointLOD = joint->getLOD(); 310 F32 jointLOD = joint->getLOD();
316 if (pixelArea >= jointLOD || sDisableLOD) 311 if (pixelArea >= jointLOD || sDisableLOD)
317 { 312 {
@@ -324,7 +319,6 @@ U32 LLViewerJoint::render( F32 pixelArea )
324 } 319 }
325 } 320 }
326 321
327 glColorMask(TRUE, TRUE, TRUE, TRUE);
328 return triangle_count; 322 return triangle_count;
329} 323}
330 324
@@ -396,7 +390,7 @@ BOOL LLViewerJoint::isTransparent()
396//-------------------------------------------------------------------- 390//--------------------------------------------------------------------
397// drawShape() 391// drawShape()
398//-------------------------------------------------------------------- 392//--------------------------------------------------------------------
399U32 LLViewerJoint::drawShape( F32 pixelArea ) 393U32 LLViewerJoint::drawShape( F32 pixelArea, BOOL first_pass )
400{ 394{
401 return 0; 395 return 0;
402} 396}
@@ -409,65 +403,75 @@ void LLViewerJoint::setSkeletonComponents( U32 comp, BOOL recursive )
409 mComponents = comp; 403 mComponents = comp;
410 if (recursive) 404 if (recursive)
411 { 405 {
412 for ( LLViewerJoint *joint = (LLViewerJoint *)mChildren.getFirstData(); 406 for (child_list_t::iterator iter = mChildren.begin();
413 joint != NULL; 407 iter != mChildren.end(); ++iter)
414 joint = (LLViewerJoint *)mChildren.getNextData() )
415 { 408 {
409 LLViewerJoint* joint = (LLViewerJoint*)(*iter);
416 joint->setSkeletonComponents(comp, recursive); 410 joint->setSkeletonComponents(comp, recursive);
417 } 411 }
418 } 412 }
419} 413}
420 414
421void LLViewerJoint::updateFaceSizes(U32 &num_vertices, F32 pixel_area) 415void LLViewerJoint::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area)
422{ 416{
423 for ( LLViewerJoint *joint = (LLViewerJoint*)mChildren.getFirstData(); 417 for (child_list_t::iterator iter = mChildren.begin();
424 joint != NULL; 418 iter != mChildren.end(); ++iter)
425 joint = (LLViewerJoint*)mChildren.getNextData() )
426 { 419 {
427 F32 jointLOD = joint->getLOD(); 420 LLViewerJoint* joint = (LLViewerJoint*)(*iter);
428 if (pixel_area >= jointLOD || sDisableLOD) 421 //F32 jointLOD = joint->getLOD();
422 //if (pixel_area >= jointLOD || sDisableLOD)
429 { 423 {
430 joint->updateFaceSizes(num_vertices, pixel_area); 424 joint->updateFaceSizes(num_vertices, num_indices, pixel_area);
431 425
432 if (jointLOD != DEFAULT_LOD) 426 // if (jointLOD != DEFAULT_LOD)
433 { 427 // {
434 break; 428 // break;
435 } 429 // }
436 } 430 }
437 } 431 }
438} 432}
439 433
440void LLViewerJoint::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind) 434void LLViewerJoint::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind)
441{ 435{
442 for ( LLViewerJoint *joint = (LLViewerJoint*)mChildren.getFirstData(); 436 for (child_list_t::iterator iter = mChildren.begin();
443 joint != NULL; 437 iter != mChildren.end(); ++iter)
444 joint = (LLViewerJoint*)mChildren.getNextData() )
445 { 438 {
446 F32 jointLOD = joint->getLOD(); 439 LLViewerJoint* joint = (LLViewerJoint*)(*iter);
447 if (pixel_area >= jointLOD || sDisableLOD) 440 //F32 jointLOD = joint->getLOD();
441 //if (pixel_area >= jointLOD || sDisableLOD)
448 { 442 {
449 joint->updateFaceData(face, pixel_area, damp_wind); 443 joint->updateFaceData(face, pixel_area, damp_wind);
450 444
451 if (jointLOD != DEFAULT_LOD) 445 // if (jointLOD != DEFAULT_LOD)
452 { 446 // {
453 break; 447 // break;
454 } 448 // }
455 } 449 }
456 } 450 }
457} 451}
458 452
453void LLViewerJoint::updateGeometry()
454{
455 for (child_list_t::iterator iter = mChildren.begin();
456 iter != mChildren.end(); ++iter)
457 {
458 LLViewerJoint* joint = (LLViewerJoint*)(*iter);
459 joint->updateGeometry();
460 }
461}
462
459 463
460BOOL LLViewerJoint::updateLOD(F32 pixel_area, BOOL activate) 464BOOL LLViewerJoint::updateLOD(F32 pixel_area, BOOL activate)
461{ 465{
462 BOOL lod_changed = FALSE; 466 BOOL lod_changed = FALSE;
463 BOOL found_lod = FALSE; 467 BOOL found_lod = FALSE;
464 468
465 for ( LLViewerJoint *joint = (LLViewerJoint*)mChildren.getFirstData(); 469 for (child_list_t::iterator iter = mChildren.begin();
466 joint != NULL; 470 iter != mChildren.end(); ++iter)
467 joint = (LLViewerJoint*)mChildren.getNextData() )
468 { 471 {
472 LLViewerJoint* joint = (LLViewerJoint*)(*iter);
469 F32 jointLOD = joint->getLOD(); 473 F32 jointLOD = joint->getLOD();
470 474
471 if (found_lod || jointLOD == DEFAULT_LOD) 475 if (found_lod || jointLOD == DEFAULT_LOD)
472 { 476 {
473 // we've already found a joint to enable, so enable the rest as alternatives 477 // we've already found a joint to enable, so enable the rest as alternatives
@@ -491,12 +495,12 @@ BOOL LLViewerJoint::updateLOD(F32 pixel_area, BOOL activate)
491 495
492void LLViewerJoint::dump() 496void LLViewerJoint::dump()
493{ 497{
494 for ( LLViewerJoint *joint = (LLViewerJoint*)mChildren.getFirstData(); 498 for (child_list_t::iterator iter = mChildren.begin();
495 joint != NULL; 499 iter != mChildren.end(); ++iter)
496 joint = (LLViewerJoint*)mChildren.getNextData() ) 500 {
497 { 501 LLViewerJoint* joint = (LLViewerJoint*)(*iter);
498 joint->dump(); 502 joint->dump();
499 } 503 }
500} 504}
501 505
502void LLViewerJoint::setVisible(BOOL visible, BOOL recursive) 506void LLViewerJoint::setVisible(BOOL visible, BOOL recursive)
@@ -505,12 +509,12 @@ void LLViewerJoint::setVisible(BOOL visible, BOOL recursive)
505 509
506 if (recursive) 510 if (recursive)
507 { 511 {
508 for ( LLViewerJoint *joint = (LLViewerJoint*)mChildren.getFirstData(); 512 for (child_list_t::iterator iter = mChildren.begin();
509 joint != NULL; 513 iter != mChildren.end(); ++iter)
510 joint = (LLViewerJoint*)mChildren.getNextData() ) 514 {
511 { 515 LLViewerJoint* joint = (LLViewerJoint*)(*iter);
512 joint->setVisible(visible, recursive); 516 joint->setVisible(visible, recursive);
513 } 517 }
514 } 518 }
515} 519}
516 520
@@ -530,10 +534,10 @@ void LLViewerJoint::writeCAL3D(apr_file_t* fp)
530 LLQuaternion bone_rot; 534 LLQuaternion bone_rot;
531 535
532 S32 num_children = 0; 536 S32 num_children = 0;
533 for (LLViewerJoint *joint = (LLViewerJoint*)mChildren.getFirstData(); 537 for (child_list_t::iterator iter = mChildren.begin();
534 joint != NULL; 538 iter != mChildren.end(); ++iter)
535 joint = (LLViewerJoint*)mChildren.getNextData() )
536 { 539 {
540 LLViewerJoint* joint = (LLViewerJoint*)(*iter);
537 if (joint->mJointNum != -1) 541 if (joint->mJointNum != -1)
538 { 542 {
539 num_children++; 543 num_children++;
@@ -560,10 +564,10 @@ void LLViewerJoint::writeCAL3D(apr_file_t* fp)
560 apr_file_printf(fp, " <LOCALROTATION>0 0 0 1</LOCALROTATION>\n"); 564 apr_file_printf(fp, " <LOCALROTATION>0 0 0 1</LOCALROTATION>\n");
561 apr_file_printf(fp, " <PARENTID>%d</PARENTID>\n", mParent ? mParent->mJointNum + 1 : -1); 565 apr_file_printf(fp, " <PARENTID>%d</PARENTID>\n", mParent ? mParent->mJointNum + 1 : -1);
562 566
563 for (LLViewerJoint *joint = (LLViewerJoint*)mChildren.getFirstData(); 567 for (child_list_t::iterator iter = mChildren.begin();
564 joint != NULL; 568 iter != mChildren.end(); ++iter)
565 joint = (LLViewerJoint*)mChildren.getNextData() )
566 { 569 {
570 LLViewerJoint* joint = (LLViewerJoint*)(*iter);
567 if (joint->mJointNum != -1) 571 if (joint->mJointNum != -1)
568 { 572 {
569 apr_file_printf(fp, " <CHILDID>%d</CHILDID>\n", joint->mJointNum + 1); 573 apr_file_printf(fp, " <CHILDID>%d</CHILDID>\n", joint->mJointNum + 1);
@@ -572,10 +576,10 @@ void LLViewerJoint::writeCAL3D(apr_file_t* fp)
572 apr_file_printf(fp, " </BONE>\n"); 576 apr_file_printf(fp, " </BONE>\n");
573 577
574 // recurse 578 // recurse
575 for (LLViewerJoint *joint = (LLViewerJoint*)mChildren.getFirstData(); 579 for (child_list_t::iterator iter = mChildren.begin();
576 joint != NULL; 580 iter != mChildren.end(); ++iter)
577 joint = (LLViewerJoint*)mChildren.getNextData() )
578 { 581 {
582 LLViewerJoint* joint = (LLViewerJoint*)(*iter);
579 if (joint->mJointNum != -1) 583 if (joint->mJointNum != -1)
580 { 584 {
581 joint->writeCAL3D(fp); 585 joint->writeCAL3D(fp);