Skip to content
Snippets Groups Projects
Commit 835e68c9 authored by Alexis Girault's avatar Alexis Girault
Browse files

ENH: Render on timer event from window interactor

1) Create a timer on the renderWindowInteractor
2) Render() in 'InteractorStyle::OnTimer()'
parent 0581754a
No related branches found
No related tags found
No related merge requests found
......@@ -31,9 +31,23 @@
#include "vtkAssemblyPath.h"
#include "vtkAbstractPropPicker.h"
vtkStandardNewMacro(imstk::InteractorStyle);
namespace imstk {
vtkStandardNewMacro(InteractorStyle);
void
InteractorStyle::OnTimer()
{
if (m_simManager->getStatus() == SimulationStatus::INACTIVE)
{
return;
}
// Render
this->CurrentRenderer->ResetCameraClippingRange();
this->Interactor->Render();
}
void
InteractorStyle::OnChar()
{
......
......@@ -37,6 +37,7 @@ public:
static InteractorStyle *New();
vtkTypeMacro(InteractorStyle, vtkBaseInteractorStyle);
virtual void OnTimer() override;
virtual void OnChar() override;
virtual void OnMouseMove() override;
virtual void OnLeftButtonDown() override;
......
......@@ -108,7 +108,10 @@ void
Viewer::startRenderingLoop()
{
m_running = true;
m_vtkRenderWindow->GetInteractor()->Initialize();
m_vtkRenderWindow->GetInteractor()->CreateRepeatingTimer(1000.0/60);
m_vtkRenderWindow->GetInteractor()->Start();
m_vtkRenderWindow->GetInteractor()->DestroyTimer();
m_running = false;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment