mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-28 07:59:37 -06:00
Solve conflict in scripts/common.lua
This commit is contained in:
@@ -26,13 +26,13 @@
|
||||
#define __CORE_REGISTRATION_H__
|
||||
|
||||
namespace openspace {
|
||||
namespace documentation {
|
||||
|
||||
class DocumentationEngine;
|
||||
namespace documentation { class DocumentationEngine; }
|
||||
namespace scripting { class ScriptEngine; }
|
||||
|
||||
void registerCoreClasses(documentation::DocumentationEngine& engine);
|
||||
void registerCoreClasses(scripting::ScriptEngine& engine);
|
||||
|
||||
} // namespace documentation
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __CORE_REGISTRATION_H__
|
||||
|
||||
@@ -69,11 +69,36 @@ struct TestResult {
|
||||
/// The Reason that caused this offense
|
||||
Reason reason;
|
||||
};
|
||||
|
||||
/**
|
||||
* A warning is some value that that does not exactly adhere to the specification, but
|
||||
* that also does not violate so badly to warrant an Offense. This, for example, could
|
||||
* be that a value is marked deprecated and should not be used anymore as the value
|
||||
* might be removed in a latter version.
|
||||
*/
|
||||
struct Warning {
|
||||
/**
|
||||
* The reason for the warning
|
||||
*/
|
||||
enum class Reason {
|
||||
Deprecated ///< The value is marked as deprecated and should not used
|
||||
};
|
||||
|
||||
/// The offending key that caused the Warning. In the case of a nested table,
|
||||
/// this value will be the fully qualified name of the key
|
||||
std::string offender;
|
||||
/// The Reason that caused this Warning
|
||||
Reason reason;
|
||||
};
|
||||
|
||||
|
||||
/// Is \c true if the TestResult is positive, \c false otherwise
|
||||
bool success;
|
||||
/// Contains a list of offenses that were found in the test. Is empty if
|
||||
/// TestResult::Success is \c true
|
||||
std::vector<Offense> offenses;
|
||||
/// Contains a list of warnings that were found in the test
|
||||
std::vector<Warning> warnings;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -665,6 +665,33 @@ struct AnnotationVerifier : public T {
|
||||
std::string annotation;
|
||||
};
|
||||
|
||||
/**
|
||||
* This Verifier is a marker that performs the same testing as the \c T parameter, but
|
||||
* also adds a warning to the test result informing the user of the deprecation.
|
||||
* Furthermore, the documentation will contain the word <code>(deprecated)</code> in
|
||||
* addition to the documentation returned by \c
|
||||
* \tparam T The Verifier that is to be marked deprecated
|
||||
*/
|
||||
template <typename T>
|
||||
struct DeprecatedVerifier : public T {
|
||||
/**
|
||||
* Tests the \p dictionary%s \p key using the Verifier \c T and adds a warning to the
|
||||
* TestResult informing the caller of the deprecation.
|
||||
* \param dictionary The ghoul::Dictionary whose \p key should be tested
|
||||
* \param key The key inside the \p dictionary that is to be tested
|
||||
* \return A TestResult that contains the results of the testing
|
||||
*/
|
||||
TestResult operator()(const ghoul::Dictionary& dictionary,
|
||||
const std::string& key) const override;
|
||||
|
||||
/**
|
||||
* Returns the documentation as reported by \c T and adds the word
|
||||
* <code>(deprecated)</code> to it.
|
||||
* \return The deprecated version of \c T%'s documentation
|
||||
*/
|
||||
std::string documentation() const override;
|
||||
};
|
||||
|
||||
/**
|
||||
* This Verifier can reference and apply other Documentation%s that have been registered
|
||||
* with a DocumentationEngine. The dependency is only resolved when the operator() is
|
||||
@@ -884,6 +911,18 @@ using StringAnnotationVerifier = AnnotationVerifier<StringVerifier>;
|
||||
/// <code>ghoul::Dictionary</code>
|
||||
using TableAnnotationVerifier = AnnotationVerifier<TableVerifier>;
|
||||
|
||||
/// A short-hand definition for a DeprecatedVerifier with a type check for \c bool
|
||||
using BoolDeprecatedVerifier = DeprecatedVerifier<BoolVerifier>;
|
||||
/// A short-hand definition for a DeprecatedVerifier with a type check for \c int
|
||||
using IntDeprecatedVerifier = DeprecatedVerifier<IntVerifier>;
|
||||
/// A short-hand definition for a DeprecatedVerifier with a type check for \c double
|
||||
using DoubleDeprecatedVerifier = DeprecatedVerifier<DoubleVerifier>;
|
||||
/// A short-hand definition for a DeprecatedVerifier with a type check for \c string
|
||||
using StringDeprecatedVerifier = DeprecatedVerifier<StringVerifier>;
|
||||
/// A short-hand definition for a DeprecatedVerifier with a type check for
|
||||
/// <code>ghoul::Dictionary</code>
|
||||
using TableDeprecatedVerifier = DeprecatedVerifier<TableVerifier>;
|
||||
|
||||
// Definitions of external templates that are instantiated in the cpp file
|
||||
// This cuts down the compilation times as almost all of the possible template types do
|
||||
// not need to be instantiated multiple times
|
||||
@@ -933,7 +972,30 @@ extern template struct AnnotationVerifier<IntVerifier>;
|
||||
extern template struct AnnotationVerifier<DoubleVerifier>;
|
||||
extern template struct AnnotationVerifier<StringVerifier>;
|
||||
extern template struct AnnotationVerifier<TableVerifier>;
|
||||
extern template struct AnnotationVerifier<BoolVector2Verifier>;
|
||||
extern template struct AnnotationVerifier<IntVector2Verifier>;
|
||||
extern template struct AnnotationVerifier<DoubleVector2Verifier>;
|
||||
extern template struct AnnotationVerifier<BoolVector3Verifier>;
|
||||
extern template struct AnnotationVerifier<IntVector3Verifier>;
|
||||
extern template struct AnnotationVerifier<DoubleVector3Verifier>;
|
||||
extern template struct AnnotationVerifier<BoolVector4Verifier>;
|
||||
extern template struct AnnotationVerifier<IntVector4Verifier>;
|
||||
extern template struct AnnotationVerifier<DoubleVector4Verifier>;
|
||||
|
||||
extern template struct DeprecatedVerifier<BoolVerifier>;
|
||||
extern template struct DeprecatedVerifier<IntVerifier>;
|
||||
extern template struct DeprecatedVerifier<DoubleVerifier>;
|
||||
extern template struct DeprecatedVerifier<StringVerifier>;
|
||||
extern template struct DeprecatedVerifier<TableVerifier>;
|
||||
extern template struct DeprecatedVerifier<BoolVector2Verifier>;
|
||||
extern template struct DeprecatedVerifier<IntVector2Verifier>;
|
||||
extern template struct DeprecatedVerifier<DoubleVector2Verifier>;
|
||||
extern template struct DeprecatedVerifier<BoolVector3Verifier>;
|
||||
extern template struct DeprecatedVerifier<IntVector3Verifier>;
|
||||
extern template struct DeprecatedVerifier<DoubleVector3Verifier>;
|
||||
extern template struct DeprecatedVerifier<BoolVector4Verifier>;
|
||||
extern template struct DeprecatedVerifier<IntVector4Verifier>;
|
||||
extern template struct DeprecatedVerifier<DoubleVector4Verifier>;
|
||||
|
||||
} // namespace documentation
|
||||
} // namespace openspace
|
||||
|
||||
@@ -50,7 +50,7 @@ TestResult TemplateVerifier<T>::operator()(const ghoul::Dictionary& dict,
|
||||
|
||||
template <typename T>
|
||||
std::string TemplateVerifier<T>::documentation() const {
|
||||
return "Type testing of '" + type() + "'";
|
||||
return "Value of type '" + type() + "'";
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -263,7 +263,7 @@ NotInRangeVerifier<T>::NotInRangeVerifier(typename T::Type lower, typename T::Ty
|
||||
|
||||
template <typename T>
|
||||
TestResult NotInRangeVerifier<T>::operator()(const ghoul::Dictionary& dict,
|
||||
const std::string& key) const {
|
||||
const std::string& key) const {
|
||||
TestResult res = T::operator()(dict, key);
|
||||
if (res.success) {
|
||||
typename T::Type val = dict.value<typename T::Type>(key);
|
||||
@@ -299,5 +299,19 @@ std::string AnnotationVerifier<T>::documentation() const {
|
||||
return annotation;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
TestResult DeprecatedVerifier<T>::operator()(const ghoul::Dictionary& dict,
|
||||
const std::string& key) const
|
||||
{
|
||||
TestResult res = T::operator()(dict, key);
|
||||
res.warnings.push_back(TestResult::Warning{ key, TestResult::Warning::Reason::Deprecated });
|
||||
return res;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string DeprecatedVerifier<T>::documentation() const {
|
||||
return T::documentation() + " (deprecated)";
|
||||
}
|
||||
|
||||
} // namespace documentation
|
||||
} // namespace openspace
|
||||
|
||||
@@ -106,6 +106,19 @@ public:
|
||||
/// The key that stores the switch for enabling/disabling the rendering on a master
|
||||
/// computer
|
||||
static const std::string KeyRenderingMethod;
|
||||
/// The key that stores the http proxy settings for the downloadmanager
|
||||
static const std::string KeyHttpProxy;
|
||||
/// The key that stores the address of the http proxy
|
||||
static const std::string PartHttpProxyAddress;
|
||||
/// The key that stores the port of the http proxy
|
||||
static const std::string PartHttpProxyPort;
|
||||
/// The key that stores the authentication method of the http proxy
|
||||
static const std::string PartHttpProxyAuthentication;
|
||||
/// The key that stores the username to use for authentication to access the http proxy
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* Iteratively walks the directory structure starting with \p filename to find the
|
||||
|
||||
@@ -28,17 +28,14 @@
|
||||
#include <openspace/util/keys.h>
|
||||
#include <openspace/util/mouse.h>
|
||||
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
#include <openspace/scripting/scriptscheduler.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace ghoul {
|
||||
class Dictionary;
|
||||
namespace cmdparser { class CommandlineParser; }
|
||||
namespace fontrendering { class FontManager; }
|
||||
}
|
||||
@@ -54,13 +51,17 @@ class RenderEngine;
|
||||
class ModuleEngine;
|
||||
class WindowWrapper;
|
||||
class SettingsEngine;
|
||||
class TimeManager;
|
||||
class SyncEngine;
|
||||
class ParallelConnection;
|
||||
|
||||
namespace interaction { class InteractionHandler; }
|
||||
namespace gui { class GUI; }
|
||||
//namespace scripting { class ScriptEngine; }
|
||||
namespace network { class ParallelConnection; }
|
||||
namespace properties { class PropertyOwner; }
|
||||
namespace scripting { struct LuaLibrary; }
|
||||
namespace scripting { class ScriptScheduler; }
|
||||
namespace scripting { class ScriptEngine; }
|
||||
|
||||
class OpenSpaceEngine {
|
||||
public:
|
||||
@@ -85,11 +86,12 @@ public:
|
||||
NetworkEngine& networkEngine();
|
||||
LuaConsole& console();
|
||||
ModuleEngine& moduleEngine();
|
||||
network::ParallelConnection& parallelConnection();
|
||||
ParallelConnection& parallelConnection();
|
||||
properties::PropertyOwner& globalPropertyOwner();
|
||||
WindowWrapper& windowWrapper();
|
||||
ghoul::fontrendering::FontManager& fontManager();
|
||||
DownloadManager& downloadManager();
|
||||
TimeManager& timeManager();
|
||||
|
||||
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
|
||||
gui::GUI& gui();
|
||||
@@ -114,6 +116,7 @@ public:
|
||||
void enableBarrier();
|
||||
void disableBarrier();
|
||||
|
||||
void writeDocumentation();
|
||||
void toggleShutdownMode();
|
||||
|
||||
bool useBusyWaitForDecode();
|
||||
@@ -132,7 +135,7 @@ private:
|
||||
~OpenSpaceEngine();
|
||||
|
||||
void clearAllWindows();
|
||||
bool gatherCommandlineArguments();
|
||||
void gatherCommandlineArguments();
|
||||
void loadFonts();
|
||||
void runScripts(const ghoul::Dictionary& scripts);
|
||||
void runPreInitializationScripts(const std::string& sceneDescription);
|
||||
@@ -150,11 +153,12 @@ private:
|
||||
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;
|
||||
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
|
||||
std::unique_ptr<gui::GUI> _gui;
|
||||
#endif
|
||||
std::unique_ptr<network::ParallelConnection> _parallelConnection;
|
||||
std::unique_ptr<ParallelConnection> _parallelConnection;
|
||||
std::unique_ptr<WindowWrapper> _windowWrapper;
|
||||
std::unique_ptr<ghoul::fontrendering::FontManager> _fontManager;
|
||||
|
||||
@@ -172,6 +176,10 @@ private:
|
||||
// The current state of the countdown; if it reaches '0', the application will close
|
||||
float _shutdownCountdown;
|
||||
|
||||
// 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
|
||||
bool _isFirstRenderingFirstFrame;
|
||||
|
||||
static OpenSpaceEngine* _engine;
|
||||
};
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ class SGCTWindowWrapper : public WindowWrapper {
|
||||
public:
|
||||
void terminate() override;
|
||||
void setBarrier(bool enabled) override;
|
||||
void setSynchronization(bool enabled) override;
|
||||
void clearAllWindows(const glm::vec4& clearColor) override;
|
||||
bool windowHasResized() const override;
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
|
||||
namespace openspace {
|
||||
|
||||
namespace scripting { struct LuaLibrary; }
|
||||
|
||||
/**
|
||||
* A WindowWrapper is a class that handles the abstraction between OpenSpace and a
|
||||
* specific window creation framework.<br>
|
||||
@@ -42,6 +44,12 @@ namespace openspace {
|
||||
*/
|
||||
class WindowWrapper {
|
||||
public:
|
||||
/**
|
||||
* Returns the Lua library that contains all Lua functions available to affect the
|
||||
* windowing system.
|
||||
*/
|
||||
static scripting::LuaLibrary luaLibrary();
|
||||
|
||||
/**
|
||||
* This method closes the application by calling the necessary terminate function of
|
||||
* the window management system
|
||||
@@ -55,6 +63,14 @@ public:
|
||||
* disables it
|
||||
*/
|
||||
virtual void setBarrier(bool enabled);
|
||||
|
||||
/**
|
||||
* This method enables or disables a framelock barrier. If the specific windowing
|
||||
* framework does not provide a framelock, this method defaults to a no-op.
|
||||
* \param enabled If <code>true</code> the framelock is enabled, <code>false</code>
|
||||
* disables it
|
||||
*/
|
||||
virtual void setSynchronization(bool enabled);
|
||||
|
||||
/**
|
||||
* This method clears all the rendering windows with the specified \p clearColor. In
|
||||
|
||||
@@ -47,113 +47,15 @@ class SceneGraphNode;
|
||||
namespace interaction {
|
||||
|
||||
|
||||
//#define USE_OLD_INTERACTIONHANDLER
|
||||
#ifdef USE_OLD_INTERACTIONHANDLER
|
||||
|
||||
class InteractionHandler : public properties::PropertyOwner {
|
||||
public:
|
||||
InteractionHandler();
|
||||
~InteractionHandler();
|
||||
|
||||
// Mutators
|
||||
void setKeyboardController(KeyboardController* controller);
|
||||
void setMouseController(MouseController* controller);
|
||||
void setFocusNode(SceneGraphNode* node);
|
||||
void setCamera(Camera* camera);
|
||||
void setInteractionSensitivity(float sensitivity);
|
||||
void resetKeyBindings();
|
||||
void setInvertRoll(bool invert);
|
||||
void setInvertRotation(bool invert);
|
||||
|
||||
void addController(Controller* controller);
|
||||
void addKeyframe(const network::datamessagestructures::PositionKeyframe &kf);
|
||||
void clearKeyframes();
|
||||
|
||||
void bindKey(Key key, KeyModifier modifier, std::string lua);
|
||||
|
||||
void lockControls();
|
||||
void unlockControls();
|
||||
|
||||
void update(double deltaTime);
|
||||
|
||||
// Accessors
|
||||
const SceneGraphNode* const focusNode() const;
|
||||
const Camera* const camera() const;
|
||||
double deltaTime() const;
|
||||
float interactionSensitivity() const;
|
||||
bool invertRoll() const;
|
||||
bool invertRotation() const;
|
||||
|
||||
/**
|
||||
* Returns the Lua library that contains all Lua functions available to affect the
|
||||
* interaction. The functions contained are
|
||||
* - openspace::luascriptfunctions::setOrigin
|
||||
* \return The Lua library that contains all Lua functions available to affect the
|
||||
* interaction
|
||||
*/
|
||||
static scripting::LuaLibrary luaLibrary();
|
||||
|
||||
|
||||
// Callback functions
|
||||
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);
|
||||
void mouseButtonCallback(MouseButton button, MouseAction action);
|
||||
void mousePositionCallback(double x, double y);
|
||||
void mouseScrollWheelCallback(double pos);
|
||||
|
||||
// Interaction functions
|
||||
void orbitDelta(const glm::quat& rotation);
|
||||
void orbit(const float &dx, const float &dy, const float &dz, const float &dist);
|
||||
void rotateDelta(const glm::quat& rotation);
|
||||
void distanceDelta(const PowerScaledScalar& distance, size_t iterations = 0);
|
||||
void lookAt(const glm::quat& rotation);
|
||||
void setRotation(const glm::quat& rotation);
|
||||
|
||||
|
||||
private:
|
||||
// Remove copy and move constructors
|
||||
InteractionHandler(const InteractionHandler&) = delete;
|
||||
InteractionHandler& operator=(const InteractionHandler&) = delete;
|
||||
InteractionHandler(InteractionHandler&&) = delete;
|
||||
InteractionHandler& operator=(InteractionHandler&&) = delete;
|
||||
|
||||
// Settings
|
||||
float _controllerSensitivity;
|
||||
bool _invertRoll;
|
||||
bool _invertRotation;
|
||||
|
||||
// Pointers to entities to affect
|
||||
Camera* _camera;
|
||||
SceneGraphNode* _focusNode;
|
||||
|
||||
// Cached data
|
||||
double _deltaTime;
|
||||
std::mutex _mutex;
|
||||
|
||||
//bool _validKeyLua;
|
||||
std::multimap<KeyWithModifier, std::string > _keyLua;
|
||||
|
||||
|
||||
KeyboardController* _keyboardController;
|
||||
MouseController* _mouseController;
|
||||
std::vector<Controller*> _controllers;
|
||||
|
||||
properties::StringProperty _origin;
|
||||
properties::StringProperty _coordinateSystem;
|
||||
|
||||
//remote controller
|
||||
std::vector<network::datamessagestructures::PositionKeyframe> _keyframes;
|
||||
double _currentKeyframeTime;
|
||||
std::mutex _keyframeMutex;
|
||||
};
|
||||
|
||||
#else // USE_OLD_INTERACTIONHANDLER
|
||||
|
||||
class InteractionHandler : public properties::PropertyOwner
|
||||
{
|
||||
public:
|
||||
InteractionHandler();
|
||||
~InteractionHandler();
|
||||
|
||||
void initialize();
|
||||
void deinitialize();
|
||||
|
||||
// Mutators
|
||||
void setFocusNode(SceneGraphNode* node);
|
||||
void setCamera(Camera* camera);
|
||||
@@ -165,9 +67,10 @@ public:
|
||||
|
||||
void resetKeyBindings();
|
||||
|
||||
void addKeyframe(const network::datamessagestructures::PositionKeyframe &kf);
|
||||
void addKeyframe(const datamessagestructures::CameraKeyframe &kf);
|
||||
void clearKeyframes();
|
||||
|
||||
void bindKeyLocal(Key key, KeyModifier modifier, std::string lua);
|
||||
void bindKey(Key key, KeyModifier modifier, std::string lua);
|
||||
void lockControls();
|
||||
void unlockControls();
|
||||
@@ -206,7 +109,7 @@ private:
|
||||
|
||||
bool _cameraUpdatedFromScript = false;
|
||||
|
||||
std::multimap<KeyWithModifier, std::string > _keyLua;
|
||||
std::multimap<KeyWithModifier, std::pair<std::string, bool>> _keyLua;
|
||||
|
||||
std::unique_ptr<InputState> _inputState;
|
||||
Camera* _camera;
|
||||
@@ -228,8 +131,6 @@ private:
|
||||
properties::FloatProperty _rapidness;
|
||||
};
|
||||
|
||||
#endif // USE_OLD_INTERACTIONHANDLER
|
||||
|
||||
} // namespace interaction
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
@@ -75,15 +75,16 @@ namespace interaction {
|
||||
void mouseScrollWheelCallback(double mouseScrollDelta);
|
||||
|
||||
// Mutators
|
||||
void addKeyframe(const network::datamessagestructures::PositionKeyframe &kf);
|
||||
void addKeyframe(const datamessagestructures::CameraKeyframe &kf);
|
||||
void clearKeyframes();
|
||||
void clearOldKeyframes();
|
||||
|
||||
// Accessors
|
||||
const std::list<std::pair<Key, KeyModifier> >& getPressedKeys() const;
|
||||
const std::list<MouseButton>& getPressedMouseButtons() const;
|
||||
glm::dvec2 getMousePosition() const;
|
||||
double getMouseScrollDelta() const;
|
||||
std::vector<network::datamessagestructures::PositionKeyframe>& getKeyFrames() const;
|
||||
const std::vector<datamessagestructures::CameraKeyframe>& keyframes() const;
|
||||
|
||||
bool isKeyPressed(std::pair<Key, KeyModifier> keyModPair) const;
|
||||
bool isKeyPressed(Key key) const;
|
||||
@@ -96,8 +97,7 @@ namespace interaction {
|
||||
double _mouseScrollDelta;
|
||||
|
||||
// Remote input via keyframes
|
||||
std::vector<network::datamessagestructures::PositionKeyframe> _keyframes;
|
||||
std::mutex _keyframeMutex;
|
||||
std::vector<datamessagestructures::CameraKeyframe> _keyframes;
|
||||
};
|
||||
|
||||
|
||||
@@ -192,6 +192,7 @@ public:
|
||||
virtual void updateCameraStateFromMouseStates(Camera& camera);
|
||||
|
||||
private:
|
||||
std::vector<datamessagestructures::CameraKeyframe> _keyframes;
|
||||
double _currentKeyframeTime;
|
||||
};
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#define LUACONSOLE_H
|
||||
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
#include <openspace/network/parallelconnection.h>
|
||||
|
||||
#include <openspace/util/keys.h>
|
||||
|
||||
@@ -50,12 +51,16 @@ public:
|
||||
|
||||
bool isVisible() const;
|
||||
void setVisible(bool visible);
|
||||
void toggleVisibility();
|
||||
bool isRemoteScripting() const;
|
||||
void setRemoteScripting(bool remoteScripting);
|
||||
|
||||
void toggleMode();
|
||||
|
||||
static scripting::LuaLibrary luaLibrary();
|
||||
|
||||
|
||||
private:
|
||||
void parallelConnectionChanged(const ParallelConnection::Status& status);
|
||||
void addToCommand(std::string c);
|
||||
std::string UnicodeToUTF8(unsigned int codepoint);
|
||||
|
||||
@@ -73,6 +78,7 @@ private:
|
||||
} _autoCompleteInfo;
|
||||
|
||||
bool _isVisible;
|
||||
bool _remoteScripting;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
146
include/openspace/mission/mission.h
Normal file
146
include/openspace/mission/mission.h
Normal file
@@ -0,0 +1,146 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* 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 __MISSION_H__
|
||||
#define __MISSION_H__
|
||||
|
||||
#include <openspace/documentation/documentation.h>
|
||||
#include <openspace/util/timerange.h>
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace ghoul { class Dictionary; }
|
||||
|
||||
namespace openspace {
|
||||
|
||||
/**
|
||||
* Used to represent a named period of time within a mission. Allows nested phases, i.e.
|
||||
* phases within phases. Designed for WORM usage (Write Once, Read Multiple), and,
|
||||
* therefore, has only accessors.
|
||||
*
|
||||
* Each MissionPhase is characterized by its MissionPhase::name, a TimeRange, an
|
||||
* optional MissionPhase::description, and optional subphases.
|
||||
*/
|
||||
class MissionPhase {
|
||||
public:
|
||||
/**
|
||||
* Constructs a MissionPhase from the information provided in the \p dictionary. See
|
||||
* the MissionPhase::Documentation for accepted ghoul::Dictionary values.
|
||||
* \param dictionary The ghoul::Dictionary that contains information about the current
|
||||
* MissionPhase
|
||||
* \throw SpecificationError If the \p dictionary does not adhere to the Documentation
|
||||
* \throw RuntimeError If the time range of subphases is smaller than the specified
|
||||
* time range
|
||||
* \throw RuntimeError If neither subphases or a time range is specified
|
||||
*/
|
||||
MissionPhase(const ghoul::Dictionary& dictionary);
|
||||
|
||||
/**
|
||||
* Returns the name of the MissionPhase.
|
||||
* \return The name of the MissionPhase
|
||||
*/
|
||||
const std::string& name() const;
|
||||
|
||||
/**
|
||||
* Returns the TimeRange of the MissionPhase.
|
||||
* \return The TimeRange of the MissionPhase
|
||||
*/
|
||||
const TimeRange& timeRange() const;
|
||||
|
||||
/**
|
||||
* Returns the description of the MissionPhase.
|
||||
* \return The description of the MissionPhase
|
||||
*/
|
||||
const std::string& description() const;
|
||||
|
||||
/**
|
||||
* Returns all subphases sorted by start time.
|
||||
* \return All subphases sorted by start time
|
||||
*/
|
||||
const std::vector<MissionPhase>& phases() const;
|
||||
|
||||
|
||||
using Trace = std::vector<std::reference_wrapper<const MissionPhase>>;
|
||||
|
||||
/**
|
||||
* Returns all MissionPhase%s whose MissionPhase::timeRange includes the provided
|
||||
* \p time, up to a maximum subphase depth of \p maxDepth.
|
||||
* \param time The time in which the subphases have to be active in order to be
|
||||
* included
|
||||
* \param maxDepth The maximum levels of subphases that will be considered. If this
|
||||
* value is equal to <code>-1</code>, an infinite depth will be considered.
|
||||
* \return A list of MissionPhases that cover the provided \p time
|
||||
*/
|
||||
Trace phaseTrace(double time, int maxDepth = -1) const;
|
||||
|
||||
/**
|
||||
* Returns the Documentation that describes the ghoul::Dictionarty that this
|
||||
* MissionPhase can be constructed from.
|
||||
* \return The Documentation that describes the required structure for a Dictionary
|
||||
*/
|
||||
static openspace::Documentation Documentation();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Recursive function that walks the subphases and adds the MissionPhase%s that cover
|
||||
* the provided \p time and adds these to the list of \p trace%s. Each recursive call
|
||||
* will decrease the \p maxDepth counter until it reaches 0.
|
||||
* \param time The time which the subphases have to cover to be added to the \p trace
|
||||
* \param trace The list of MissionPhase%s that are active during the time \p time
|
||||
* \param maxDepth The maximum depth of levels that will be considered
|
||||
*/
|
||||
void phaseTrace(double time, Trace& trace, int maxDepth) const;
|
||||
|
||||
/// The name of the MissionPhase
|
||||
std::string _name;
|
||||
/// The description of the MissionPhase
|
||||
std::string _description;
|
||||
/// The range in time that is covered by this MissionPhase
|
||||
TimeRange _timeRange;
|
||||
/// A list of subphases into which this MissionPhase is separated
|
||||
std::vector<MissionPhase> _subphases;
|
||||
};
|
||||
|
||||
/**
|
||||
* A Mission is a list of MissionPhases that has a name, an optional description, a
|
||||
* TimeRange for which the Mission is active, and a potential list of subphases.
|
||||
*/
|
||||
using Mission = MissionPhase;
|
||||
|
||||
/**
|
||||
* This function constructs a Mission from the provided \p filename. The file must be a
|
||||
* Lua table that describes the Mission according to MissionPhase::Documentation
|
||||
* \param filename The file that is used to create the Mission
|
||||
* \return The constructed Mission
|
||||
* \pre \p filename must not be empty
|
||||
* \pre \p filename must not contain tokens
|
||||
* \pre \p filename must exist
|
||||
*/
|
||||
Mission missionFromFile(std::string filename);
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __MISSION_H__
|
||||
99
include/openspace/mission/missionmanager.h
Normal file
99
include/openspace/mission/missionmanager.h
Normal file
@@ -0,0 +1,99 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* 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 __MISSIONMANAGER_H__
|
||||
#define __MISSIONMANAGER_H__
|
||||
|
||||
#include <openspace/mission/mission.h>
|
||||
|
||||
#include <ghoul/designpattern/singleton.h>
|
||||
#include <ghoul/misc/exception.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
namespace scripting { struct LuaLibrary; }
|
||||
|
||||
/**
|
||||
* Singleton class keeping track of space missions.
|
||||
*/
|
||||
class MissionManager : public ghoul::Singleton<MissionManager> {
|
||||
public:
|
||||
struct MissionManagerException : public ghoul::RuntimeError {
|
||||
explicit MissionManagerException(std::string error);
|
||||
};
|
||||
|
||||
MissionManager();
|
||||
|
||||
/**
|
||||
* Reads a mission from file and maps the mission name to the Mission object. If
|
||||
* this is the first mission to be loaded, the mission will also be set as the
|
||||
* current active mission.
|
||||
* \pre \p filename must not be empty
|
||||
* \pre \p filename must not contain tokens
|
||||
* \pre \p filename must exist
|
||||
*/
|
||||
void loadMission(const std::string& filename);
|
||||
|
||||
/**
|
||||
* Returns whether the provided \p missionName has previously been added to the
|
||||
* MissionManager.
|
||||
* \param missionName The name of the mission that is to be tested
|
||||
* \return \c true if the \p missionName has been added before
|
||||
*/
|
||||
bool hasMission(const std::string& missionName);
|
||||
|
||||
/**
|
||||
* Sets the mission with the name <missionName> as the current mission. The current
|
||||
* mission is what is return by `currentMission()`.
|
||||
* \pre missionName must not be empty
|
||||
*/
|
||||
void setCurrentMission(const std::string& missionName);
|
||||
|
||||
/**
|
||||
* Returns true if a current mission exists
|
||||
*/
|
||||
bool hasCurrentMission() const;
|
||||
|
||||
/**
|
||||
* Returns the latest mission specified to `setCurrentMission()`. If no mission has
|
||||
* been specified, the first mission loaded will be returned. If no mission has been
|
||||
* loaded, a warning will be printed and a dummy mission will be returned.
|
||||
*/
|
||||
const Mission& currentMission();
|
||||
|
||||
static scripting::LuaLibrary luaLibrary();
|
||||
|
||||
private:
|
||||
using MissionMap = std::map<std::string, Mission>;
|
||||
MissionMap _missionMap;
|
||||
|
||||
MissionMap::iterator _currentMission;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __MISSIONMANAGER_H__
|
||||
@@ -33,133 +33,135 @@
|
||||
#include <glm/gtx/quaternion.hpp>
|
||||
|
||||
//openspace includes
|
||||
#include <openspace/util/powerscaledcoordinate.h>
|
||||
#include <openspace/util/camera.h>
|
||||
|
||||
namespace openspace{
|
||||
|
||||
namespace network{
|
||||
|
||||
namespace datamessagestructures{
|
||||
enum type{
|
||||
PositionData = 0,
|
||||
TimeData,
|
||||
ScriptData
|
||||
};
|
||||
|
||||
struct PositionKeyframe{
|
||||
glm::quat _viewRotationQuat;
|
||||
psc _position;
|
||||
double _timeStamp;
|
||||
|
||||
void serialize(std::vector<char> &buffer){
|
||||
//add position
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_position), reinterpret_cast<char*>(&_position) + sizeof(_position));
|
||||
|
||||
//add orientation
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_viewRotationQuat), reinterpret_cast<char*>(&_viewRotationQuat) + sizeof(_viewRotationQuat));
|
||||
|
||||
//add timestamp
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_timeStamp), reinterpret_cast<char*>(&_timeStamp) + sizeof(_timeStamp));
|
||||
};
|
||||
|
||||
void deserialize(const std::vector<char> &buffer){
|
||||
int offset = 0;
|
||||
int size = 0;
|
||||
|
||||
//position
|
||||
size = sizeof(_position);
|
||||
memcpy(&_position, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
|
||||
//orientation
|
||||
size = sizeof(_viewRotationQuat);
|
||||
memcpy(&_viewRotationQuat, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
|
||||
//timestamp
|
||||
size = sizeof(_timeStamp);
|
||||
memcpy(&_timeStamp, buffer.data() + offset, size);
|
||||
};
|
||||
};
|
||||
|
||||
struct TimeKeyframe{
|
||||
namespace datamessagestructures {
|
||||
enum class Type : uint32_t {
|
||||
CameraData = 0,
|
||||
TimeData,
|
||||
ScriptData
|
||||
};
|
||||
|
||||
double _time;
|
||||
double _dt;
|
||||
bool _paused;
|
||||
bool _requiresTimeJump;
|
||||
|
||||
void serialize(std::vector<char> &buffer){
|
||||
//add current time
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_time), reinterpret_cast<char*>(&_time) + sizeof(_time));
|
||||
|
||||
//add delta time
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_dt), reinterpret_cast<char*>(&_dt) + sizeof(_dt));
|
||||
|
||||
//add wether time is paused or not
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_paused), reinterpret_cast<char*>(&_paused) + sizeof(_paused));
|
||||
|
||||
//add wether a time jump is necessary (recompute paths etc)
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_requiresTimeJump), reinterpret_cast<char*>(&_requiresTimeJump) + sizeof(_requiresTimeJump));
|
||||
};
|
||||
|
||||
void deserialize(const std::vector<char> &buffer){
|
||||
int offset = 0;
|
||||
int size = 0;
|
||||
|
||||
//current time
|
||||
size = sizeof(_time);
|
||||
memcpy(&_time, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
|
||||
//delta time
|
||||
size = sizeof(_dt);
|
||||
memcpy(&_dt, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
|
||||
//is time paused?
|
||||
size = sizeof(_paused);
|
||||
memcpy(&_paused, buffer.data() + offset, size);
|
||||
offset += sizeof(_paused);
|
||||
|
||||
//is a time jump required?
|
||||
size = sizeof(_requiresTimeJump);
|
||||
memcpy(&_requiresTimeJump, buffer.data() + offset, size);
|
||||
};
|
||||
};
|
||||
|
||||
struct ScriptMessage{
|
||||
|
||||
uint16_t _scriptlen;
|
||||
std::string _script;
|
||||
|
||||
void serialize(std::vector<char> &buffer){
|
||||
//add script length
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_scriptlen), reinterpret_cast<char*>(&_scriptlen) + sizeof(_scriptlen));
|
||||
|
||||
//add script
|
||||
buffer.insert(buffer.end(), _script.begin(), _script.end());
|
||||
|
||||
};
|
||||
|
||||
void deserialize(const std::vector<char> &buffer){
|
||||
int offset = 0;
|
||||
int size = 0;
|
||||
|
||||
//size of script
|
||||
size = sizeof(uint16_t);
|
||||
memcpy(&_scriptlen, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
|
||||
//actual script
|
||||
_script.assign(buffer.begin() + offset, buffer.end());
|
||||
};
|
||||
};
|
||||
|
||||
} //namespace messagestructures
|
||||
struct CameraKeyframe {
|
||||
CameraKeyframe() {}
|
||||
CameraKeyframe(const std::vector<char> &buffer) {
|
||||
deserialize(buffer);
|
||||
}
|
||||
|
||||
} // namespace network
|
||||
glm::dvec3 _position;
|
||||
glm::dquat _rotation;
|
||||
double _timestamp;
|
||||
|
||||
void serialize(std::vector<char> &buffer){
|
||||
//add position
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_position), reinterpret_cast<char*>(&_position) + sizeof(_position));
|
||||
|
||||
//add orientation
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_rotation), reinterpret_cast<char*>(&_rotation) + sizeof(_rotation));
|
||||
|
||||
//add timestamp
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_timestamp), reinterpret_cast<char*>(&_timestamp) + sizeof(_timestamp));
|
||||
};
|
||||
|
||||
void deserialize(const std::vector<char> &buffer){
|
||||
int offset = 0;
|
||||
int size = 0;
|
||||
|
||||
//position
|
||||
size = sizeof(_position);
|
||||
memcpy(&_position, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
|
||||
//orientation
|
||||
size = sizeof(_rotation);
|
||||
memcpy(&_rotation, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
|
||||
//timestamp
|
||||
size = sizeof(_timestamp);
|
||||
memcpy(&_timestamp, buffer.data() + offset, size);
|
||||
};
|
||||
};
|
||||
|
||||
struct TimeKeyframe {
|
||||
TimeKeyframe() {}
|
||||
TimeKeyframe(const std::vector<char> &buffer) {
|
||||
deserialize(buffer);
|
||||
}
|
||||
|
||||
double _time;
|
||||
double _dt;
|
||||
bool _paused;
|
||||
bool _requiresTimeJump;
|
||||
double _timestamp;
|
||||
|
||||
void serialize(std::vector<char> &buffer){
|
||||
//add current time
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_time), reinterpret_cast<char*>(&_time) + sizeof(_time));
|
||||
|
||||
//add delta time
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_dt), reinterpret_cast<char*>(&_dt) + sizeof(_dt));
|
||||
|
||||
//add wether time is paused or not
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_paused), reinterpret_cast<char*>(&_paused) + sizeof(_paused));
|
||||
|
||||
//add wether a time jump is necessary (recompute paths etc)
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_requiresTimeJump), reinterpret_cast<char*>(&_requiresTimeJump) + sizeof(_requiresTimeJump));
|
||||
|
||||
//add timestamp
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_timestamp), reinterpret_cast<char*>(&_timestamp) + sizeof(_timestamp));
|
||||
};
|
||||
|
||||
void deserialize(const std::vector<char> &buffer){
|
||||
int offset = 0;
|
||||
int size = 0;
|
||||
|
||||
//current time
|
||||
size = sizeof(_time);
|
||||
memcpy(&_time, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
|
||||
//delta time
|
||||
size = sizeof(_dt);
|
||||
memcpy(&_dt, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
|
||||
//is time paused?
|
||||
size = sizeof(_paused);
|
||||
memcpy(&_paused, buffer.data() + offset, size);
|
||||
offset += sizeof(_paused);
|
||||
|
||||
//is a time jump required?
|
||||
size = sizeof(_requiresTimeJump);
|
||||
memcpy(&_requiresTimeJump, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
|
||||
// timestamp
|
||||
size = sizeof(_timestamp);
|
||||
memcpy(&_timestamp, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
};
|
||||
};
|
||||
|
||||
struct ScriptMessage {
|
||||
ScriptMessage() {}
|
||||
ScriptMessage(const std::vector<char> &buffer) {
|
||||
deserialize(buffer);
|
||||
}
|
||||
|
||||
std::string _script;
|
||||
|
||||
void serialize(std::vector<char> &buffer){
|
||||
buffer.insert(buffer.end(), _script.begin(), _script.end());
|
||||
};
|
||||
|
||||
void deserialize(const std::vector<char> &buffer){
|
||||
_script.assign(buffer.begin(), buffer.end());
|
||||
};
|
||||
};
|
||||
|
||||
} //namespace messagestructures
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __MESSAGESTRUCTURES_H__
|
||||
|
||||
@@ -26,19 +26,20 @@
|
||||
#define __PARALLELCONNECTION_H__
|
||||
|
||||
//openspace includes
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
#include <openspace/util/powerscaledcoordinate.h>
|
||||
#include <openspace/network/messagestructures.h>
|
||||
|
||||
//glm includes
|
||||
#include <glm/gtx/quaternion.hpp>
|
||||
|
||||
//ghoul includes
|
||||
#include <ghoul/designpattern/event.h>
|
||||
|
||||
//std includes
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
#include <sstream>
|
||||
#include <mutex>
|
||||
#include <map>
|
||||
#include <condition_variable>
|
||||
@@ -59,150 +60,149 @@ typedef int _SOCKET;
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
namespace openspace{
|
||||
|
||||
namespace network{
|
||||
|
||||
class ParallelConnection{
|
||||
public:
|
||||
|
||||
ParallelConnection();
|
||||
|
||||
~ParallelConnection();
|
||||
|
||||
void clientConnect();
|
||||
|
||||
void setPort(const std::string &port);
|
||||
|
||||
void setAddress(const std::string &address);
|
||||
|
||||
void setName(const std::string& name);
|
||||
|
||||
bool isHost();
|
||||
|
||||
void requestHostship(const std::string &password);
|
||||
namespace openspace {
|
||||
|
||||
void setPassword(const std::string &password);
|
||||
|
||||
void signalDisconnect();
|
||||
|
||||
void preSynchronization();
|
||||
|
||||
void scriptMessage(const std::string propIdentifier, const std::string propValue);
|
||||
|
||||
enum MessageTypes{
|
||||
Authentication=0,
|
||||
Initialization,
|
||||
Data,
|
||||
Script, //obsolete now
|
||||
HostInfo,
|
||||
InitializationRequest,
|
||||
HostshipRequest,
|
||||
InitializationCompleted
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the Lua library that contains all Lua functions available to affect the
|
||||
* remote OS parallel connection. The functions contained are
|
||||
* -
|
||||
* \return The Lua library that contains all Lua functions available to affect the
|
||||
* interaction
|
||||
*/
|
||||
static scripting::LuaLibrary luaLibrary();
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
//@TODO change this into the ghoul hasher for client AND server
|
||||
uint32_t hash(const std::string &val){
|
||||
uint32_t hashVal = 0, i;
|
||||
size_t len = val.length();
|
||||
class ParallelConnection {
|
||||
public:
|
||||
enum class Status : uint32_t {
|
||||
Disconnected = 0,
|
||||
ClientWithoutHost,
|
||||
ClientWithHost,
|
||||
Host
|
||||
};
|
||||
|
||||
for (hashVal = i = 0; i < len; ++i){
|
||||
hashVal += val.c_str()[i];
|
||||
hashVal += (hashVal << 10);
|
||||
hashVal ^= (hashVal >> 6);
|
||||
}
|
||||
enum class MessageType : uint32_t {
|
||||
Authentication = 0,
|
||||
Data,
|
||||
ConnectionStatus,
|
||||
HostshipRequest,
|
||||
HostshipResignation,
|
||||
NConnections
|
||||
};
|
||||
|
||||
hashVal += (hashVal << 3);
|
||||
hashVal ^= (hashVal >> 11);
|
||||
hashVal += (hashVal << 15);
|
||||
struct Message {
|
||||
Message() {};
|
||||
Message(MessageType t, const std::vector<char>& c)
|
||||
: type(t)
|
||||
, content(c)
|
||||
{};
|
||||
|
||||
MessageType type;
|
||||
std::vector<char> content;
|
||||
};
|
||||
|
||||
struct DataMessage {
|
||||
DataMessage() {};
|
||||
DataMessage(datamessagestructures::Type t, const std::vector<char>& c)
|
||||
: type(t)
|
||||
, content(c)
|
||||
{};
|
||||
datamessagestructures::Type type;
|
||||
std::vector<char> content;
|
||||
};
|
||||
|
||||
ParallelConnection();
|
||||
~ParallelConnection();
|
||||
void clientConnect();
|
||||
void setPort(const std::string &port);
|
||||
void setAddress(const std::string &address);
|
||||
void setName(const std::string& name);
|
||||
bool isHost();
|
||||
const std::string& hostName();
|
||||
void requestHostship(const std::string &password);
|
||||
void resignHostship();
|
||||
void setPassword(const std::string &password);
|
||||
void signalDisconnect();
|
||||
void preSynchronization();
|
||||
void sendScript(const std::string& script);
|
||||
|
||||
/**
|
||||
* Returns the Lua library that contains all Lua functions available to affect the
|
||||
* remote OS parallel connection. The functions contained are
|
||||
* -
|
||||
* \return The Lua library that contains all Lua functions available to affect the
|
||||
* interaction
|
||||
*/
|
||||
static scripting::LuaLibrary luaLibrary();
|
||||
Status status();
|
||||
size_t nConnections();
|
||||
std::shared_ptr<ghoul::Event<>> connectionEvent();
|
||||
|
||||
return hashVal;
|
||||
};
|
||||
|
||||
void queueMessage(std::vector<char> message);
|
||||
|
||||
void disconnect();
|
||||
private:
|
||||
//@TODO change this into the ghoul hasher for client AND server
|
||||
uint32_t hash(const std::string &val);
|
||||
void queueOutMessage(const Message& message);
|
||||
void queueOutDataMessage(const DataMessage& dataMessage);
|
||||
void queueInMessage(const Message& message);
|
||||
|
||||
void disconnect();
|
||||
void closeSocket();
|
||||
bool initNetworkAPI();
|
||||
void establishConnection(addrinfo *info);
|
||||
void sendAuthentication();
|
||||
void listenCommunication();
|
||||
int receiveData(_SOCKET & socket, std::vector<char> &buffer, int length, int flags);
|
||||
|
||||
void handleMessage(const Message&);
|
||||
void dataMessageReceived(const std::vector<char>& messageContent);
|
||||
void connectionStatusMessageReceived(const std::vector<char>& messageContent);
|
||||
void nConnectionsMessageReceived(const std::vector<char>& messageContent);
|
||||
|
||||
void broadcast();
|
||||
void sendCameraKeyframe();
|
||||
void sendTimeKeyframe();
|
||||
|
||||
void sendFunc();
|
||||
void threadManagement();
|
||||
|
||||
void setStatus(Status status);
|
||||
void setHostName(const std::string& hostName);
|
||||
void setNConnections(size_t nConnections);
|
||||
|
||||
double calculateBufferedKeyframeTime(double originalTime);
|
||||
|
||||
uint32_t _passCode;
|
||||
std::string _port;
|
||||
std::string _address;
|
||||
std::string _name;
|
||||
|
||||
void writeHeader(std::vector<char> &buffer, uint32_t messageType);
|
||||
_SOCKET _clientSocket;
|
||||
|
||||
void closeSocket();
|
||||
std::atomic<bool> _isConnected;
|
||||
std::atomic<bool> _isRunning;
|
||||
std::atomic<bool> _tryConnect;
|
||||
std::atomic<bool> _disconnect;
|
||||
std::atomic<bool> _initializationTimejumpRequired;
|
||||
|
||||
bool initNetworkAPI();
|
||||
std::atomic<size_t> _nConnections;
|
||||
std::atomic<Status> _status;
|
||||
std::string _hostName;
|
||||
|
||||
void establishConnection(addrinfo *info);
|
||||
|
||||
void sendAuthentication();
|
||||
|
||||
void listenCommunication();
|
||||
|
||||
void delegateDecoding(uint32_t type);
|
||||
|
||||
void initializationMessageReceived();
|
||||
|
||||
void dataMessageReceived();
|
||||
|
||||
void hostInfoMessageReceived();
|
||||
std::condition_variable _disconnectCondition;
|
||||
std::mutex _disconnectMutex;
|
||||
|
||||
void initializationRequestMessageReceived();
|
||||
std::condition_variable _sendCondition;
|
||||
std::deque<Message> _sendBuffer;
|
||||
std::mutex _sendBufferMutex;
|
||||
|
||||
void broadcast();
|
||||
std::deque<Message> _receiveBuffer;
|
||||
std::mutex _receiveBufferMutex;
|
||||
|
||||
int headerSize();
|
||||
std::atomic<bool> _timeJumped;
|
||||
std::mutex _latencyMutex;
|
||||
std::deque<double> _latencyDiffs;
|
||||
double _initialTimeDiff;
|
||||
|
||||
int receiveData(_SOCKET & socket, std::vector<char> &buffer, int length, int flags);
|
||||
|
||||
void sendFunc();
|
||||
|
||||
bool parseHints(addrinfo &info);
|
||||
|
||||
void threadManagement();
|
||||
|
||||
std::string scriptFromPropertyAndValue(const std::string property, const std::string value);
|
||||
|
||||
uint32_t _passCode;
|
||||
std::string _port;
|
||||
std::string _address;
|
||||
std::string _name;
|
||||
_SOCKET _clientSocket;
|
||||
std::thread *_connectionThread;
|
||||
std::thread *_broadcastThread;
|
||||
std::thread *_sendThread;
|
||||
std::thread *_listenThread;
|
||||
std::thread *_handlerThread;
|
||||
std::atomic<bool> _isHost;
|
||||
std::atomic<bool> _isConnected;
|
||||
std::atomic<bool> _performDisconnect;
|
||||
std::atomic<bool> _isRunning;
|
||||
std::atomic<bool> _tryConnect;
|
||||
std::atomic<bool> _initializationTimejumpRequired;
|
||||
std::unique_ptr<std::thread> _connectionThread;
|
||||
std::unique_ptr<std::thread> _broadcastThread;
|
||||
std::unique_ptr<std::thread> _sendThread;
|
||||
std::unique_ptr<std::thread> _listenThread;
|
||||
std::unique_ptr<std::thread> _handlerThread;
|
||||
std::shared_ptr<ghoul::Event<>> _connectionEvent;
|
||||
};
|
||||
|
||||
std::condition_variable _disconnectCondition;
|
||||
std::mutex _disconnectMutex;
|
||||
|
||||
std::vector<std::vector<char>> _sendBuffer;
|
||||
std::mutex _sendBufferMutex;
|
||||
std::condition_variable _sendCondition;
|
||||
|
||||
network::datamessagestructures::TimeKeyframe _latestTimeKeyframe;
|
||||
std::mutex _timeKeyframeMutex;
|
||||
std::atomic<bool> _latestTimeKeyframeValid;
|
||||
std::map<std::string, std::string> _currentState;
|
||||
std::mutex _currentStateMutex;
|
||||
};
|
||||
} // namespace network
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OSPARALLELCONNECTION_H__
|
||||
|
||||
@@ -124,7 +124,7 @@ public:
|
||||
private:
|
||||
bool loadSceneInternal(const std::string& sceneDescriptionFilePath);
|
||||
|
||||
void writePropertyDocumentation(const std::string& filename, const std::string& type);
|
||||
void writePropertyDocumentation(const std::string& filename, const std::string& type, const std::string& sceneFilename);
|
||||
|
||||
std::string _focus;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <openspace/documentation/documentation.h>
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/scene/ephemeris.h>
|
||||
#include <openspace/scene/translation.h>
|
||||
#include <openspace/scene/rotation.h>
|
||||
#include <openspace/scene/scale.h>
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
@@ -103,9 +103,9 @@ public:
|
||||
|
||||
// @TODO Remove once the scalegraph is in effect ---abock
|
||||
|
||||
void setEphemeris(Ephemeris* eph) {
|
||||
delete _ephemeris;
|
||||
_ephemeris = eph;
|
||||
void setEphemeris(Translation* eph) {
|
||||
delete _translation;
|
||||
_translation = eph;
|
||||
}
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
@@ -129,7 +129,7 @@ private:
|
||||
PowerScaledScalar _boundingSphere;
|
||||
|
||||
// Transformation defined by ephemeris, rotation and scale
|
||||
Ephemeris* _ephemeris;
|
||||
Translation* _translation;
|
||||
Rotation* _rotation;
|
||||
Scale* _scale;
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __EPHEMERIS_H__
|
||||
#define __EPHEMERIS_H__
|
||||
#ifndef __TRANSLATION_H__
|
||||
#define __TRANSLATION_H__
|
||||
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
|
||||
@@ -34,11 +34,11 @@
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class Ephemeris : public properties::PropertyOwner {
|
||||
class Translation : public properties::PropertyOwner {
|
||||
public:
|
||||
static Ephemeris* createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
static Translation* createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
|
||||
virtual ~Ephemeris();
|
||||
virtual ~Translation();
|
||||
virtual bool initialize();
|
||||
virtual glm::dvec3 position() const = 0;
|
||||
virtual void update(const UpdateData& data);
|
||||
@@ -48,4 +48,4 @@ public:
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __EPHEMERIS_H__
|
||||
#endif // __TRANSLATION_H__
|
||||
@@ -37,9 +37,8 @@ namespace scripting {
|
||||
struct LuaLibrary {
|
||||
/**
|
||||
* This structure represents a Lua function with its #name, #function pointer
|
||||
* #argumentText describing the arguments this function takes, the #helpText
|
||||
* describing the function, and whether it should be shared in a parallel
|
||||
* connection (#parallelShared)
|
||||
* #argumentText describing the arguments this function takes, and the the #helpText
|
||||
* describing the function.
|
||||
*/
|
||||
struct Function {
|
||||
/// The name of the function
|
||||
@@ -50,9 +49,6 @@ struct LuaLibrary {
|
||||
std::string argumentText;
|
||||
/// A help text describing what the function does/
|
||||
std::string helpText;
|
||||
/// If <code>true</code>, this function will be shared with other parallel
|
||||
/// connections
|
||||
bool parallelShared;
|
||||
};
|
||||
/// The name of the library
|
||||
std::string name;
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace scripting {
|
||||
*/
|
||||
class ScriptEngine : public Syncable {
|
||||
public:
|
||||
using RemoteScripting = ghoul::Boolean;
|
||||
/**
|
||||
* Initializes the internal Lua state and registers a common set of library functions
|
||||
* \throw LuaRuntimeException If the creation of the new Lua state fails
|
||||
@@ -79,7 +80,7 @@ public:
|
||||
virtual void decode(SyncBuffer* syncBuffer);
|
||||
virtual void postsync(bool isMaster);
|
||||
|
||||
void queueScript(const std::string &script);
|
||||
void queueScript(const std::string &script, RemoteScripting remoteScripting);
|
||||
|
||||
void setLogFile(const std::string& filename, const std::string& type);
|
||||
|
||||
@@ -88,9 +89,9 @@ public:
|
||||
std::vector<std::string> allLuaFunctions() const;
|
||||
|
||||
//parallel functions
|
||||
bool parseLibraryAndFunctionNames(std::string &library, std::string &function, const std::string &script);
|
||||
bool shouldScriptBeSent(const std::string &library, const std::string &function);
|
||||
void cacheScript(const std::string &library, const std::string &function, const std::string &script);
|
||||
//bool parseLibraryAndFunctionNames(std::string &library, std::string &function, const std::string &script);
|
||||
//bool shouldScriptBeSent(const std::string &library, const std::string &function);
|
||||
//void cacheScript(const std::string &library, const std::string &function, const std::string &script);
|
||||
|
||||
private:
|
||||
|
||||
@@ -107,13 +108,13 @@ private:
|
||||
|
||||
//sync variables
|
||||
std::mutex _mutex;
|
||||
std::vector<std::string> _queuedScripts;
|
||||
std::vector<std::pair<std::string, bool>> _queuedScripts;
|
||||
std::vector<std::string> _receivedScripts;
|
||||
std::string _currentSyncedScript;
|
||||
|
||||
//parallel variables
|
||||
std::map<std::string, std::map<std::string, std::string>> _cachedScripts;
|
||||
std::mutex _cachedScriptsMutex;
|
||||
//std::map<std::string, std::map<std::string, std::string>> _cachedScripts;
|
||||
//std::mutex _cachedScriptsMutex;
|
||||
|
||||
//logging variables
|
||||
bool _logFileExists = false;
|
||||
|
||||
51
include/openspace/util/timemanager.h
Normal file
51
include/openspace/util/timemanager.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* 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 __TIMEMANAGER_H__
|
||||
#define __TIMEMANAGER_H__
|
||||
|
||||
#include <deque>
|
||||
#include <openspace/network/messagestructures.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class TimeManager {
|
||||
public:
|
||||
void preSynchronization(double dt);
|
||||
void addKeyframe(const datamessagestructures::TimeKeyframe& kf);
|
||||
void removeKeyframesBefore(double timestamp);
|
||||
void clearKeyframes();
|
||||
private:
|
||||
void consumeKeyframes(double dt);
|
||||
std::deque<datamessagestructures::TimeKeyframe> _keyframes;
|
||||
static bool compareKeyframeTimes(
|
||||
const datamessagestructures::TimeKeyframe& a,
|
||||
const datamessagestructures::TimeKeyframe& b);
|
||||
double _latestConsumedTimestamp;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // __TIMEMANAGER_H__
|
||||
@@ -1,37 +1,33 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* 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. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
#include <openspace/util/spicemanager.h> // ephemerisTimeFromDate
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* 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 __TIMERANGE_H__
|
||||
#define __TIMERANGE_H__
|
||||
|
||||
namespace {
|
||||
const std::string KEY_START = "Start";
|
||||
const std::string KEY_END = "End";
|
||||
}
|
||||
#include <openspace/documentation/documentation.h>
|
||||
|
||||
namespace ghoul { class Dictionary; }
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -40,79 +36,41 @@ struct TimeRange {
|
||||
/**
|
||||
* Default constructor initializes an empty time range.
|
||||
*/
|
||||
TimeRange() : start(DBL_MAX), end(-DBL_MAX) { };
|
||||
TimeRange();
|
||||
|
||||
/**
|
||||
* Initializes a TimeRange with both start and end time. Initializing empty timeranges
|
||||
* is OK.
|
||||
*/
|
||||
TimeRange(double startTime, double endTime) : start(startTime) , end(endTime) { };
|
||||
TimeRange(double startTime, double endTime);
|
||||
|
||||
/**
|
||||
* Throws exception if unable to parse the provided \class ghoul::Dictionary
|
||||
*/
|
||||
TimeRange(const ghoul::Dictionary& dict) {
|
||||
if (!initializeFromDictionary(dict, *this)) {
|
||||
throw std::runtime_error("Unable to read TimeRange from dictionary");
|
||||
}
|
||||
}
|
||||
TimeRange(const ghoul::Dictionary& dict);
|
||||
|
||||
/**
|
||||
* \returns true if timeRange could be initialized from the dictionary, false otherwise.
|
||||
*/
|
||||
static bool initializeFromDictionary(const ghoul::Dictionary& dict, TimeRange& timeRange) {
|
||||
std::string startTimeStr;
|
||||
std::string endTimeStr;
|
||||
static bool initializeFromDictionary(const ghoul::Dictionary& dict, TimeRange& timeRange);
|
||||
|
||||
bool success = true;
|
||||
success &= dict.getValue(KEY_START, startTimeStr);
|
||||
success &= dict.getValue(KEY_END, endTimeStr);
|
||||
if (success) {
|
||||
// Parse to date.
|
||||
// @TODO converting string to time stamp should not rely on Spice
|
||||
timeRange.start = SpiceManager::ref().ephemerisTimeFromDate(startTimeStr);
|
||||
timeRange.end = SpiceManager::ref().ephemerisTimeFromDate(endTimeStr);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// Could not read TimeRange from Dict
|
||||
return false;
|
||||
}
|
||||
}
|
||||
void include(double val);
|
||||
|
||||
void include(double val){
|
||||
if (start > val) start = val;
|
||||
if (end < val) end = val;
|
||||
};
|
||||
void include(const TimeRange& other);
|
||||
|
||||
double duration() const;
|
||||
|
||||
void include(const TimeRange& other) {
|
||||
if (other.start < start) start = other.start;
|
||||
if (other.end > end) end = other.end;
|
||||
}
|
||||
bool isDefined() const;
|
||||
|
||||
double duration() const {
|
||||
return end - start;
|
||||
}
|
||||
bool isEmpty() const;
|
||||
|
||||
bool isDefined() const {
|
||||
return start <= end;
|
||||
}
|
||||
bool inRange(double min, double max);
|
||||
|
||||
bool isEmpty() const {
|
||||
return !isDefined();
|
||||
}
|
||||
bool includes(double val) const;
|
||||
|
||||
bool inRange(double min, double max){
|
||||
return (min >= start && max <= end);
|
||||
}
|
||||
bool includes(const TimeRange& o) const;
|
||||
|
||||
bool includes(double val) const {
|
||||
return (start <= val && val <= end);
|
||||
}
|
||||
|
||||
bool includes(const TimeRange& o) const {
|
||||
return start <= o.start && o.end <= end;
|
||||
}
|
||||
static openspace::Documentation Documentation();
|
||||
|
||||
double start;
|
||||
double end;
|
||||
|
||||
Reference in New Issue
Block a user