ENH: Improve Viewer Simulation control
(1) `SimulationManager::startSimulation()` will check if a Viewer is already rendering, and will only start a rendering/interaction loop in the main thread if it isn't. This allows us to work with two possible cases: (a) a QT Application with an existing widget for rendering, in which case we do not want to control the rendering window ourself in a loop (b) a standalone `vtkRenderWindow` application, in which case we do want to create a window when our simulation starts and loop until the window is closed. (2) `SimulationManager::startSimulation()` can be launched with a debug boolean option (off by default), which will allow to not automatically simulate the dynamics of the scene, to be able to interact with the scene beforehand (using the mouse). (3) `imstk::InteractorStyle` is based on vtkInteractorStyle specifically the trackballCamera and allows to ignore mouse events in simulation mode, and uses key events to control the simulation: 's' : start simulation 'e' : end simulation ' ' (space) : pause/run simulation (4) The `Viewer` class and the `InteractorStyle` class have been moved to the `SimulationManager` module, since they are more drivers of the application themselves. (5) The 'Sandbox' example has been refactored to make it easier to test autonomous tests, and updated to use the new driver architecture brought with this commit.
Showing
- Base/Rendering/imstkRenderer.cpp 15 additions, 11 deletionsBase/Rendering/imstkRenderer.cpp
- Base/Rendering/imstkRenderer.h 1 addition, 1 deletionBase/Rendering/imstkRenderer.h
- Base/Scene/imstkScene.cpp 0 additions, 1 deletionBase/Scene/imstkScene.cpp
- Base/SimulationManager/imstkInteractorStyle.cpp 272 additions, 0 deletionsBase/SimulationManager/imstkInteractorStyle.cpp
- Base/SimulationManager/imstkInteractorStyle.h 60 additions, 0 deletionsBase/SimulationManager/imstkInteractorStyle.h
- Base/SimulationManager/imstkSimulationManager.cpp 61 additions, 58 deletionsBase/SimulationManager/imstkSimulationManager.cpp
- Base/SimulationManager/imstkSimulationManager.h 7 additions, 10 deletionsBase/SimulationManager/imstkSimulationManager.h
- Base/SimulationManager/imstkViewer.cpp 24 additions, 12 deletionsBase/SimulationManager/imstkViewer.cpp
- Base/SimulationManager/imstkViewer.h 15 additions, 4 deletionsBase/SimulationManager/imstkViewer.h
- Examples/Sandbox/main.cpp 132 additions, 123 deletionsExamples/Sandbox/main.cpp
Loading
Please register or sign in to comment