iMSTK
Interactive Medical Simulation Toolkit
|
Subclasses viewer for the VTK rendering back-end. More...
#include <imstkAbstractVTKViewer.h>
Public Types | |
enum | VTKLoggerMode { SHOW, MUTE, WRITE } |
![]() | |
enum | ExecutionType { SEQUENTIAL, PARALLEL, ADAPTIVE } |
Currently 3 execution types are provided. These inform the driver on how it should run. | |
![]() | |
using | Observer = std::tuple< bool, std::weak_ptr< EventObject >, std::function< void(Event *)> > |
Public Member Functions | |
Renderer::Mode | getRenderingMode () const override |
Get the current renderer mode. | |
vtkSmartPointer< vtkRenderWindow > | getVtkRenderWindow () const |
Get pointer to the vtkRenderWindow rendering. | |
void | setSize (const int width, const int height) override |
Set the render window size. | |
void | setWindowTitle (const std::string &title) override |
Set the render window title. | |
void | setUseVsync (const bool useVsync) override |
Set whether to vertical sync. Sync framerate to the refresh of the monitor. | |
virtual void | setBackgroundColors (const Color color1, const Color color2=Color(0.0, 0.0, 0.0), const bool gradientBackground=false) override |
Set the coloring of the screen background If 'gradientBackground' is false or not supplied color1 will fill the entire background. | |
void | processEvents () override |
Processes VTK events, includes OS events. | |
void | setVtkLoggerMode (VTKLoggerMode loggerMode) |
Set the logger mode. | |
std::shared_ptr< VTKRenderer > | getActiveVtkRenderer () const |
Retrieve the renderer associated with the current scene. | |
![]() | |
std::shared_ptr< Scene > | getActiveScene () const |
Get scene currently being rendered. | |
void | setDebugAxesLength (double x, double y, double z) |
Set the length of the debug axes. | |
virtual void | setActiveScene (std::shared_ptr< Scene > scene)=0 |
Set scene to be rendered. | |
virtual void | setRenderingMode (const Renderer::Mode mode)=0 |
Setup the current renderer to render what's needed based on the mode chosen. | |
void | setSize (Vec2i size) |
virtual const Vec2i | getSize () const |
std::shared_ptr< Renderer > | getActiveRenderer () const |
Retrieve the renderer associated with the current scene. | |
virtual void | setInfoLevel (const int level) |
Set the info level, usually means display framerates and other viewer related information. | |
int | getInfoLevel () const |
Get the current info level. | |
virtual const int | getInfoLevelCount () const |
Get the number of info levels for a viewer, varies on implementation. | |
std::shared_ptr< ScreenCaptureUtility > | getScreenCaptureUtility () const |
access screen shot utility | |
virtual std::shared_ptr< KeyboardDeviceClient > | getKeyboardDevice () const |
Returns the device that emits key events. | |
virtual std::shared_ptr< MouseDeviceClient > | getMouseDevice () const |
Returns the device that emits mouse events. | |
double | getVisualFps () const |
![]() | |
virtual const std::string | getTypeName () const =0 |
Returns collision detection type string name. | |
SIGNAL (Module, preUpdate) | |
Posted before updateModule is called. | |
SIGNAL (Module, postUpdate) | |
Posted after updateModule is called. | |
SIGNAL (Module, end) | |
Posted when module wants to end. | |
double | getDt () const |
Get/Set the time step. | |
void | setDt (const double dt) |
bool | getInit () const |
Get whether the module is initialized yet. | |
bool | getPaused () const |
Set/Get whether the module is currently paused. | |
void | setPaused (const bool paused) |
void | setMuteUpdateEvents (const bool mute) |
Set/Get whether the module should post pre/post update events. | |
bool | getMuteUpdateEvents () const |
ExecutionType | getExecutionType () const |
Set/Get the execution type (see imstk::ExecutionType) | |
void | setExecutionType (const ExecutionType type) |
void | setSleepDelay (const double ms) |
double | getSleepDelay () const |
void | pause () |
void | resume () |
void | init () |
void | update () |
void | uninit () |
![]() | |
template<typename T > | |
void | postEvent (const T &e) |
Emits the event Direct observers will be immediately called, in sync Queued observers will receive the Command in their queue for later execution, reciever must implement doEvent. | |
template<typename T > | |
void | queueEvent (const T &e) |
Queues event directly to this. | |
void | doEvent () |
Do an event, if none exists return. | |
void | doAllEvents () |
Do all the events in the event queue. | |
void | foreachEvent (std::function< void(Command cmd)> func) |
Thread safe loop over all event commands, one can implement a custom handler. | |
void | rforeachEvent (std::function< void(Command cmd)> func) |
thread safe reverse loop over all event commands, one can implement a custom handler | |
void | clearEvents () |
Removes all events from queue cleans up copies of the event. | |
Protected Member Functions | |
AbstractVTKViewer (std::string name) | |
bool | initModule () override |
void | uninitModule () override |
![]() | |
Viewer (std::string name) | |
void | updateFps () |
Called before render to push back and measure time. | |
void | updateModule () override |
Protected Attributes | |
vtkSmartPointer< vtkRenderWindow > | m_vtkRenderWindow |
vtkSmartPointer< vtkInteractorStyle > | m_vtkInteractorStyle |
vtkSmartPointer< vtkCallbackCommand > | exitCallback |
bool | m_useVsync = false |
![]() | |
std::unordered_map< std::shared_ptr< Scene >, std::shared_ptr< Renderer > > | m_rendererMap |
std::shared_ptr< Scene > | m_activeScene |
std::shared_ptr< Entity > | m_debugEntity |
std::shared_ptr< Camera > | m_debugCamera |
std::shared_ptr< ScreenCaptureUtility > | m_screenCapturer |
Screen shot utility. | |
std::shared_ptr< ViewerConfig > | m_config |
int | m_infoLevel = 0 |
Info level. | |
std::chrono::high_resolution_clock::time_point | m_pre |
time point pre-rendering | |
std::chrono::high_resolution_clock::time_point | m_post |
time point post-rendering | |
std::chrono::high_resolution_clock::time_point | m_lastFpsUpdate |
time point for last framerate display update | |
double | m_visualFps = 0.0 |
double | m_lastFps = 0.0 |
![]() | |
std::atomic< bool > | m_init = ATOMIC_VAR_INIT(false) |
std::atomic< bool > | m_paused = ATOMIC_VAR_INIT(false) |
double | m_dt = 0.0 |
ExecutionType | m_executionType = ExecutionType::PARALLEL |
bool | m_muteUpdateEvents = false |
double | m_sleepDelay = 0.0 |
![]() | |
ParallelUtils::SpinLock | eventQueueLock |
std::deque< Command > | eventQueue |
std::vector< std::pair< std::string, std::vector< Observer > > > | queuedObservers |
std::vector< std::pair< std::string, std::vector< Observer > > > | directObservers |
Subclasses viewer for the VTK rendering back-end.
Definition at line 27 of file imstkAbstractVTKViewer.h.