From 13eb012a0457237a662be1280fc9c41b53db85cb Mon Sep 17 00:00:00 2001 From: Joakim Kilby Date: Wed, 24 Jun 2015 17:51:32 +0200 Subject: [PATCH] added a current run time variable for the openspace engine + get/set method. run time is set in preSync from SGCT runtime at the moment --- apps/OpenSpace/main.cpp | 1 + include/openspace/engine/openspaceengine.h | 3 +++ src/engine/openspaceengine.cpp | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index 0edbe2edc9..92a18417ff 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -201,6 +201,7 @@ void mainInitFunc() { } void mainPreSyncFunc() { + OsEng.setRunTime(sgct::Engine::getTime()); OsEng.preSynchronization(); } diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h index 98ba179966..a2160a7194 100644 --- a/include/openspace/engine/openspaceengine.h +++ b/include/openspace/engine/openspaceengine.h @@ -71,6 +71,8 @@ public: bool initialize(); bool isMaster(); void setMaster(bool master); + double runTime(); + void setRunTime(double t); static bool findConfiguration(std::string& filename); // Guaranteed to return a valid pointer @@ -131,6 +133,7 @@ private: gui::GUI* _gui; network::ParallelConnection* _parallelConnection; bool _isMaster; + double _runTime; SyncBuffer* _syncBuffer; }; diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 00568fec65..b7cc428445 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -110,6 +110,7 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName) , _moduleEngine(new ModuleEngine) , _gui(new gui::GUI) , _isMaster(false) + , _runTime(0.0) , _syncBuffer(nullptr) , _parallelConnection(new network::ParallelConnection) { @@ -586,7 +587,15 @@ bool OpenSpaceEngine::isMaster(){ void OpenSpaceEngine::setMaster(bool master){ _isMaster = master; } + +double OpenSpaceEngine::runTime(){ + return _runTime; +} +void OpenSpaceEngine::setRunTime(double d){ + _runTime = d; +} + void OpenSpaceEngine::preSynchronization() { FileSys.triggerFilesystemEvents(); if (_isMaster) {