| 1599 | } |
| 1600 | |
| 1601 | void EveSpaceObject2::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform ) |
| 1602 | { |
| 1603 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 1604 | |
| 1605 | m_isVisible = false; |
| 1606 | m_isMeshVisible = false; |
| 1607 | |
| 1608 | if( !m_display ) |
| 1609 | { |
| 1610 | return; |
| 1611 | } |
| 1612 | m_lodLevel = TR2_LOD_LOW; |
| 1613 | m_lodLevelWithChildren = TR2_LOD_LOW; |
| 1614 | m_impostorMode = false; |
| 1615 | auto& frustum = updateContext.GetFrustum(); |
| 1616 | auto minLodThreshold = updateContext.GetLowDetailThreshold(); |
| 1617 | auto mediumLodThreshold = updateContext.GetMediumDetailThreshold(); |
| 1618 | auto invLodFactor = updateContext.GetLodFactor(); |
| 1619 | |
| 1620 | if( m_boundingSphereRadius > 0.0f ) |
| 1621 | { |
| 1622 | if( frustum.IsSphereVisible( m_boundingSphereWorldCenter, m_boundingSphereWorldRadius ) ) |
| 1623 | { |
| 1624 | EstimatePixelDiameter( frustum ); |
| 1625 | m_isMeshVisible = true; |
| 1626 | } |
| 1627 | } |
| 1628 | |
| 1629 | if( !m_attachments.empty() ) |
| 1630 | { |
| 1631 | size_t boneCount = 0; |
| 1632 | const Float4x3* bones = nullptr; |
| 1633 | Tr2GrannyAnimationUtils::GetBoneList( m_animationUpdater, bones, boneCount ); |
| 1634 | |
| 1635 | for( auto it = begin( m_attachments ); it != end( m_attachments ); ++it ) |
| 1636 | { |
| 1637 | if( ( *it )->UpdateVisibility( updateContext, m_worldTransform, bones, boneCount ) ) |
| 1638 | { |
| 1639 | m_isMeshVisible = true; |
| 1640 | m_isVisible = true; |
| 1641 | } |
| 1642 | } |
| 1643 | } |
| 1644 | |
| 1645 | Vector4 bounds; |
| 1646 | if( DisplayChildren() ) |
| 1647 | { |
| 1648 | for( IEveTransformVector::const_iterator it = m_children.begin(); it != m_children.end(); ++it ) |
| 1649 | { |
| 1650 | IEveTransform* p = *it; |
| 1651 | p->UpdateVisibility( updateContext, m_worldTransform ); |
| 1652 | } |
| 1653 | } |
| 1654 | if( GetBoundingSphere( bounds, EVE_BOUNDS_WITH_CHILDREN ) ) |
| 1655 | { |
| 1656 | m_isInFrustum = frustum.IsSphereVisible( &bounds ); |
| 1657 | m_estimatedPixelDiameterWithChildren = frustum.GetPixelSizeAccrossEst( &bounds ); |
| 1658 | if( m_isInFrustum && m_estimatedPixelDiameterWithChildren >= updateContext.GetVisibilityThreshold() ) |
nothing calls this directly
no test coverage detected