MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / mainLoopFunc_

Method mainLoopFunc_

source/MRViewer/MRViewer.cpp:586–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

584#endif
585
586void Viewer::mainLoopFunc_()
587{
588#ifdef MR_EMSCRIPTEN_ASYNCIFY
589 for (;;)
590 {
591 if ( isAnimating )
592 {
593 const double minDuration = 1e3 / double( animationMaxFps );
594 emscripten_sleep( std::max( int( minDuration ), minEmsSleep ) );
595 }
596 else if ( !isAnimating && eventQueue_ && eventQueue_->empty() )
597 {
598 emscripten_sleep( minEmsSleep ); // more than 300 fps possible
599 continue;
600 }
601
602 do
603 {
604 draw( true );
605 if ( eventQueue_ )
606 eventQueue_->execute();
607 CommandLoop::processCommands();
608 } while ( forceRedrawFrames_ > 0 || needRedraw_() );
609 }
610#else
611 emscripten_set_main_loop( emsMainInfiniteLoop, 0, true );
612#endif
613}
614#endif
615
616int Viewer::launch( const LaunchParams& params )

Callers

nothing calls this directly

Calls 3

maxFunction · 0.85
executeMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected