diff --git a/apps/opencs/view/render/scenewidget.cpp b/apps/opencs/view/render/scenewidget.cpp index 6136abb40..208a7a5b7 100644 --- a/apps/opencs/view/render/scenewidget.cpp +++ b/apps/opencs/view/render/scenewidget.cpp @@ -95,6 +95,7 @@ void RenderWidget::setVisibilityMask(int mask) // -------------------------------------------------- CompositeViewer::CompositeViewer() + : mSimulationTime(0.0) { #if QT_VERSION >= 0x050000 // Qt5 is currently crashing and reporting "Cannot make QOpenGLContext current in a different thread" when the viewer is run multi-threaded, this is regression from Qt4 @@ -124,7 +125,9 @@ CompositeViewer &CompositeViewer::get() void CompositeViewer::update() { - frame(); + mSimulationTime += mFrameTimer.time_s(); + mFrameTimer.setStartTick(); + frame(mSimulationTime); } // --------------------------------------------------- diff --git a/apps/opencs/view/render/scenewidget.hpp b/apps/opencs/view/render/scenewidget.hpp index 58c376418..c269f355d 100644 --- a/apps/opencs/view/render/scenewidget.hpp +++ b/apps/opencs/view/render/scenewidget.hpp @@ -100,6 +100,10 @@ namespace CSVRender QTimer mTimer; + private: + osg::Timer mFrameTimer; + double mSimulationTime; + public slots: void update(); };