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

Method GetLodIndexForScreenSize

trinity/Resources/TriGeometryRes.cpp:357–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355}
356
357int TriGeometryRes::GetLodIndexForScreenSize( unsigned int meshIx, float screenSize ) const
358{
359 auto mesh = GetMeshData( meshIx );
360
361 if( !mesh )
362 {
363 return -1;
364 }
365
366 int32_t lastLod = static_cast<int32_t>( mesh->m_lods.size() ) - 1;
367 if( m_forceLod && m_forcedLodIndex >= 0 )
368 {
369 return int( std::min( m_forcedLodIndex, lastLod ) );
370 }
371
372 for( int32_t i = lastLod; i >= 0; i-- )
373 {
374 if( mesh->m_lods[i]->m_maxScreenSize >= screenSize )
375 {
376 return i;
377 }
378 }
379 //If we end up here, it's because we requested a LOD size larger than the best one we have.
380 //Just return the highest quality LOD in this case.
381 return 0;
382}
383
384const AudioGeometryResData* TriGeometryRes::GetAudioGeometry( unsigned int meshIx ) const
385{

Callers 3

UpdateRtMeshMethod · 0.80
GetLastUsedMeshLodMethod · 0.80
GetRenderablesMethod · 0.80

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected