Merge remote-tracking branch 'origin/master' into feature/launcherconfigs

# Conflicts:
#	ext/sgct
#	openspace.cfg
This commit is contained in:
Matthew Territo
2017-05-12 15:40:06 -06:00
663 changed files with 19692 additions and 12831 deletions
+24 -16
View File
@@ -25,11 +25,10 @@
#ifndef __OPENSPACE_CORE___CONFIGURATIONMANAGER___H__
#define __OPENSPACE_CORE___CONFIGURATIONMANAGER___H__
#include <openspace/documentation/documentation.h>
#include <ghoul/misc/dictionary.h>
namespace openspace {
namespace documentation { struct Documentation; }
/**
* The ConfigurationManager takes care of loading the major configuration file
@@ -69,6 +68,8 @@ public:
static const std::string KeyFactoryDocumentation;
/// The key that stores the location of the scene file that is initially loaded
static const std::string KeyConfigScene;
/// The key that stores the location of the tasks file that is initially loaded
static const std::string KeyConfigTask;
/// The key that stores the subdirectory containing a list of all startup scripts to
/// be executed on application start before the scene file is loaded
static const std::string KeyStartupScript;
@@ -105,6 +106,8 @@ public:
/// The key that stores whether the master node should perform rendering just function
/// as a pure manager
static const std::string KeyDisableMasterRendering;
/// The key that stores whether the master node should apply the scene transformation
static const std::string KeyDisableSceneOnMaster;
/// The key that sets the request URL that is used to request additional data to be
/// downloaded
static const std::string KeyDownloadRequestURL;
@@ -125,7 +128,22 @@ public:
static const std::string PartHttpProxyUser;
/// The key that stores the password to use for authentication to access the http proxy
static const std::string PartHttpProxyPassword;
/// The key that stores the dictionary containing information about debug contexts
static const std::string KeyOpenGLDebugContext;
/// The part of the key storing whether an OpenGL Debug context should be created
static const std::string PartActivate;
/// The part of the key storing whether the debug callbacks are performed synchronous
static const std::string PartSynchronous;
/// The part of the key storing a list of identifiers that should be filtered out
static const std::string PartFilterIdentifier;
/// The part of the key that stores the source of the ignored identifier
static const std::string PartFilterIdentifierSource;
/// The part of the key that stores the type of the ignored identifier
static const std::string PartFilterIdentifierType;
/// The part of the key that stores the identifier of the ignored identifier
static const std::string PartFilterIdentifierIdentifier;
/// The part of the key storing a list of severities that should be filtered out
static const std::string PartFilterSeverity;
/**
* Iteratively walks the directory structure starting with \p filename to find the
@@ -144,27 +162,17 @@ public:
* that are specified in the configuration file will automatically be registered in
* the ghoul::filesystem::FileSystem.
* \param filename The filename to be loaded
* \throw ghoul::FileNotFoundException If the \p filename did not exist
* \throw ghoul::RuntimeError If the configuration file was not complete (i.e., did
* \throw SpecificationError If the configuration file was not complete (i.e., did
* not specify the necessary keys KeyPaths, KeyPaths.KeyCache, KeyFonts, and
* KeyConfigSgct)
* \throw ghoul::lua::LuaRuntimeException If there was Lua-based error loading the
* configuration file
* \pre \p filename must not be empty
* \pre \p filename must exist
*/
void loadFromFile(const std::string& filename);
static openspace::Documentation Documentation();
private:
/**
* Checks whether the loaded configuration file is complete, that is specifying the
* necessary keys KeyPaths, KeyPaths.KeyCache, KeyFonts, and KeyConfigSgct. The method
* will log fatal errors if a key is missing.
* \return <code>true</code> if the configuration file was complete;
* <code>false</code> otherwise
*/
bool checkCompleteness() const;
static documentation::Documentation Documentation();
};
} // namespace openspace
+19 -6
View File
@@ -28,12 +28,16 @@
#include <memory>
namespace ghoul {
class Dictionary;
namespace logging { class Log; }
}
} // namespace ghoul
namespace openspace {
namespace documentation { struct Documentation; }
/**
* This function provides the capabilities to create a new ghoul::logging::Log from the
* provided ghoul::Dictionary%. The Dictionary must at least contain a <code>Type</code>
@@ -44,15 +48,24 @@ namespace openspace {
* created . Both logs can be customized using the <code>Append</code>,
* <code>TimeStamping</code>, <code>DateStamping</code>, <code>CategoryStamping</code>,
* and <code>LogLevelStamping</code> values.
* \param dictionary The dictionary from which the ghoul::logging::Log should be created
*
* \param dictionary The dictionary from which the ghoul::logging::Log should be created
* \return The created ghoul::logging::Log
* \post The return value will not be <code>nullptr</code>
* \throw ghoul::RuntimeError If there was an error creating the ghoul::logging::Log
* \sa ghoul::logging::TextLeg
* \sa ghoul::logging::HTMLLog
* \post The return value will not be <code>nullptr</code>
* \throw ghoul::RuntimeError If there was an error creating the ghoul::logging::Log
* \sa ghoul::logging::TextLog
* \sa ghoul::logging::HTMLLog
*/
std::unique_ptr<ghoul::logging::Log> createLog(const ghoul::Dictionary& dictionary);
/**
* Returns the Documentation that describes a Dictionary used to create a log by using the
* function createLog.
* \return The Documentation that describes an acceptable Dictionary for the method
* createLog
*/
documentation::Documentation LogFactoryDocumentation();
} // namespace openspace
#endif // __OPENSPACE_CORE___LOGFACTORY___H__
+13 -5
View File
@@ -25,14 +25,23 @@
#ifndef __OPENSPACE_CORE___MODULEENGINE___H__
#define __OPENSPACE_CORE___MODULEENGINE___H__
#include <openspace/util/openspacemodule.h>
#include <openspace/scripting/scriptengine.h>
#include <memory>
#include <vector>
#include <openspace/util/openspacemodule.h>
namespace ghoul {
namespace systemcapabilities {
struct Version;
} // namespace systemcapabilities
} // namespace ghoul
namespace openspace {
namespace scripting { struct LuaLibrary; }
/**
* The ModuleEngine is the central repository for registering and accessing
* OpenSpaceModule for the current application run. By initializing (#initialize) the
@@ -80,8 +89,7 @@ public:
* version of all registered modules' OpenGL versions.
* \return The combined minimum OpenGL version
*/
ghoul::systemcapabilities::OpenGLCapabilitiesComponent::Version
requiredOpenGLVersion() const;
ghoul::systemcapabilities::Version requiredOpenGLVersion() const;
/**
* Returns the Lua library that contains all Lua functions available to affect the
+82 -102
View File
@@ -36,71 +36,60 @@
#include <vector>
namespace ghoul {
class Dictionary;
namespace cmdparser { class CommandlineParser; }
namespace fontrendering { class FontManager; }
}
} // namespace ghoul
namespace openspace {
class ConfigurationManager;
class DownloadManager;
class LuaConsole;
class NetworkEngine;
class GUI;
class RenderEngine;
class LuaConsole;
class ModuleEngine;
class WindowWrapper;
class SettingsEngine;
class TimeManager;
class SyncEngine;
class NetworkEngine;
class ParallelConnection;
class RenderEngine;
class SettingsEngine;
class SceneManager;
class VirtualPropertyManager;
class SyncEngine;
class TimeManager;
class WindowWrapper;
namespace interaction { class InteractionHandler; }
namespace gui { class GUI; }
//namespace scripting { class ScriptEngine; }
namespace properties { class PropertyOwner; }
namespace scripting { struct LuaLibrary; }
namespace scripting { class ScriptScheduler; }
namespace scripting { class ScriptEngine; }
namespace scripting {
struct LuaLibrary;
class ScriptEngine;
class ScriptScheduler;
} // namespace scripting
class OpenSpaceEngine {
public:
static bool create(int argc, char** argv,
static void create(int argc, char** argv,
std::unique_ptr<WindowWrapper> windowWrapper,
std::vector<std::string>& sgctArguments);
std::vector<std::string>& sgctArguments, bool& requestClose);
static void destroy();
static bool isInitialized();
static OpenSpaceEngine& ref();
bool isMaster();
void setMaster(bool master);
double runTime();
void setRunTime(double t);
// Guaranteed to return a valid pointer
ConfigurationManager& configurationManager();
interaction::InteractionHandler& interactionHandler();
RenderEngine& renderEngine();
scripting::ScriptEngine& scriptEngine();
scripting::ScriptScheduler& scriptScheduler();
NetworkEngine& networkEngine();
LuaConsole& console();
ModuleEngine& moduleEngine();
ParallelConnection& parallelConnection();
properties::PropertyOwner& globalPropertyOwner();
WindowWrapper& windowWrapper();
ghoul::fontrendering::FontManager& fontManager();
DownloadManager& downloadManager();
TimeManager& timeManager();
SettingsEngine& settingsEngine();
// SGCT callbacks
bool initialize();
bool initializeGL();
// callbacks
void initialize();
void initializeGL();
void deinitialize();
void preSynchronization();
void postSynchronizationPreDraw();
void render(const glm::mat4& projectionMatrix, const glm::mat4& viewMatrix);
void render(const glm::mat4& sceneMatrix, const glm::mat4& viewMatrix,
const glm::mat4& projectionMatrix);
void postDraw();
void keyboardCallback(Key key, KeyModifier mod, KeyAction action);
void charCallback(unsigned int codepoint, KeyModifier mod);
@@ -111,21 +100,36 @@ public:
void encode();
void decode();
void scheduleLoadScene(std::string scenePath);
void enableBarrier();
void disableBarrier();
void writeDocumentation();
void toggleShutdownMode();
bool useBusyWaitForDecode();
bool logSGCTOutOfOrderErrors();
void runPostInitializationScripts(const std::string& sceneDescription);
// Guaranteed to return a valid pointer
ConfigurationManager& configurationManager();
LuaConsole& console();
DownloadManager& downloadManager();
ModuleEngine& moduleEngine();
NetworkEngine& networkEngine();
ParallelConnection& parallelConnection();
RenderEngine& renderEngine();
SettingsEngine& settingsEngine();
TimeManager& timeManager();
WindowWrapper& windowWrapper();
ghoul::fontrendering::FontManager& fontManager();
interaction::InteractionHandler& interactionHandler();
properties::PropertyOwner& globalPropertyOwner();
scripting::ScriptEngine& scriptEngine();
scripting::ScriptScheduler& scriptScheduler();
VirtualPropertyManager& virtualPropertyManager();
// This method is only to be called from Modules
enum class CallbackOption {
Initialize = 0, // Callback for the end of the initialization
Deinitialize, // Callback for the end of the deinitialization
@@ -138,34 +142,7 @@ public:
};
// Registers a callback for a specific CallbackOption
void registerModuleCallback(CallbackOption option, std::function<void()> function) {
switch (option) {
case CallbackOption::Initialize:
_moduleCallbacks.initialize.push_back(std::move(function));
break;
case CallbackOption::Deinitialize:
_moduleCallbacks.deinitialize.push_back(std::move(function));
break;
case CallbackOption::InitializeGL:
_moduleCallbacks.initializeGL.push_back(std::move(function));
break;
case CallbackOption::DeinitializeGL:
_moduleCallbacks.deinitializeGL.push_back(std::move(function));
break;
case CallbackOption::PreSync:
_moduleCallbacks.preSync.push_back(std::move(function));
break;
case CallbackOption::PostSyncPreDraw:
_moduleCallbacks.postSyncPreDraw.push_back(std::move(function));
break;
case CallbackOption::Render:
_moduleCallbacks.render.push_back(std::move(function));
break;
case CallbackOption::PostDraw:
_moduleCallbacks.postDraw.push_back(std::move(function));
break;
}
}
void registerModuleCallback(CallbackOption option, std::function<void()> function);
// Registers a callback that is called when a new keyboard event is received
void registerModuleKeyboardCallback(
@@ -187,43 +164,47 @@ public:
void registerModuleMouseScrollWheelCallback(std::function<bool (double)> function);
/**
* Returns the Lua library that contains all Lua functions available to affect the
* application.
*/
* Returns the Lua library that contains all Lua functions available to affect the
* application.
*/
static scripting::LuaLibrary luaLibrary();
private:
OpenSpaceEngine(std::string programName, std::unique_ptr<WindowWrapper> windowWrapper);
~OpenSpaceEngine();
OpenSpaceEngine(std::string programName,
std::unique_ptr<WindowWrapper> windowWrapper);
void clearAllWindows();
void loadScene(const std::string& scenePath);
void gatherCommandlineArguments();
void loadFonts();
void runScripts(const ghoul::Dictionary& scripts);
void runPreInitializationScripts(const std::string& sceneDescription);
void configureLogging();
// Components
std::unique_ptr<ConfigurationManager> _configurationManager;
std::unique_ptr<interaction::InteractionHandler> _interactionHandler;
std::unique_ptr<RenderEngine> _renderEngine;
std::unique_ptr<scripting::ScriptEngine> _scriptEngine;
std::unique_ptr<scripting::ScriptScheduler> _scriptScheduler;
std::unique_ptr<NetworkEngine> _networkEngine;
std::unique_ptr<SyncEngine> _syncEngine;
std::unique_ptr<ghoul::cmdparser::CommandlineParser> _commandlineParser;
std::unique_ptr<SceneManager> _sceneManager;
std::unique_ptr<DownloadManager> _downloadManager;
std::unique_ptr<LuaConsole> _console;
std::unique_ptr<ModuleEngine> _moduleEngine;
std::unique_ptr<SettingsEngine> _settingsEngine;
std::unique_ptr<TimeManager> _timeManager;
std::unique_ptr<DownloadManager> _downloadManager;
std::unique_ptr<NetworkEngine> _networkEngine;
std::unique_ptr<ParallelConnection> _parallelConnection;
std::unique_ptr<RenderEngine> _renderEngine;
std::unique_ptr<SettingsEngine> _settingsEngine;
std::unique_ptr<SyncEngine> _syncEngine;
std::unique_ptr<TimeManager> _timeManager;
std::unique_ptr<WindowWrapper> _windowWrapper;
std::unique_ptr<ghoul::cmdparser::CommandlineParser> _commandlineParser;
std::unique_ptr<ghoul::fontrendering::FontManager> _fontManager;
std::unique_ptr<interaction::InteractionHandler> _interactionHandler;
std::unique_ptr<scripting::ScriptEngine> _scriptEngine;
std::unique_ptr<scripting::ScriptScheduler> _scriptScheduler;
std::unique_ptr<VirtualPropertyManager> _virtualPropertyManager;
// Others
std::unique_ptr<properties::PropertyOwner> _globalPropertyNamespace;
bool _scheduledSceneSwitch;
std::string _scenePath;
struct {
std::vector<std::function<void()>> initialize;
std::vector<std::function<void()>> deinitialize;
@@ -242,25 +223,24 @@ private:
std::vector<std::function<bool (MouseButton, MouseAction)>> mouseButton;
std::vector<std::function<void (double, double)>> mousePosition;
std::vector<std::function<bool (double)>> mouseScrollWheel;
} _moduleCallbacks;
bool _isMaster;
double _runTime;
// Whether the application is currently in shutdown mode (i.e. counting down the timer
// and closing it at '0'
bool _isInShutdownMode;
// The total amount of time the application will wait before actually shutting down
float _shutdownWait;
// The current state of the countdown; if it reaches '0', the application will close
float _shutdownCountdown;
// Structure that is responsible for the delayed shutdown of the application
struct {
// Whether the application is currently in shutdown mode (i.e. counting down the
// timer and closing it at '0'
bool inShutdown;
// Total amount of time the application will wait before actually shutting down
float waitTime;
// Current state of the countdown; if it reaches '0', the application will
// close
float timer;
} _shutdown;
// The first frame might take some more time in the update loop, so we need to know to
// disable the synchronization; otherwise a hardware sync will kill us after 1 sec
// disable the synchronization; otherwise a hardware sync will kill us after 1 minute
bool _isFirstRenderingFirstFrame;
static OpenSpaceEngine* _engine;
+1 -11
View File
@@ -43,28 +43,18 @@ public:
void initialize();
void setModules(std::vector<OpenSpaceModule*> modules);
void setModules(const std::vector<OpenSpaceModule*>& modules);
bool busyWaitForDecode();
bool logSGCTOutOfOrderErrors();
bool useDoubleBuffering();
private:
void initEyeSeparation();
void initSceneFiles();
void initShowFrameNumber();
void initBusyWaitForDecode();
void initLogSGCTOutOfOrderErrors();
void initUseDoubleBuffering();
properties::FloatProperty _eyeSeparation;
properties::OptionProperty _scenes;
properties::BoolProperty _showFrameNumber;
properties::BoolProperty _busyWaitForDecode;
properties::BoolProperty _logSGCTOutOfOrderErrors;
properties::BoolProperty _useDoubleBuffering;
properties::BoolProperty _spiceUseExceptions;
};
} // namespace openspace
+43 -36
View File
@@ -25,80 +25,87 @@
#ifndef __OPENSPACE_CORE___SYNCENGINE___H__
#define __OPENSPACE_CORE___SYNCENGINE___H__
#include <openspace/util/syncbuffer.h>
#include <ghoul/misc/boolean.h>
#include <vector>
#include <memory>
namespace openspace {
class Syncable;
class SyncBuffer;
/**
* Manages a collection of <code>Syncable</code>s and ensures they are synchronized
* over SGCT nodes. Encoding/Decoding order is handles internally.
*/
* Manages a collection of <code>Syncable</code>s and ensures they are synchronized
* over SGCT nodes. Encoding/Decoding order is handles internally.
*/
class SyncEngine {
public:
using IsMaster = ghoul::Boolean;
/**
* Dependency injection: a SyncEngine relies on a SyncBuffer to encode the sync data.
*/
SyncEngine(SyncBuffer* syncBuffer);
* Creates a new SyncEngine which a buffer size of \p syncBufferSize
* \pre syncBufferSize must be bigger than 0
*/
SyncEngine(unsigned int syncBufferSize);
/**
* Encodes all added Syncables in the injected <code>SyncBuffer</code>.
* This method is only called on the SGCT master node
*/
* Encodes all added Syncables in the injected <code>SyncBuffer</code>.
* This method is only called on the SGCT master node
*/
void encodeSyncables();
/**
* Decodes the <code>SyncBuffer</code> into the added Syncables.
* This method is only called on the SGCT slave nodes
*/
* Decodes the <code>SyncBuffer</code> into the added Syncables.
* This method is only called on the SGCT slave nodes
*/
void decodeSyncables();
/**
* Invokes the presync method of all added Syncables
*/
void presync(bool isMaster);
* Invokes the presync method of all added Syncables
*/
void preSynchronization(IsMaster isMaster);
/**
* Invokes the postsync method of all added Syncables
*/
void postsync(bool isMaster);
* Invokes the postsync method of all added Syncables
*/
void postSynchronization(IsMaster isMaster);
/**
* Add a Syncable to be synchronized over the SGCT cluster
*/
* Add a Syncable to be synchronized over the SGCT cluster.
* \pre syncable must not be nullptr
*/
void addSyncable(Syncable* syncable);
/**
* Add multiple Syncables to be synchronized over the SGCT cluster
*/
* Add multiple Syncables to be synchronized over the SGCT cluster
* \pre syncables must not contain any nullptr
*/
void addSyncables(const std::vector<Syncable*>& syncables);
/**
* Remove a Syncable from being synchronized over the SGCT cluster
*/
* Remove a Syncable from being synchronized over the SGCT cluster
*/
void removeSyncable(Syncable* syncable);
private:
/**
* Vector of Syncables. The vectors ensures consistent encode/decode order
/**
* Remove multiple Syncables from being synchronized over the SGCT cluster
*/
void removeSyncables(const std::vector<Syncable*>& syncables);
private:
/**
* Vector of Syncables. The vectors ensures consistent encode/decode order
*/
std::vector<Syncable*> _syncables;
/**
* Databuffer used in encoding/decoding
*/
std::unique_ptr<SyncBuffer> _syncBuffer;
* Databuffer used in encoding/decoding
*/
SyncBuffer _syncBuffer;
};
} // namespace openspace
#endif // __OPENSPACE_CORE___SYNCENGINE___H__
@@ -0,0 +1,50 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___VIRTUALPROPERTYMANAGER___H__
#define __OPENSPACE_CORE___VIRTUALPROPERTYMANAGER___H__
#include <openspace/properties/propertyowner.h>
#include <openspace/properties/property.h>
#include <memory>
#include <vector>
namespace openspace {
class VirtualPropertyManager : public properties::PropertyOwner {
public:
VirtualPropertyManager();
void addProperty(std::unique_ptr<properties::Property> prop);
void removeProperty(properties::Property* prop);
private:
std::vector<std::unique_ptr<properties::Property>> _properties;
};
} // namespace openspace
#endif // __OPENSPACE_CORE___VIRTUALPROPERTYMANAGER___H__
@@ -27,6 +27,9 @@
#include <openspace/engine/wrapper/windowwrapper.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
namespace openspace {
/**
@@ -36,6 +39,8 @@ namespace openspace {
*/
class SGCTWindowWrapper : public WindowWrapper {
public:
SGCTWindowWrapper();
void terminate() override;
void setBarrier(bool enabled) override;
void setSynchronization(bool enabled) override;
@@ -55,6 +60,7 @@ public:
bool isRegularRendering() const override;
bool hasGuiWindow() const override;
bool isGuiWindow() const override;
bool isMaster() const override;
bool isUsingSwapGroups() const override;
bool isSwapGroupMaster() const override;
@@ -71,6 +77,10 @@ public:
bool isSimpleRendering() const override;
void takeScreenshot(bool applyWarping = false) const override;
private:
properties::FloatProperty _eyeSeparation;
properties::BoolProperty _showStatsGraph;
};
} // namespace openspace
@@ -25,6 +25,8 @@
#ifndef __OPENSPACE_CORE___WINDOWWRAPPER___H__
#define __OPENSPACE_CORE___WINDOWWRAPPER___H__
#include <openspace/properties/propertyowner.h>
#include <ghoul/glm.h>
#include <ghoul/misc/exception.h>
@@ -42,8 +44,11 @@ namespace scripting { struct LuaLibrary; }
* Every new windowing framework needs to have its own WindowWrapper subclass exposing the
* required features.
*/
class WindowWrapper {
class WindowWrapper : public properties::PropertyOwner {
public:
/// Default constructor
WindowWrapper();
/**
* Returns the Lua library that contains all Lua functions available to affect the
* windowing system.
@@ -175,6 +180,13 @@ public:
* \return Whether the current rendering window is GUI-only
*/
virtual bool isGuiWindow() const;
/**
* Returns <code>true</code> if this application is the master for a clustered
* environment.
* \return Whether this applicaiton is the master for a clustered environment.
*/
virtual bool isMaster() const;
/**
* Returns <code>true</code> if the current rendering window is using swap groups.