| 954 | } |
| 955 | |
| 956 | void Viewer::launchEventLoop() |
| 957 | { |
| 958 | if ( !isLaunched_ ) |
| 959 | { |
| 960 | spdlog::error( "Viewer is not launched!" ); |
| 961 | return; |
| 962 | } |
| 963 | |
| 964 | spdlog::info( "Launching event loop" ); |
| 965 | |
| 966 | // Rendering loop |
| 967 | while ( !windowShouldClose() ) |
| 968 | { |
| 969 | do |
| 970 | { |
| 971 | draw( true ); |
| 972 | glfwPollEvents(); |
| 973 | if ( eventQueue_ ) |
| 974 | eventQueue_->execute(); |
| 975 | if ( spaceMouseHandler_ ) |
| 976 | spaceMouseHandler_->handle(); |
| 977 | CommandLoop::processCommands(); |
| 978 | } while ( ( !( window && glfwWindowShouldClose( window ) ) && !stopEventLoop_ ) && ( forceRedrawFrames_ > 0 || needRedraw_() ) ); |
| 979 | |
| 980 | if ( isAnimating ) |
| 981 | { |
| 982 | const double minDuration = 1.0 / double( animationMaxFps ); |
| 983 | glfwWaitEventsTimeout( minDuration ); |
| 984 | if ( eventQueue_ ) |
| 985 | eventQueue_->execute(); |
| 986 | } |
| 987 | else |
| 988 | { |
| 989 | glfwWaitEvents(); |
| 990 | if ( eventQueue_ ) |
| 991 | eventQueue_->execute(); |
| 992 | } |
| 993 | if ( spaceMouseHandler_ ) |
| 994 | spaceMouseHandler_->handle(); |
| 995 | } |
| 996 | } |
| 997 | |
| 998 | void Viewer::launchShut() |
| 999 | { |