| 773 | } |
| 774 | |
| 775 | void Tr2SkinnedObject::SetLOD( const TriFrustum* frustum ) |
| 776 | { |
| 777 | if( !frustum ) |
| 778 | { |
| 779 | return; |
| 780 | } |
| 781 | |
| 782 | Vector4 boundingSphere; |
| 783 | if( GetBoundingSphere( boundingSphere ) && frustum->IsSphereVisible( &boundingSphere, true ) ) |
| 784 | { |
| 785 | const float estimate = frustum->GetPixelSizeAccross( &boundingSphere ); |
| 786 | if( estimate >= 0.0f && estimate < 1000000.0f ) // block off any remaining silliness |
| 787 | { |
| 788 | m_estimatedPixelDiameter = estimate; |
| 789 | } |
| 790 | } |
| 791 | |
| 792 | Tr2SkinnedModel* model = m_lod.SetLOD( frustum, m_estimatedPixelDiameter ); |
| 793 | |
| 794 | // lod change? |
| 795 | if( model && model != m_visualModel ) // don't just compare lod numbers, actual model of a given lod might change as well (dynamic builders) |
| 796 | { |
| 797 | m_visualModel = model; |
| 798 | |
| 799 | // this invalidates the rig-bindings, cause we switched to a new skeleton and therefore have to rebuild |
| 800 | m_skinningMatrixCount = 0; |
| 801 | |
| 802 | // the skeleton is only posed during Update; make sure we don't render a frame with a model in the |
| 803 | // restpose, by posing it right now. |
| 804 | UpdateBones( m_lastUpdateTime, NULL ); |
| 805 | } |
| 806 | } |
| 807 | |
| 808 | AxisAlignedBoundingBox Tr2SkinnedObject::GetBoundingBoxInLocalSpace() const |
| 809 | { |
nothing calls this directly
no test coverage detected