MCPcopy Create free account
hub / github.com/carbonengine/trinity / UpdateVisibility

Method UpdateVisibility

trinity/Eve/SpaceObject/EveSpaceObject2.cpp:1601–1740  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1599}
1600
1601void 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() )

Callers

nothing calls this directly

Calls 15

GetBoneListFunction · 0.85
GetBoundingSphereFunction · 0.85
GetFrustumMethod · 0.80
GetLowDetailThresholdMethod · 0.80
GetLodFactorMethod · 0.80
IsSphereVisibleMethod · 0.80
emptyMethod · 0.80
GetObserverMethod · 0.80
UseWithScreenSizeMethod · 0.80

Tested by

no test coverage detected