| 279 | } |
| 280 | |
| 281 | void EveTransform::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform ) |
| 282 | { |
| 283 | m_lodLevel = TR2_LOD_LOW; |
| 284 | m_isVisible = false; |
| 285 | |
| 286 | if( m_hideOnLowQuality && Tr2Renderer::IsLowQuality() ) |
| 287 | { |
| 288 | return; |
| 289 | } |
| 290 | |
| 291 | if( !m_display ) |
| 292 | { |
| 293 | return; |
| 294 | } |
| 295 | |
| 296 | UpdateViewDependentData( updateContext.GetFrustum(), parentTransform ); |
| 297 | |
| 298 | if( m_mesh ) |
| 299 | { |
| 300 | Vector4 boundingSphere; |
| 301 | if( GetBoundingSphere( boundingSphere ) ) |
| 302 | { |
| 303 | // check visibility with camera or, if threshold set to negative, no culling |
| 304 | if( updateContext.GetFrustum().IsSphereVisible( &boundingSphere ) || ( m_visibilityThreshold < 0.f ) ) |
| 305 | { |
| 306 | float estimatedSize = updateContext.GetFrustum().GetPixelSizeAccross( &boundingSphere ); |
| 307 | |
| 308 | m_mesh->UseWithScreenSize( estimatedSize, boundingSphere.w ); |
| 309 | |
| 310 | if( estimatedSize >= updateContext.GetMediumDetailThreshold() ) |
| 311 | { |
| 312 | m_lodLevel = TR2_LOD_HIGH; |
| 313 | } |
| 314 | else if( estimatedSize >= updateContext.GetLowDetailThreshold() ) |
| 315 | { |
| 316 | m_lodLevel = TR2_LOD_MEDIUM; |
| 317 | } |
| 318 | |
| 319 | if( estimatedSize > m_visibilityThreshold ) |
| 320 | { |
| 321 | m_isVisible = true; |
| 322 | } |
| 323 | } |
| 324 | } |
| 325 | } |
| 326 | else |
| 327 | { |
| 328 | m_isVisible = true; |
| 329 | } |
| 330 | |
| 331 | if( !m_particleSystems.empty() ) |
| 332 | { |
| 333 | // Because bounding info is currently unreliable for particle systems |
| 334 | // we use LOD high. |
| 335 | // This is hopefully a temporary measure. <6. september, 2012, Logi> |
| 336 | m_lodLevel = TR2_LOD_HIGH; |
| 337 | } |
| 338 |
no test coverage detected