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

Method Update

trinity/Controllers/Tr2Controller.cpp:231–271  ·  view source on GitHub ↗

param normalizedUpdateFrequency : value [0:1] on how freqeuntly the controller should be updating

Source from the content-addressed store, hash-verified

229
230// param normalizedUpdateFrequency : value [0:1] on how freqeuntly the controller should be updating
231void Tr2Controller::Update( float normalizedUpdateFrequency )
232{
233 if( !m_isActive )
234 {
235 return;
236 }
237
238 if( EveThrottleable::ShouldSkipUpdate( normalizedUpdateFrequency ) )
239 {
240 return;
241 }
242
243
244 auto currentTime = BeOS->GetActualTime();
245
246 {
247 CCP_STATS_INC( controllerUpdateCount );
248 CCP_STATS_SCOPED_TIME( controllerUpdateTime );
249
250 auto dirtyVariables = m_dirtyVariables;
251 m_dirtyVariables = 0;
252
253 for( auto it = begin( m_stateMachines ); it != end( m_stateMachines ); ++it )
254 {
255 ( *it )->Update( dirtyVariables );
256 }
257 if( !m_updateables.empty() )
258 {
259 CCP_STATS_SCOPED_TIME( controllerUpdateablesTime );
260
261 auto simTime = BeOS->GetCurrentFrameTime();
262
263 for( auto& u : m_updateables )
264 {
265 ContinueOnMainThread( [updatable = ITr2UpdateablePtr( u ), currentTime, simTime]() {
266 updatable->Update( currentTime, simTime );
267 } );
268 }
269 }
270 }
271}
272
273void Tr2Controller::SetVariable( const char* name, float value )
274{

Callers

nothing calls this directly

Calls 4

ContinueOnMainThreadFunction · 0.85
emptyMethod · 0.80
beginFunction · 0.50
endFunction · 0.50

Tested by

no test coverage detected