| 440 | } |
| 441 | |
| 442 | void TSShapeInstance::render( const TSRenderState &rdata ) |
| 443 | { |
| 444 | if (mCurrentDetailLevel<0) |
| 445 | return; |
| 446 | |
| 447 | PROFILE_SCOPE( TSShapeInstance_Render ); |
| 448 | |
| 449 | // alphaIn: we start to alpha-in next detail level when intraDL > 1-alphaIn-alphaOut |
| 450 | // (finishing when intraDL = 1-alphaOut) |
| 451 | // alphaOut: start to alpha-out this detail level when intraDL > 1-alphaOut |
| 452 | // NOTE: |
| 453 | // intraDL is at 1 when if shape were any closer to us we'd be at dl-1, |
| 454 | // intraDL is at 0 when if shape were any farther away we'd be at dl+1 |
| 455 | F32 alphaOut = mShape->alphaOut[mCurrentDetailLevel]; |
| 456 | F32 alphaIn = mShape->alphaIn[mCurrentDetailLevel]; |
| 457 | F32 saveAA = mAlphaAlways ? mAlphaAlwaysValue : 1.0f; |
| 458 | |
| 459 | /// This first case is the single detail level render. |
| 460 | if ( mCurrentIntraDetailLevel > alphaIn + alphaOut ) |
| 461 | render( rdata, mCurrentDetailLevel, mCurrentIntraDetailLevel ); |
| 462 | else if ( mCurrentIntraDetailLevel > alphaOut ) |
| 463 | { |
| 464 | // draw this detail level w/ alpha=1 and next detail level w/ |
| 465 | // alpha=1-(intraDl-alphaOut)/alphaIn |
| 466 | |
| 467 | // first draw next detail level |
| 468 | if ( mCurrentDetailLevel + 1 < mShape->details.size() && mShape->details[ mCurrentDetailLevel + 1 ].size > 0.0f ) |
| 469 | { |
| 470 | setAlphaAlways( saveAA * ( alphaIn + alphaOut - mCurrentIntraDetailLevel ) / alphaIn ); |
| 471 | render( rdata, mCurrentDetailLevel + 1, 0.0f ); |
| 472 | } |
| 473 | |
| 474 | setAlphaAlways( saveAA ); |
| 475 | render( rdata, mCurrentDetailLevel, mCurrentIntraDetailLevel ); |
| 476 | } |
| 477 | else |
| 478 | { |
| 479 | // draw next detail level w/ alpha=1 and this detail level w/ |
| 480 | // alpha = 1-intraDL/alphaOut |
| 481 | |
| 482 | // first draw next detail level |
| 483 | if ( mCurrentDetailLevel + 1 < mShape->details.size() && mShape->details[ mCurrentDetailLevel + 1 ].size > 0.0f ) |
| 484 | render( rdata, mCurrentDetailLevel+1, 0.0f ); |
| 485 | |
| 486 | setAlphaAlways( saveAA * mCurrentIntraDetailLevel / alphaOut ); |
| 487 | render( rdata, mCurrentDetailLevel, mCurrentIntraDetailLevel ); |
| 488 | setAlphaAlways( saveAA ); |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | void TSShapeInstance::setMeshForceHidden( const char *meshName, bool hidden ) |
| 493 | { |
nothing calls this directly
no test coverage detected