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

Method UpdateVisibility

trinity/Eve/EveTransform.cpp:281–347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281void 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

Callers 7

GatherBatchesMethod · 0.45
Render3DUIMethod · 0.45
UpdateZOnlyVisibilityMethod · 0.45
RunQueryMethod · 0.45

Calls 11

GetBoundingSphereFunction · 0.85
GetFrustumMethod · 0.80
IsSphereVisibleMethod · 0.80
GetPixelSizeAccrossMethod · 0.80
UseWithScreenSizeMethod · 0.80
GetLowDetailThresholdMethod · 0.80
emptyMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
GetLODLevelMethod · 0.45

Tested by

no test coverage detected