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

Method OnTick

trinity/Resources/Tr2TextureLodManager.cpp:64–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64void Tr2TextureLodManager::OnTick( Be::Time, Be::Time, void* )
65{
66 CCP_STATS_ZONE( __FUNCTION__ );
67
68 for( auto& it : m_textures )
69 {
70 it.first->UpdateLodRequest( it.second, *this );
71 if( it.second.mipChange == 0 )
72 {
73 it.second.frameNumber = 0;
74 }
75 }
76
77 std::sort( begin( m_textures ), end( m_textures ), []( const auto& a, const auto& b ) {
78 if( a.second.mipChange < b.second.mipChange )
79 {
80 return true;
81 }
82 if( a.second.mipChange == b.second.mipChange )
83 {
84 return a.second.frameNumber > b.second.frameNumber;
85 }
86
87 return false;
88 } );
89 uint32_t creates = 0;
90 uint32_t loads = 0;
91 for( auto& it : m_textures )
92 {
93 if( it.second.mipChange == 0 )
94 {
95 continue;
96 }
97 if( it.second.mipChange >= 0 && !NeedToTrimGpuTexture() )
98 {
99 break;
100 }
101 if( creates >= s_lodChanges && loads >= s_loadRequests )
102 {
103 break;
104 }
105 if( it.second.cachedInRam )
106 {
107 if( creates < s_lodChanges )
108 {
109 ++creates;
110 it.first->ProcessLodRequest( it.second, *this );
111 it.second.frameNumber = 0;
112 }
113 }
114 else
115 {
116 if( loads < s_loadRequests )
117 {
118 ++loads;
119 it.first->ProcessLodRequest( it.second, *this );
120 it.second.frameNumber = 0;
121 }

Callers

nothing calls this directly

Calls 4

UpdateLodRequestMethod · 0.80
ProcessLodRequestMethod · 0.80
beginFunction · 0.50
endFunction · 0.50

Tested by

no test coverage detected