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

Method MergeLOD

trinity/Eve/EveLODHelper.cpp:12–35  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: First calculate the LOD based on the provided sphere and frustum, then "merge" it with lod0 --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

10// it with lod0
11// --------------------------------------------------------------------------------
12Tr2Lod EveLODHelper::MergeLOD( Tr2Lod lod0, const Vector4& sphere, const EveUpdateContext& updateContext )
13{
14 auto& frustum = updateContext.GetFrustum();
15
16 // only change something if this thing is actually visible
17 if( frustum.IsSphereVisible( &sphere ) )
18 {
19 Tr2Lod lod1 = TR2_LOD_LOW;
20
21 float estimatedSize = frustum.GetPixelSizeAccross( &sphere );
22 if( estimatedSize >= updateContext.GetMediumDetailThreshold() )
23 {
24 lod1 = TR2_LOD_HIGH;
25 }
26 else if( estimatedSize >= updateContext.GetLowDetailThreshold() )
27 {
28 lod1 = TR2_LOD_MEDIUM;
29 }
30
31 // ok, merge it!
32 return MergeLOD( lod0, lod1 );
33 }
34 return TR2_LOD_UNSPECIFIED;
35}

Callers

nothing calls this directly

Calls 5

GetFrustumMethod · 0.80
IsSphereVisibleMethod · 0.80
GetPixelSizeAccrossMethod · 0.80
GetLowDetailThresholdMethod · 0.80

Tested by

no test coverage detected