iMSTK
Interactive Medical Simulation Toolkit
|
Wraps a vtkRenderer. More...
#include <imstkVTKRenderer.h>
Public Member Functions | |
VTKRenderer (std::shared_ptr< Scene > scene, const bool enableVR) | |
Scene is tied to this renderer. | |
void | initialize () override |
Create the rendering delegates and related VTK objects according to the scene. More... | |
void | setMode (const Mode mode, const bool enableVR) override |
Set the rendering mode to display debug actors or not. | |
void | setTimeTable (const std::unordered_map< std::string, double > &timeTable) override |
Sets the benchmarking table using unordered_map. | |
void | updateCamera () |
Updates the camera. | |
void | updateRenderDelegates () |
Updates the render delegates. | |
vtkSmartPointer< vtkRenderer > | getVtkRenderer () const |
Returns VTK renderer. | |
void | updateBackground (const Vec3d color1, const Vec3d color2=Vec3d::Zero(), const bool gradientBackground=false) |
Update background colors. | |
void | setDebugActorsVisible (const bool debugActorsVisible) |
bool | getDebugActorsVisible () const |
void | setTimeTableVisibility (const bool visible) override |
Get/Set the visibility of the benchmark graph. | |
bool | getTimeTableVisibility () const override |
![]() | |
bool | getIsInitialized () const |
virtual const Renderer::Mode & | getMode () const |
Get rendering mode. | |
std::shared_ptr< RendererConfig > | getRenderConfig () const |
Get the render config. | |
![]() | |
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 Types | |
using | VtkLightPair = std::pair< std::shared_ptr< Light >, vtkSmartPointer< vtkLight > > |
Protected Member Functions | |
void | removeActors (const std::vector< vtkSmartPointer< vtkProp >> &actorList) |
Remove actors (also called props) from the scene. | |
void | addActors (const std::vector< vtkSmartPointer< vtkProp >> &actorList) |
Add actors (also called props) from the scene. | |
void | setConfig (std::shared_ptr< RendererConfig > config) override |
Apply configuration changes. | |
void | addEntity (std::shared_ptr< Entity > sceneObject) |
Adds an entity to be rendered. | |
std::unordered_set< std::shared_ptr< Entity > >::iterator | removeEntity (std::shared_ptr< Entity > sceneObject) |
Removes a SceneObject to be rendered. | |
void | sceneModifed (Event *e) |
Callback for when the scene this renderer renders is modified This involves adding/removing scene objects to render lists. | |
void | addVisualModel (std::shared_ptr< Entity > sceneObject, std::shared_ptr< VisualModel > visualModel) |
Add a VisualModel to be rendered, creates a delegate for it. | |
std::unordered_set< std::shared_ptr< VisualModel > >::iterator | removeVisualModel (std::shared_ptr< Entity > sceneObject, std::shared_ptr< VisualModel > visualModel) |
Remove a VisualModel from rendering. | |
void | entityModified (Event *e) |
Callback for when a SceneObject is modified This involves adding/removing visual models to render lists. | |
void | entityModified (std::shared_ptr< Entity > sceneObject) |
Function call for processing diffs on a SceneObject. | |
Protected Attributes | |
vtkSmartPointer< vtkRenderer > | m_vtkRenderer |
vtkSmartPointer< vtkCamera > | m_camera |
std::vector< VtkLightPair > | m_vtkLights |
std::vector< vtkSmartPointer< vtkProp > > | m_objectVtkActors |
std::vector< vtkSmartPointer< vtkProp > > | m_debugVtkActors |
std::shared_ptr< Scene > | m_scene |
std::unordered_set< std::shared_ptr< Entity > > | m_renderedObjects |
std::unordered_map< std::shared_ptr< Entity >, std::unordered_set< std::shared_ptr< VisualModel > > > | m_renderedVisualModels |
std::unordered_map< std::shared_ptr< VisualModel >, std::shared_ptr< VTKRenderDelegate > > | m_renderDelegates |
std::shared_ptr< TextureManager< VTKTextureDelegate > > | m_textureManager |
vtkSmartPointer< vtkChartXY > | m_timeTableChart |
vtkSmartPointer< vtkContextActor > | m_timeTableChartActor |
vtkSmartPointer< vtkTable > | m_timeTable |
vtkPlotBar * | m_timeTablePlot |
int | m_timeTableIter = 0 |
vtkSmartPointer< vtkSSAOPass > | m_ssaoPass |
vtkSmartPointer< vtkRenderStepsPass > | m_renderStepsPass |
bool | m_debugActorsVisible |
![]() | |
bool | m_VrEnabled = false |
bool | m_isInitialized = false |
Renderer::Mode | m_currentMode = Renderer::Mode::Simulation |
std::shared_ptr< RendererConfig > | m_config |
![]() | |
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 |
Additional Inherited Members | |
![]() | |
enum | Mode { Empty, Debug, Simulation } |
Enumerations for the render mode. | |
![]() | |
using | Observer = std::tuple< bool, std::weak_ptr< EventObject >, std::function< void(Event *)> > |
Wraps a vtkRenderer.
Definition at line 44 of file imstkVTKRenderer.h.
|
overridevirtual |
Create the rendering delegates and related VTK objects according to the scene.
TODO : only on deformable objects with UseBounds (need vtk update)
Implements imstk::Renderer.
Definition at line 66 of file imstkVTKRenderer.cpp.