mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-22 19:29:04 -05:00
Solved merge conflict
This commit is contained in:
@@ -116,7 +116,7 @@ public:
|
||||
* configuration file
|
||||
* \pre \p filename must not be empty
|
||||
*/
|
||||
void loadFromFile(const std::string& filename);
|
||||
void loadFromFile(const std::string& filename);
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -126,7 +126,7 @@ private:
|
||||
* \return <code>true</code> if the configuration file was complete;
|
||||
* <code>false</code> otherwise
|
||||
*/
|
||||
bool checkCompleteness() const;
|
||||
bool checkCompleteness() const;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -69,7 +69,6 @@ public:
|
||||
DownloadManager(std::string requestURL, int applicationVersion,
|
||||
bool useMultithreadedDownload = true);
|
||||
|
||||
// callers responsibility to delete
|
||||
// callbacks happen on a different thread
|
||||
std::shared_ptr<FileFuture> downloadFile(const std::string& url, const ghoul::filesystem::File& file,
|
||||
bool overrideFile = true,
|
||||
|
||||
@@ -66,8 +66,8 @@ public:
|
||||
static bool isInitialized();
|
||||
static OpenSpaceEngine& ref();
|
||||
|
||||
bool isMaster();
|
||||
void setMaster(bool master);
|
||||
bool isMaster();
|
||||
void setMaster(bool master);
|
||||
double runTime();
|
||||
void setRunTime(double t);
|
||||
|
||||
@@ -75,29 +75,29 @@ public:
|
||||
ConfigurationManager& configurationManager();
|
||||
interaction::InteractionHandler& interactionHandler();
|
||||
RenderEngine& renderEngine();
|
||||
scripting::ScriptEngine& scriptEngine();
|
||||
scripting::ScriptEngine& scriptEngine();
|
||||
NetworkEngine& networkEngine();
|
||||
LuaConsole& console();
|
||||
LuaConsole& console();
|
||||
ModuleEngine& moduleEngine();
|
||||
network::ParallelConnection& parallelConnection();
|
||||
properties::PropertyOwner& globalPropertyOwner();
|
||||
WindowWrapper& windowWrapper();
|
||||
ghoul::fontrendering::FontManager& fontManager();
|
||||
gui::GUI& gui();
|
||||
gui::GUI& gui();
|
||||
|
||||
// SGCT callbacks
|
||||
bool initialize();
|
||||
bool initializeGL();
|
||||
void preSynchronization();
|
||||
void postSynchronizationPreDraw();
|
||||
void render(const glm::mat4& projectionMatrix, const glm::mat4& viewMatrix);
|
||||
void postDraw();
|
||||
void render(const glm::mat4& projectionMatrix, const glm::mat4& viewMatrix);
|
||||
void postDraw();
|
||||
void keyboardCallback(Key key, KeyModifier mod, KeyAction action);
|
||||
void charCallback(unsigned int codepoint, KeyModifier mod);
|
||||
void charCallback(unsigned int codepoint, KeyModifier mod);
|
||||
void mouseButtonCallback(MouseButton button, MouseAction action);
|
||||
void mousePositionCallback(double x, double y);
|
||||
void mouseScrollWheelCallback(double pos);
|
||||
void externalControlCallback(const char* receivedChars, int size, int clientId);
|
||||
void externalControlCallback(const char* receivedChars, int size, int clientId);
|
||||
void encode();
|
||||
void decode();
|
||||
|
||||
@@ -110,22 +110,22 @@ private:
|
||||
OpenSpaceEngine(std::string programName, std::unique_ptr<WindowWrapper> windowWrapper);
|
||||
~OpenSpaceEngine();
|
||||
|
||||
void clearAllWindows();
|
||||
bool gatherCommandlineArguments();
|
||||
bool loadSpiceKernels();
|
||||
void clearAllWindows();
|
||||
bool gatherCommandlineArguments();
|
||||
bool loadSpiceKernels();
|
||||
void loadFonts();
|
||||
void runScripts(const ghoul::Dictionary& scripts);
|
||||
void runStartupScripts();
|
||||
void configureLogging();
|
||||
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::ScriptEngine> _scriptEngine;
|
||||
std::unique_ptr<NetworkEngine> _networkEngine;
|
||||
std::unique_ptr<ghoul::cmdparser::CommandlineParser> _commandlineParser;
|
||||
std::unique_ptr<LuaConsole> _console;
|
||||
std::unique_ptr<ghoul::cmdparser::CommandlineParser> _commandlineParser;
|
||||
std::unique_ptr<LuaConsole> _console;
|
||||
std::unique_ptr<ModuleEngine> _moduleEngine;
|
||||
std::unique_ptr<gui::GUI> _gui;
|
||||
std::unique_ptr<network::ParallelConnection> _parallelConnection;
|
||||
@@ -136,7 +136,7 @@ private:
|
||||
std::unique_ptr<properties::PropertyOwner> _globalPropertyNamespace;
|
||||
std::unique_ptr<SyncBuffer> _syncBuffer;
|
||||
|
||||
bool _isMaster;
|
||||
bool _isMaster;
|
||||
double _runTime;
|
||||
|
||||
static OpenSpaceEngine* _engine;
|
||||
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
*/
|
||||
virtual int currentNumberOfAaSamples() const;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns <code>true</code> if the current rendering method is regular, i.e., it is
|
||||
* a flat projection without non-linear distortions. Returns <code>false</code> in
|
||||
* other cases, for example fisheye projections. On default, this method will return
|
||||
|
||||
@@ -37,14 +37,14 @@ class InteractionHandler;
|
||||
|
||||
class Controller {
|
||||
public:
|
||||
Controller() :
|
||||
_handler(nullptr)
|
||||
{}
|
||||
Controller() :
|
||||
_handler(nullptr)
|
||||
{}
|
||||
|
||||
void setHandler(InteractionHandler* handler);
|
||||
void setHandler(InteractionHandler* handler);
|
||||
|
||||
protected:
|
||||
InteractionHandler* _handler;
|
||||
InteractionHandler* _handler;
|
||||
};
|
||||
|
||||
} // namespace interaction
|
||||
|
||||
@@ -14,39 +14,39 @@ enum class InputDevice {NONE, UNKNOWN, SPACENAVIGATOR, XBOX};
|
||||
|
||||
class DeviceIdentifier {
|
||||
public:
|
||||
static DeviceIdentifier& ref();
|
||||
virtual ~DeviceIdentifier();
|
||||
static DeviceIdentifier& ref();
|
||||
virtual ~DeviceIdentifier();
|
||||
|
||||
static void init();
|
||||
static void deinit();
|
||||
static bool isInitialized();
|
||||
|
||||
void scanDevices();
|
||||
const int numberOfDevices() const;
|
||||
const InputDevice type(const int device) const;
|
||||
|
||||
void update();
|
||||
void update(const int device);
|
||||
static void init();
|
||||
static void deinit();
|
||||
static bool isInitialized();
|
||||
|
||||
void scanDevices();
|
||||
const int numberOfDevices() const;
|
||||
const InputDevice type(const int device) const;
|
||||
|
||||
void update();
|
||||
void update(const int device);
|
||||
|
||||
const int getButtons(const int device, unsigned char **buttons = nullptr) const;
|
||||
const int getAxes(const int device, float **axespos = nullptr) const;
|
||||
void get(const int device, unsigned char **buttons, float **axespos) const;
|
||||
|
||||
const int getButtons(const int device, unsigned char **buttons = nullptr) const;
|
||||
const int getAxes(const int device, float **axespos = nullptr) const;
|
||||
void get(const int device, unsigned char **buttons, float **axespos) const;
|
||||
|
||||
private:
|
||||
// singleton
|
||||
static DeviceIdentifier* this_;
|
||||
// singleton
|
||||
static DeviceIdentifier* this_;
|
||||
DeviceIdentifier(void);
|
||||
DeviceIdentifier(const DeviceIdentifier& src);
|
||||
DeviceIdentifier& operator=(const DeviceIdentifier& rhs);
|
||||
|
||||
|
||||
// member variables
|
||||
int devices_;
|
||||
std::array<InputDevice, MAXDEVICES> inputDevice_;
|
||||
std::array<int, MAXDEVICES> numberOfAxes_;
|
||||
std::array<int, MAXDEVICES> numberOfButtons_;
|
||||
std::array<float *, MAXDEVICES> axesPos_;
|
||||
std::array<unsigned char *, MAXDEVICES> buttons_;
|
||||
// member variables
|
||||
int devices_;
|
||||
std::array<InputDevice, MAXDEVICES> inputDevice_;
|
||||
std::array<int, MAXDEVICES> numberOfAxes_;
|
||||
std::array<int, MAXDEVICES> numberOfButtons_;
|
||||
std::array<float *, MAXDEVICES> axesPos_;
|
||||
std::array<unsigned char *, MAXDEVICES> buttons_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ namespace openspace {
|
||||
class ExternalConnectionController: public ExternalControl {
|
||||
public:
|
||||
|
||||
// constructors & destructor
|
||||
ExternalConnectionController();
|
||||
~ExternalConnectionController();
|
||||
|
||||
// constructors & destructor
|
||||
ExternalConnectionController();
|
||||
~ExternalConnectionController();
|
||||
|
||||
private:
|
||||
|
||||
std::vector<ExternalControl*> controllers;
|
||||
|
||||
std::vector<ExternalControl*> controllers;
|
||||
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -10,17 +10,17 @@ namespace openspace {
|
||||
class ExternalControl {
|
||||
public:
|
||||
|
||||
// constructors & destructor
|
||||
ExternalControl();
|
||||
virtual ~ExternalControl();
|
||||
|
||||
virtual void update();
|
||||
|
||||
void rotate(const glm::quat &rotation);
|
||||
void orbit(const glm::quat &rotation);
|
||||
void distance(const PowerScaledScalar &distance);
|
||||
// constructors & destructor
|
||||
ExternalControl();
|
||||
virtual ~ExternalControl();
|
||||
|
||||
virtual void update();
|
||||
|
||||
void rotate(const glm::quat &rotation);
|
||||
void orbit(const glm::quat &rotation);
|
||||
void distance(const PowerScaledScalar &distance);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
|
||||
@@ -8,19 +8,19 @@
|
||||
//class JoystickExternalControl: public PythonExternalControl {
|
||||
//public:
|
||||
//
|
||||
// // constructors & destructor
|
||||
// JoystickExternalControl(const char *filename);
|
||||
// ~JoystickExternalControl();
|
||||
//
|
||||
// void setInputDevice(const int device);
|
||||
// void update();
|
||||
// // constructors & destructor
|
||||
// JoystickExternalControl(const char *filename);
|
||||
// ~JoystickExternalControl();
|
||||
//
|
||||
// void setInputDevice(const int device);
|
||||
// void update();
|
||||
//
|
||||
//private:
|
||||
//
|
||||
// // joystick
|
||||
// int inputDevice_;
|
||||
// int numberOfButtons_;
|
||||
// int numberOfAxes_;
|
||||
// // joystick
|
||||
// int inputDevice_;
|
||||
// int numberOfButtons_;
|
||||
// int numberOfAxes_;
|
||||
//};
|
||||
//
|
||||
//} // namespace openspace
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
//class KeyboardExternalControl: public PythonExternalControl {
|
||||
//public:
|
||||
//
|
||||
// // constructors & destructor
|
||||
// KeyboardExternalControl(const char *filename);
|
||||
// ~KeyboardExternalControl();
|
||||
// // constructors & destructor
|
||||
// KeyboardExternalControl(const char *filename);
|
||||
// ~KeyboardExternalControl();
|
||||
//
|
||||
// void update();
|
||||
//
|
||||
// void keyboardCallback(int key, int action);
|
||||
// void update();
|
||||
//
|
||||
// void keyboardCallback(int key, int action);
|
||||
//private:
|
||||
// int *keys_;
|
||||
// int *keys_;
|
||||
//
|
||||
//};
|
||||
//
|
||||
|
||||
@@ -8,18 +8,18 @@
|
||||
//class MouseExternalControl: public PythonExternalControl {
|
||||
//public:
|
||||
//
|
||||
// // constructors & destructor
|
||||
// MouseExternalControl(const char *filename);
|
||||
// ~MouseExternalControl();
|
||||
// // constructors & destructor
|
||||
// MouseExternalControl(const char *filename);
|
||||
// ~MouseExternalControl();
|
||||
//
|
||||
// void update();
|
||||
//
|
||||
// void mouseButtonCallback(int key, int action);
|
||||
// void mousePosCallback(int x, int y);
|
||||
// void mouseScrollCallback(int pos);
|
||||
// void update();
|
||||
//
|
||||
// void mouseButtonCallback(int key, int action);
|
||||
// void mousePosCallback(int x, int y);
|
||||
// void mouseScrollCallback(int pos);
|
||||
//private:
|
||||
//
|
||||
// int x_, y_, pos_, button1_, button2_, button3_;
|
||||
// int x_, y_, pos_, button1_, button2_, button3_;
|
||||
//
|
||||
//};
|
||||
//
|
||||
|
||||
@@ -12,22 +12,22 @@
|
||||
//class PythonExternalControl: public ExternalControl {
|
||||
//public:
|
||||
//
|
||||
// // constructors & destructor
|
||||
// PythonExternalControl(const char *filename);
|
||||
// ~PythonExternalControl();
|
||||
// // constructors & destructor
|
||||
// PythonExternalControl(const char *filename);
|
||||
// ~PythonExternalControl();
|
||||
//
|
||||
// static PyMethodDef* getMethodDef();
|
||||
//
|
||||
// void message(const char *text);
|
||||
// virtual void update();
|
||||
// void clear();
|
||||
// static PyMethodDef* getMethodDef();
|
||||
//
|
||||
// void message(const char *text);
|
||||
// virtual void update();
|
||||
// void clear();
|
||||
//private:
|
||||
// PythonScript ps_;
|
||||
// PythonScript ps_;
|
||||
//
|
||||
//protected:
|
||||
// void run();
|
||||
// int pyarrSize_;
|
||||
// PyObject **pyarr_;
|
||||
// void run();
|
||||
// int pyarrSize_;
|
||||
// PyObject **pyarr_;
|
||||
//};
|
||||
//
|
||||
//} // namespace openspace
|
||||
|
||||
@@ -11,14 +11,14 @@ namespace openspace {
|
||||
class RandomExternalControl: public ExternalControl {
|
||||
public:
|
||||
|
||||
// constructors & destructor
|
||||
RandomExternalControl();
|
||||
~RandomExternalControl();
|
||||
|
||||
// constructors & destructor
|
||||
RandomExternalControl();
|
||||
~RandomExternalControl();
|
||||
|
||||
private:
|
||||
std::mutex inputGuard;
|
||||
bool *keepGoing_;
|
||||
// std::thread *backgroundThread;
|
||||
std::mutex inputGuard;
|
||||
bool *keepGoing_;
|
||||
// std::thread *backgroundThread;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -22,55 +22,6 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
//<<<<<<< HEAD
|
||||
//#ifndef INTERACTIONHANDLER_H
|
||||
//#define INTERACTIONHANDLER_H
|
||||
//
|
||||
//#include <openspace/scripting/scriptengine.h>
|
||||
//#include <openspace/util/powerscaledcoordinate.h>
|
||||
//#include <openspace/util/powerscaledscalar.h>
|
||||
//
|
||||
//// std includes
|
||||
//#include <vector>
|
||||
//#include <mutex>
|
||||
//#include <map>
|
||||
//#include <functional>
|
||||
//
|
||||
//namespace openspace {
|
||||
//
|
||||
//// Forward declare to minimize dependencies
|
||||
//class Camera;
|
||||
//class SceneGraphNode;
|
||||
//class ExternalControl;
|
||||
//
|
||||
//class InteractionHandler {
|
||||
//public:
|
||||
// InteractionHandler(void);
|
||||
// InteractionHandler(const InteractionHandler& src);
|
||||
// InteractionHandler& operator=(const InteractionHandler& rhs);
|
||||
// virtual ~InteractionHandler();
|
||||
//
|
||||
// void enable();
|
||||
// void disable();
|
||||
// const bool isEnabled() const;
|
||||
//
|
||||
// void connectDevices();
|
||||
// void addExternalControl(ExternalControl* controller);
|
||||
//
|
||||
// void setCamera(Camera *camera = nullptr);
|
||||
// void setOrigin(SceneGraphNode* node);
|
||||
//
|
||||
// Camera* getCamera() const;
|
||||
// const psc getOrigin() const;
|
||||
// void lockControls();
|
||||
// void unlockControls();
|
||||
//
|
||||
// void setFocusNode(SceneGraphNode *node);
|
||||
//
|
||||
// void orbit(const glm::quat &rotation);
|
||||
// void rotate(const glm::quat &rotation);
|
||||
// void distance(const PowerScaledScalar &distance, size_t iterations = 0);
|
||||
//=======
|
||||
#ifndef __INTERACTIONHANDLER_H__
|
||||
#define __INTERACTIONHANDLER_H__
|
||||
|
||||
@@ -94,45 +45,45 @@ class InteractionHandler : public properties::PropertyOwner {
|
||||
public:
|
||||
InteractionHandler();
|
||||
|
||||
~InteractionHandler();
|
||||
~InteractionHandler();
|
||||
|
||||
void setKeyboardController(KeyboardController* controller);
|
||||
void setMouseController(MouseController* controller);
|
||||
void addController(Controller* controller);
|
||||
void setKeyboardController(KeyboardController* controller);
|
||||
void setMouseController(MouseController* controller);
|
||||
void addController(Controller* controller);
|
||||
|
||||
void lockControls();
|
||||
void unlockControls();
|
||||
void lockControls();
|
||||
void unlockControls();
|
||||
|
||||
void update(double deltaTime);
|
||||
void update(double deltaTime);
|
||||
|
||||
void setFocusNode(SceneGraphNode* node);
|
||||
const SceneGraphNode* const focusNode() const;
|
||||
void setCamera(Camera* camera);
|
||||
const Camera* const camera() const;
|
||||
void setFocusNode(SceneGraphNode* node);
|
||||
const SceneGraphNode* const focusNode() const;
|
||||
void setCamera(Camera* camera);
|
||||
const Camera* const camera() const;
|
||||
|
||||
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);
|
||||
void mouseButtonCallback(MouseButton button, MouseAction action);
|
||||
void mousePositionCallback(double x, double y);
|
||||
void mouseScrollWheelCallback(double pos);
|
||||
void mouseButtonCallback(MouseButton button, MouseAction action);
|
||||
void mousePositionCallback(double x, double y);
|
||||
void mouseScrollWheelCallback(double pos);
|
||||
|
||||
double deltaTime() const;
|
||||
double deltaTime() const;
|
||||
|
||||
void orbitDelta(const glm::quat& rotation);
|
||||
void orbitDelta(const glm::quat& rotation);
|
||||
|
||||
void orbit(const float &dx, const float &dy, const float &dz, const float &dist);
|
||||
void orbit(const float &dx, const float &dy, const float &dz, const float &dist);
|
||||
|
||||
//void distance(const float &d);
|
||||
//void distance(const float &d);
|
||||
|
||||
void rotateDelta(const glm::quat& rotation);
|
||||
void rotateDelta(const glm::quat& rotation);
|
||||
|
||||
void distanceDelta(const PowerScaledScalar& distance, size_t iterations = 0);
|
||||
void distanceDelta(const PowerScaledScalar& distance, size_t iterations = 0);
|
||||
|
||||
void lookAt(const glm::quat& rotation);
|
||||
void lookAt(const glm::quat& rotation);
|
||||
|
||||
void setRotation(const glm::quat& rotation);
|
||||
void setRotation(const glm::quat& rotation);
|
||||
|
||||
void resetKeyBindings();
|
||||
void bindKey(Key key, std::string lua);
|
||||
void resetKeyBindings();
|
||||
void bindKey(Key key, KeyModifier modifier, std::string lua);
|
||||
|
||||
void setInteractionSensitivity(float sensitivity);
|
||||
float interactionSensitivity() const;
|
||||
@@ -143,51 +94,51 @@ public:
|
||||
void setInvertRotation(bool invert);
|
||||
bool invertRotation() const;
|
||||
|
||||
void addKeyframe(const network::datamessagestructures::PositionKeyframe &kf);
|
||||
void addKeyframe(const network::datamessagestructures::PositionKeyframe &kf);
|
||||
void clearKeyframes();
|
||||
|
||||
/**
|
||||
* 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::ScriptEngine::LuaLibrary luaLibrary();
|
||||
|
||||
private:
|
||||
/**
|
||||
* 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::ScriptEngine::LuaLibrary luaLibrary();
|
||||
|
||||
friend class Controller;
|
||||
private:
|
||||
friend class Controller;
|
||||
|
||||
InteractionHandler(const InteractionHandler&) = delete;
|
||||
InteractionHandler& operator=(const InteractionHandler&) = delete;
|
||||
InteractionHandler(InteractionHandler&&) = delete;
|
||||
InteractionHandler& operator=(InteractionHandler&&) = delete;
|
||||
InteractionHandler(InteractionHandler&&) = delete;
|
||||
InteractionHandler& operator=(InteractionHandler&&) = delete;
|
||||
|
||||
Camera* _camera;
|
||||
SceneGraphNode* _focusNode;
|
||||
Camera* _camera;
|
||||
SceneGraphNode* _focusNode;
|
||||
|
||||
double _deltaTime;
|
||||
std::mutex _mutex;
|
||||
double _deltaTime;
|
||||
std::mutex _mutex;
|
||||
|
||||
bool _validKeyLua;
|
||||
std::multimap<Key, std::string > _keyLua;
|
||||
bool _validKeyLua;
|
||||
|
||||
std::multimap<KeyWithModifier, std::string > _keyLua;
|
||||
|
||||
float _controllerSensitivity;
|
||||
bool _invertRoll;
|
||||
bool _invertRotation;
|
||||
|
||||
KeyboardController* _keyboardController;
|
||||
MouseController* _mouseController;
|
||||
std::vector<Controller*> _controllers;
|
||||
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;
|
||||
//remote controller
|
||||
std::vector<network::datamessagestructures::PositionKeyframe> _keyframes;
|
||||
double _currentKeyframeTime;
|
||||
std::mutex _keyframeMutex;
|
||||
};
|
||||
|
||||
} // namespace interaction
|
||||
|
||||
@@ -35,20 +35,20 @@ namespace interaction {
|
||||
class KeyboardController : public Controller {
|
||||
public:
|
||||
virtual ~KeyboardController() {};
|
||||
virtual void keyPressed(KeyAction action, Key key, KeyModifier modifier) = 0;
|
||||
virtual void keyPressed(KeyAction action, Key key, KeyModifier modifier) = 0;
|
||||
};
|
||||
|
||||
class KeyboardControllerFixed : public KeyboardController {
|
||||
public:
|
||||
void keyPressed(KeyAction action, Key key, KeyModifier modifier);
|
||||
void keyPressed(KeyAction action, Key key, KeyModifier modifier);
|
||||
};
|
||||
|
||||
class KeyboardControllerLua : public KeyboardController {
|
||||
public:
|
||||
void keyPressed(KeyAction action, Key key, KeyModifier modifier);
|
||||
void keyPressed(KeyAction action, Key key, KeyModifier modifier);
|
||||
|
||||
protected:
|
||||
std::string keyToString(Key key, KeyModifier mod) const;
|
||||
std::string keyToString(Key key, KeyModifier mod) const;
|
||||
};
|
||||
|
||||
} // namespace interaction
|
||||
|
||||
@@ -36,35 +36,35 @@ namespace openspace {
|
||||
|
||||
class LuaConsole {
|
||||
public:
|
||||
LuaConsole();
|
||||
LuaConsole();
|
||||
|
||||
void initialize();
|
||||
void deinitialize();
|
||||
|
||||
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);
|
||||
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);
|
||||
void charCallback(unsigned int codepoint, KeyModifier modifier);
|
||||
|
||||
void render();
|
||||
void render();
|
||||
|
||||
Key commandInputButton();
|
||||
|
||||
bool isVisible() const;
|
||||
void setVisible(bool visible);
|
||||
void toggleVisibility();
|
||||
|
||||
static scripting::ScriptEngine::LuaLibrary luaLibrary();
|
||||
bool isVisible() const;
|
||||
void setVisible(bool visible);
|
||||
void toggleVisibility();
|
||||
|
||||
static scripting::ScriptEngine::LuaLibrary luaLibrary();
|
||||
|
||||
|
||||
private:
|
||||
void addToCommand(std::string c);
|
||||
std::string UnicodeToUTF8(unsigned int codepoint);
|
||||
std::string UnicodeToUTF8(unsigned int codepoint);
|
||||
|
||||
size_t _inputPosition;
|
||||
std::vector<std::string> _commandsHistory;
|
||||
size_t _activeCommand;
|
||||
std::vector<std::string> _commands;
|
||||
size_t _inputPosition;
|
||||
std::vector<std::string> _commandsHistory;
|
||||
size_t _activeCommand;
|
||||
std::vector<std::string> _commands;
|
||||
|
||||
std::string _filename;
|
||||
std::string _filename;
|
||||
|
||||
struct {
|
||||
int lastIndex;
|
||||
@@ -72,7 +72,7 @@ private:
|
||||
std::string initialValue;
|
||||
} _autoCompleteInfo;
|
||||
|
||||
bool _isVisible;
|
||||
bool _isVisible;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -36,66 +36,66 @@ namespace interaction {
|
||||
|
||||
class MouseController : public Controller {
|
||||
public:
|
||||
MouseController();
|
||||
MouseController();
|
||||
virtual ~MouseController() {}
|
||||
|
||||
virtual void button(MouseButton button, MouseAction action) = 0;
|
||||
virtual void move(float x, float y) = 0;
|
||||
virtual void scrollWheel(int pos) = 0;
|
||||
virtual void update(const double& dt) = 0;
|
||||
virtual void button(MouseButton button, MouseAction action) = 0;
|
||||
virtual void move(float x, float y) = 0;
|
||||
virtual void scrollWheel(int pos) = 0;
|
||||
virtual void update(const double& dt) = 0;
|
||||
|
||||
protected:
|
||||
glm::vec3 _lastTrackballPos;
|
||||
bool _isMouseBeingPressedAndHeld;
|
||||
glm::vec3 _lastTrackballPos;
|
||||
bool _isMouseBeingPressedAndHeld;
|
||||
|
||||
glm::vec3 mapToTrackball(glm::vec2 mousePos);
|
||||
glm::vec3 mapToTrackball(glm::vec2 mousePos);
|
||||
|
||||
glm::vec3 mapToCamera(glm::vec3 trackballPos);
|
||||
glm::vec3 mapToCamera(glm::vec3 trackballPos);
|
||||
|
||||
void trackballRotate(int x, int y);
|
||||
void trackballRotate(int x, int y);
|
||||
};
|
||||
|
||||
class TrackballMouseController : public MouseController {
|
||||
public:
|
||||
TrackballMouseController();
|
||||
TrackballMouseController();
|
||||
|
||||
void button(MouseButton button, MouseAction action) override;
|
||||
void button(MouseButton button, MouseAction action) override;
|
||||
|
||||
void move(float x, float y) override;
|
||||
void move(float x, float y) override;
|
||||
|
||||
void scrollWheel(int pos) override;
|
||||
void scrollWheel(int pos) override;
|
||||
|
||||
void update(const double& dt) override;
|
||||
void update(const double& dt) override;
|
||||
|
||||
protected:
|
||||
bool _leftMouseButtonDown;
|
||||
glm::vec3 _previousTrackballPos;
|
||||
bool _leftMouseButtonDown;
|
||||
glm::vec3 _previousTrackballPos;
|
||||
};
|
||||
|
||||
class OrbitalMouseController : public MouseController {
|
||||
public:
|
||||
OrbitalMouseController();
|
||||
OrbitalMouseController();
|
||||
|
||||
void button(MouseButton button, MouseAction action) override;
|
||||
void button(MouseButton button, MouseAction action) override;
|
||||
|
||||
void move(float x, float y) override;
|
||||
void move(float x, float y) override;
|
||||
|
||||
void scrollWheel(int pos) override;
|
||||
void scrollWheel(int pos) override;
|
||||
|
||||
void update(const double& dt) override;
|
||||
void update(const double& dt) override;
|
||||
|
||||
protected:
|
||||
bool _leftMouseButtonDown;
|
||||
bool _rightMouseButtonDown;
|
||||
bool _middleMouseButtonDown;
|
||||
glm::vec2 _previousCursorPos[3];
|
||||
glm::vec2 _currentCursorPos;
|
||||
glm::vec2 _currentCursorDiff[3];
|
||||
float _rotationSpeed;
|
||||
float _navigationSpeed;
|
||||
bool _leftMouseButtonDown;
|
||||
bool _rightMouseButtonDown;
|
||||
bool _middleMouseButtonDown;
|
||||
glm::vec2 _previousCursorPos[3];
|
||||
glm::vec2 _currentCursorPos;
|
||||
glm::vec2 _currentCursorDiff[3];
|
||||
float _rotationSpeed;
|
||||
float _navigationSpeed;
|
||||
|
||||
private:
|
||||
enum MouseButtons{ ButtonLeft = 0, ButtonRight, ButtonMiddle };
|
||||
enum MouseButtons{ ButtonLeft = 0, ButtonRight, ButtonMiddle };
|
||||
};
|
||||
|
||||
} // namespace interaction
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace openspace{
|
||||
|
||||
void requestHostship(const std::string &password);
|
||||
|
||||
void setPassword(const std::string &password);
|
||||
void setPassword(const std::string &password);
|
||||
|
||||
void signalDisconnect();
|
||||
|
||||
@@ -113,23 +113,23 @@ namespace openspace{
|
||||
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();
|
||||
//@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();
|
||||
|
||||
for (hashVal = i = 0; i < len; ++i){
|
||||
hashVal += val.c_str()[i];
|
||||
hashVal += (hashVal << 10);
|
||||
hashVal ^= (hashVal >> 6);
|
||||
}
|
||||
for (hashVal = i = 0; i < len; ++i){
|
||||
hashVal += val.c_str()[i];
|
||||
hashVal += (hashVal << 10);
|
||||
hashVal ^= (hashVal >> 6);
|
||||
}
|
||||
|
||||
hashVal += (hashVal << 3);
|
||||
hashVal ^= (hashVal >> 11);
|
||||
hashVal += (hashVal << 15);
|
||||
hashVal += (hashVal << 3);
|
||||
hashVal ^= (hashVal >> 11);
|
||||
hashVal += (hashVal << 15);
|
||||
|
||||
return hashVal;
|
||||
};
|
||||
return hashVal;
|
||||
};
|
||||
|
||||
void queueMessage(std::vector<char> message);
|
||||
|
||||
@@ -137,27 +137,27 @@ namespace openspace{
|
||||
|
||||
void writeHeader(std::vector<char> &buffer, uint32_t messageType);
|
||||
|
||||
void closeSocket();
|
||||
void closeSocket();
|
||||
|
||||
bool initNetworkAPI();
|
||||
bool initNetworkAPI();
|
||||
|
||||
void establishConnection(addrinfo *info);
|
||||
void establishConnection(addrinfo *info);
|
||||
|
||||
void sendAuthentication();
|
||||
void sendAuthentication();
|
||||
|
||||
void listenCommunication();
|
||||
void listenCommunication();
|
||||
|
||||
void delegateDecoding(uint32_t type);
|
||||
void delegateDecoding(uint32_t type);
|
||||
|
||||
void initializationMessageReceived();
|
||||
void initializationMessageReceived();
|
||||
|
||||
void dataMessageReceived();
|
||||
void dataMessageReceived();
|
||||
|
||||
void hostInfoMessageReceived();
|
||||
|
||||
void initializationRequestMessageReceived();
|
||||
void hostInfoMessageReceived();
|
||||
|
||||
void initializationRequestMessageReceived();
|
||||
|
||||
void broadcast();
|
||||
void broadcast();
|
||||
|
||||
int headerSize();
|
||||
|
||||
@@ -171,15 +171,15 @@ namespace openspace{
|
||||
|
||||
std::string scriptFromPropertyAndValue(const std::string property, const std::string value);
|
||||
|
||||
uint32_t _passCode;
|
||||
uint32_t _passCode;
|
||||
std::string _port;
|
||||
std::string _address;
|
||||
std::string _name;
|
||||
_SOCKET _clientSocket;
|
||||
std::thread *_connectionThread;
|
||||
std::thread *_broadcastThread;
|
||||
std::thread *_broadcastThread;
|
||||
std::thread *_sendThread;
|
||||
std::thread *_listenThread;
|
||||
std::thread *_listenThread;
|
||||
std::thread *_handlerThread;
|
||||
std::atomic<bool> _isHost;
|
||||
std::atomic<bool> _isConnected;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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 __OPENSPACE_H__
|
||||
#define __OPENSPACE_H__
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
std::string licenseText();
|
||||
|
||||
const int OPENSPACE_VERSION_MAJOR = 0;
|
||||
const int OPENSPACE_VERSION_MINOR = 3;
|
||||
const int OPENSPACE_VERSION_PATCH = 0;
|
||||
|
||||
const std::string OPENSPACE_VERSION_STRING = "prerelease-8";
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_H__
|
||||
@@ -35,35 +35,35 @@ class NumericalProperty : public TemplateProperty<T> {
|
||||
public:
|
||||
NumericalProperty(std::string identifier, std::string guiName);
|
||||
NumericalProperty(std::string identifier, std::string guiName, T value);
|
||||
NumericalProperty(std::string identifier, std::string guiName, T value,
|
||||
T minimumValue, T maximumValue);
|
||||
NumericalProperty(std::string identifier, std::string guiName, T value,
|
||||
T minimumValue, T maximumValue);
|
||||
NumericalProperty(std::string identifier, std::string guiName, T value,
|
||||
T minimumValue, T maximumValue, T steppingValue);
|
||||
|
||||
bool getLuaValue(lua_State* state) const override;
|
||||
bool setLuaValue(lua_State* state) override;
|
||||
int typeLua() const override;
|
||||
bool getLuaValue(lua_State* state) const override;
|
||||
bool setLuaValue(lua_State* state) override;
|
||||
int typeLua() const override;
|
||||
|
||||
bool getStringValue(std::string& value) const override;
|
||||
bool setStringValue(std::string value) override;
|
||||
|
||||
T minValue() const;
|
||||
T maxValue() const;
|
||||
T minValue() const;
|
||||
T maxValue() const;
|
||||
|
||||
virtual std::string className() const override;
|
||||
|
||||
using TemplateProperty<T>::operator=;
|
||||
|
||||
protected:
|
||||
static const std::string MinimumValueKey;
|
||||
static const std::string MaximumValueKey;
|
||||
static const std::string SteppingValueKey;
|
||||
static const std::string MinimumValueKey;
|
||||
static const std::string MaximumValueKey;
|
||||
static const std::string SteppingValueKey;
|
||||
|
||||
std::string generateAdditionalDescription() const;
|
||||
std::string generateAdditionalDescription() const;
|
||||
|
||||
T _minimumValue;
|
||||
T _maximumValue;
|
||||
T _stepping;
|
||||
T _stepping;
|
||||
};
|
||||
|
||||
} // namespace properties
|
||||
|
||||
@@ -48,9 +48,9 @@ namespace properties {
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultMaximumValue<TYPE>(); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultSteppingValue<TYPE>(); \
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultSteppingValue<TYPE>(); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
@@ -104,41 +104,41 @@ namespace properties {
|
||||
std::string PropertyDelegate<TemplateProperty<TYPE>>::className() \
|
||||
{ \
|
||||
return #CLASS_NAME; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
std::string PropertyDelegate<NumericalProperty<TYPE>>::className() \
|
||||
{ \
|
||||
return PropertyDelegate<TemplateProperty<TYPE>>::className(); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultValue<TYPE>() \
|
||||
{ \
|
||||
return DEFAULT_VALUE; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultMinimumValue<TYPE>() \
|
||||
{ \
|
||||
return DEFAULT_MIN_VALUE; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultMaximumValue<TYPE>() \
|
||||
{ \
|
||||
return DEFAULT_MAX_VALUE; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultSteppingValue<TYPE>() \
|
||||
{ \
|
||||
return DEFAULT_STEPPING; \
|
||||
} \
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultSteppingValue<TYPE>() \
|
||||
{ \
|
||||
return DEFAULT_STEPPING; \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
@@ -146,7 +146,7 @@ namespace properties {
|
||||
bool& success) \
|
||||
{ \
|
||||
return FROM_LUA_LAMBDA_EXPRESSION(state, success); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
@@ -155,7 +155,7 @@ namespace properties {
|
||||
{ \
|
||||
return PropertyDelegate<TemplateProperty<TYPE>>::fromLuaValue<TYPE>(state, \
|
||||
success); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
@@ -235,33 +235,33 @@ const std::string NumericalProperty<T>::SteppingValueKey = "SteppingValue";
|
||||
template <typename T>
|
||||
NumericalProperty<T>::NumericalProperty(std::string identifier, std::string guiName)
|
||||
: NumericalProperty<T>(
|
||||
std::move(identifier), std::move(guiName),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultMinimumValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultMaximumValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultSteppingValue<T>()
|
||||
)
|
||||
std::move(identifier), std::move(guiName),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultMinimumValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultMaximumValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultSteppingValue<T>()
|
||||
)
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
NumericalProperty<T>::NumericalProperty(std::string identifier,
|
||||
std::string guiName, T value)
|
||||
: NumericalProperty<T>(
|
||||
std::move(identifier), std::move(guiName), std::move(value),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultMinimumValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultMaximumValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultSteppingValue<T>()
|
||||
)
|
||||
std::move(identifier), std::move(guiName), std::move(value),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultMinimumValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultMaximumValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultSteppingValue<T>()
|
||||
)
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
NumericalProperty<T>::NumericalProperty(std::string identifier, std::string guiName,
|
||||
T value, T minimumValue, T maximumValue)
|
||||
: NumericalProperty<T>(
|
||||
std::move(identifier) , std::move(guiName), std::move(value),
|
||||
std::move(minimumValue), std::move(maximumValue),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultSteppingValue<T>()
|
||||
)
|
||||
T value, T minimumValue, T maximumValue)
|
||||
: NumericalProperty<T>(
|
||||
std::move(identifier) , std::move(guiName), std::move(value),
|
||||
std::move(minimumValue), std::move(maximumValue),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultSteppingValue<T>()
|
||||
)
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
@@ -271,7 +271,7 @@ NumericalProperty<T>::NumericalProperty(std::string identifier,
|
||||
: TemplateProperty<T>(std::move(identifier), std::move(guiName), std::move(value))
|
||||
, _minimumValue(std::move(minimumValue))
|
||||
, _maximumValue(std::move(maximumValue))
|
||||
, _stepping(std::move(steppingValue))
|
||||
, _stepping(std::move(steppingValue))
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
@@ -282,23 +282,23 @@ std::string NumericalProperty<T>::className() const {
|
||||
template <typename T>
|
||||
bool NumericalProperty<T>::setLuaValue(lua_State* state)
|
||||
{
|
||||
bool success = false;
|
||||
T value = PropertyDelegate<NumericalProperty<T>>::template fromLuaValue<T>(state, success);
|
||||
if (success)
|
||||
TemplateProperty<T>::setValue(value);
|
||||
return success;
|
||||
bool success = false;
|
||||
T value = PropertyDelegate<NumericalProperty<T>>::template fromLuaValue<T>(state, success);
|
||||
if (success)
|
||||
TemplateProperty<T>::setValue(value);
|
||||
return success;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool NumericalProperty<T>::getLuaValue(lua_State* state) const
|
||||
{
|
||||
bool success = PropertyDelegate<NumericalProperty<T>>::template toLuaValue<T>(state, TemplateProperty<T>::_value);
|
||||
return success;
|
||||
bool success = PropertyDelegate<NumericalProperty<T>>::template toLuaValue<T>(state, TemplateProperty<T>::_value);
|
||||
return success;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int NumericalProperty<T>::typeLua() const {
|
||||
return PropertyDelegate<NumericalProperty<T>>::typeLua();
|
||||
return PropertyDelegate<NumericalProperty<T>>::typeLua();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -318,21 +318,21 @@ bool NumericalProperty<T>::setStringValue(std::string value) {
|
||||
|
||||
template <typename T>
|
||||
T NumericalProperty<T>::minValue() const {
|
||||
return _minimumValue;
|
||||
return _minimumValue;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T NumericalProperty<T>::maxValue() const {
|
||||
return _maximumValue;
|
||||
return _maximumValue;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string NumericalProperty<T>::generateAdditionalDescription() const {
|
||||
std::string result;
|
||||
result += MinimumValueKey + " = " + std::to_string(_minimumValue) + ",";
|
||||
result += MaximumValueKey + " = " + std::to_string(_maximumValue) + ",";
|
||||
result += SteppingValueKey + " = " + std::to_string(_stepping);
|
||||
return result;
|
||||
std::string result;
|
||||
result += MinimumValueKey + " = " + std::to_string(_minimumValue) + ",";
|
||||
result += MaximumValueKey + " = " + std::to_string(_maximumValue) + ",";
|
||||
result += SteppingValueKey + " = " + std::to_string(_stepping);
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace properties
|
||||
|
||||
@@ -41,58 +41,58 @@ namespace properties {
|
||||
*/
|
||||
class OptionProperty : public IntProperty {
|
||||
public:
|
||||
/**
|
||||
* The struct storing a single option consisting of an integer <code>value</code> and
|
||||
* a <code>string</code> description.
|
||||
*/
|
||||
struct Option {
|
||||
int value;
|
||||
std::string description;
|
||||
};
|
||||
/**
|
||||
* The struct storing a single option consisting of an integer <code>value</code> and
|
||||
* a <code>string</code> description.
|
||||
*/
|
||||
struct Option {
|
||||
int value;
|
||||
std::string description;
|
||||
};
|
||||
|
||||
/**
|
||||
* The constructor delegating the <code>identifier</code> and the <code>guiName</code>
|
||||
* to its super class.
|
||||
* \param identifier A unique identifier for this property
|
||||
* \param guiName The GUI name that should be used to represent this property
|
||||
*/
|
||||
OptionProperty(std::string identifier, std::string guiName);
|
||||
/**
|
||||
* The constructor delegating the <code>identifier</code> and the <code>guiName</code>
|
||||
* to its super class.
|
||||
* \param identifier A unique identifier for this property
|
||||
* \param guiName The GUI name that should be used to represent this property
|
||||
*/
|
||||
OptionProperty(std::string identifier, std::string guiName);
|
||||
|
||||
/**
|
||||
* Returns the name of the class for reflection purposes.
|
||||
* \return The name of this class for reflection purposes
|
||||
*/
|
||||
std::string className() const override;
|
||||
using IntProperty::operator=;
|
||||
/**
|
||||
* Returns the name of the class for reflection purposes.
|
||||
* \return The name of this class for reflection purposes
|
||||
*/
|
||||
std::string className() const override;
|
||||
using IntProperty::operator=;
|
||||
|
||||
/**
|
||||
* Adds the passed option to the list of available options. The <code>value</code> of
|
||||
* the <code>option</code> must not have been registered previously, or a warning will
|
||||
* be logged.
|
||||
* \param value The option that will be added to the list of available options
|
||||
/**
|
||||
* Adds the passed option to the list of available options. The <code>value</code> of
|
||||
* the <code>option</code> must not have been registered previously, or a warning will
|
||||
* be logged.
|
||||
* \param value The option that will be added to the list of available options
|
||||
* \param desc The description of the value that will be added
|
||||
*/
|
||||
void addOption(int value, std::string desc);
|
||||
*/
|
||||
void addOption(int value, std::string desc);
|
||||
|
||||
/**
|
||||
* Returns the list of available options.
|
||||
* /return The list of available options
|
||||
*/
|
||||
const std::vector<Option>& options() const;
|
||||
/**
|
||||
* Returns the list of available options.
|
||||
* /return The list of available options
|
||||
*/
|
||||
const std::vector<Option>& options() const;
|
||||
|
||||
/**
|
||||
* The overritten TemplateProperty::setValue method that checks if the provided value
|
||||
* represents a valid Option
|
||||
* \param value The value of the Option that should be set
|
||||
*/
|
||||
void setValue(int value) override;
|
||||
/**
|
||||
* The overritten TemplateProperty::setValue method that checks if the provided value
|
||||
* represents a valid Option
|
||||
* \param value The value of the Option that should be set
|
||||
*/
|
||||
void setValue(int value) override;
|
||||
|
||||
private:
|
||||
static const std::string OptionsKey;
|
||||
std::string generateAdditionalDescription() const;
|
||||
static const std::string OptionsKey;
|
||||
std::string generateAdditionalDescription() const;
|
||||
|
||||
/// The list of options which have been registered with this OptionProperty
|
||||
std::vector<Option> _options;
|
||||
/// The list of options which have been registered with this OptionProperty
|
||||
std::vector<Option> _options;
|
||||
};
|
||||
|
||||
} // namespace properties
|
||||
|
||||
@@ -62,239 +62,239 @@ class PropertyOwner;
|
||||
*/
|
||||
class Property {
|
||||
public:
|
||||
/**
|
||||
* The constructor for the property. The <code>identifier</code> needs to be unique
|
||||
* for each PropertyOwner. The <code>guiName</code> will be stored in the metaData
|
||||
* to be accessed by the GUI elements using the <code>guiName</code> key. The default
|
||||
* visibility settings is <code>true</code>, whereas the default read-only state is
|
||||
* <code>false</code>.
|
||||
* \param identifier A unique identifier for this property. It has to be unique to the
|
||||
* PropertyOwner and cannot contain any <code>.</code>s
|
||||
* \param guiName The human-readable GUI name for this Property
|
||||
*/
|
||||
/**
|
||||
* The constructor for the property. The <code>identifier</code> needs to be unique
|
||||
* for each PropertyOwner. The <code>guiName</code> will be stored in the metaData
|
||||
* to be accessed by the GUI elements using the <code>guiName</code> key. The default
|
||||
* visibility settings is <code>true</code>, whereas the default read-only state is
|
||||
* <code>false</code>.
|
||||
* \param identifier A unique identifier for this property. It has to be unique to the
|
||||
* PropertyOwner and cannot contain any <code>.</code>s
|
||||
* \param guiName The human-readable GUI name for this Property
|
||||
*/
|
||||
Property(std::string identifier, std::string guiName);
|
||||
|
||||
/**
|
||||
* The destructor taking care of deallocating all unused memory. This method will not
|
||||
* remove the Property from the PropertyOwner.
|
||||
*/
|
||||
/**
|
||||
* The destructor taking care of deallocating all unused memory. This method will not
|
||||
* remove the Property from the PropertyOwner.
|
||||
*/
|
||||
virtual ~Property();
|
||||
|
||||
/**
|
||||
* This method returns the class name of the Property. The method is used by the
|
||||
* TemplateFactory to create new instances of Propertys. The returned value is almost
|
||||
* always identical to the C++ class name of the derived class.
|
||||
* \return The class name of the Property
|
||||
*/
|
||||
/**
|
||||
* This method returns the class name of the Property. The method is used by the
|
||||
* TemplateFactory to create new instances of Propertys. The returned value is almost
|
||||
* always identical to the C++ class name of the derived class.
|
||||
* \return The class name of the Property
|
||||
*/
|
||||
virtual std::string className() const = 0;
|
||||
|
||||
/**
|
||||
* This method returns the encapsulated value of the Property to the caller. The type
|
||||
* that is returned is determined by the type function and is up to the developer of
|
||||
* the derived class. The default implementation returns an empty ghoul::any object.
|
||||
* \return The value that is encapsulated by this Property, or an empty ghoul::any
|
||||
* object if the method was not overritten.
|
||||
*/
|
||||
/**
|
||||
* This method returns the encapsulated value of the Property to the caller. The type
|
||||
* that is returned is determined by the type function and is up to the developer of
|
||||
* the derived class. The default implementation returns an empty ghoul::any object.
|
||||
* \return The value that is encapsulated by this Property, or an empty ghoul::any
|
||||
* object if the method was not overritten.
|
||||
*/
|
||||
virtual ghoul::any get() const;
|
||||
|
||||
/**
|
||||
* Sets the value encapsulated by this Property to the <code>value</code> passed to
|
||||
* this function. It is the caller's responsibility to ensure that the type contained
|
||||
* in <code>value</code> is compatible with the concrete subclass of the Property. The
|
||||
* method Property::type will return the desired type for the Property. The default
|
||||
* implementation of this method ignores the input.
|
||||
* \param value The new value that should be stored in this Property
|
||||
*/
|
||||
/**
|
||||
* Sets the value encapsulated by this Property to the <code>value</code> passed to
|
||||
* this function. It is the caller's responsibility to ensure that the type contained
|
||||
* in <code>value</code> is compatible with the concrete subclass of the Property. The
|
||||
* method Property::type will return the desired type for the Property. The default
|
||||
* implementation of this method ignores the input.
|
||||
* \param value The new value that should be stored in this Property
|
||||
*/
|
||||
virtual void set(ghoul::any value);
|
||||
|
||||
/**
|
||||
* This method returns the type that is requested by this Property for the set method.
|
||||
* The default implementation returns the type of <code>void</code>.
|
||||
* \return The type that is requested by this Property's Property::set method
|
||||
*/
|
||||
/**
|
||||
* This method returns the type that is requested by this Property for the set method.
|
||||
* The default implementation returns the type of <code>void</code>.
|
||||
* \return The type that is requested by this Property's Property::set method
|
||||
*/
|
||||
virtual const std::type_info& type() const;
|
||||
|
||||
/**
|
||||
* This method encodes the encapsulated value of this Property at the top of the Lua
|
||||
* stack. The specific details of this serialization is up to the property developer
|
||||
* as long as the rest of the stack is unchanged. The implementation has to be
|
||||
* synchronized with the Property::setLuaValue method. The default implementation is a
|
||||
* no-op.
|
||||
* \param state The Lua state to which the value will be encoded
|
||||
* \return <code>true</code> if the encoding succeeded, <code>false</code> otherwise
|
||||
*/
|
||||
virtual bool getLuaValue(lua_State* state) const;
|
||||
|
||||
/**
|
||||
* This method encodes the encapsulated value of this Property at the top of the Lua
|
||||
* stack. The specific details of this serialization is up to the property developer
|
||||
* as long as the rest of the stack is unchanged. The implementation has to be
|
||||
* synchronized with the Property::setLuaValue method. The default implementation is a
|
||||
* no-op.
|
||||
* \param state The Lua state to which the value will be encoded
|
||||
* \return <code>true</code> if the encoding succeeded, <code>false</code> otherwise
|
||||
*/
|
||||
virtual bool getLuaValue(lua_State* state) const;
|
||||
|
||||
/**
|
||||
* This method sets the value encapsulated by this Property by deserializing the value
|
||||
* on top of the passed Lua stack. The specific details of the deserialization are up
|
||||
* to the Property developer, but they must only depend on the top element of the
|
||||
* stack and must leave all other elements unchanged. The implementation has to be
|
||||
* synchronized with the Property::getLuaValue method. The default implementation is a
|
||||
* no-op.
|
||||
* \param state The Lua state from which the value will be decoded
|
||||
* \return <code>true</code> if the decoding and setting of the value succeeded,
|
||||
* <code>false</code> otherwise
|
||||
*/
|
||||
virtual bool setLuaValue(lua_State* state);
|
||||
/**
|
||||
* This method sets the value encapsulated by this Property by deserializing the value
|
||||
* on top of the passed Lua stack. The specific details of the deserialization are up
|
||||
* to the Property developer, but they must only depend on the top element of the
|
||||
* stack and must leave all other elements unchanged. The implementation has to be
|
||||
* synchronized with the Property::getLuaValue method. The default implementation is a
|
||||
* no-op.
|
||||
* \param state The Lua state from which the value will be decoded
|
||||
* \return <code>true</code> if the decoding and setting of the value succeeded,
|
||||
* <code>false</code> otherwise
|
||||
*/
|
||||
virtual bool setLuaValue(lua_State* state);
|
||||
|
||||
/**
|
||||
* Returns the Lua type that will be put onto the stack in the Property::getLua method
|
||||
* and which will be consumed by the Property::setLuaValue method. The returned value
|
||||
* can belong to the set of Lua types: <code>LUA_TNONE</code>, <code>LUA_TNIL</code>,
|
||||
* <code>LUA_TBOOLEAN</code>, <code>LUA_TLIGHTUSERDATA</code>,
|
||||
* <code>LUA_TNUMBER</code>, <code>LUA_TSTRING</code>, <code>LUA_TTABLE</code>,
|
||||
* <code>LUA_TFUNCTION</code>, <code>LUA_TUSERDATA</code>, or
|
||||
* <code>LUA_TTHREAD</code>. The default implementation will return
|
||||
* <code>LUA_TNONE</code>.
|
||||
* \return The Lua type that will be consumed or produced by the Property::getLuaValue
|
||||
/**
|
||||
* Returns the Lua type that will be put onto the stack in the Property::getLua method
|
||||
* and which will be consumed by the Property::setLuaValue method. The returned value
|
||||
* can belong to the set of Lua types: <code>LUA_TNONE</code>, <code>LUA_TNIL</code>,
|
||||
* <code>LUA_TBOOLEAN</code>, <code>LUA_TLIGHTUSERDATA</code>,
|
||||
* <code>LUA_TNUMBER</code>, <code>LUA_TSTRING</code>, <code>LUA_TTABLE</code>,
|
||||
* <code>LUA_TFUNCTION</code>, <code>LUA_TUSERDATA</code>, or
|
||||
* <code>LUA_TTHREAD</code>. The default implementation will return
|
||||
* <code>LUA_TNONE</code>.
|
||||
* \return The Lua type that will be consumed or produced by the Property::getLuaValue
|
||||
* and Property::setLuaValue methods.
|
||||
*/
|
||||
virtual int typeLua() const;
|
||||
*/
|
||||
virtual int typeLua() const;
|
||||
|
||||
/**
|
||||
* This method encodes the encapsulated value of this Property as a
|
||||
/**
|
||||
* This method encodes the encapsulated value of this Property as a
|
||||
* <code>std::string</code>. The specific details of this serialization is up to the
|
||||
* property developer. The implementation has to be synchronized with the
|
||||
Property::setStringValue method. The default implementation is a no-op.
|
||||
* \param value The value to which the Property will be encoded
|
||||
* \return <code>true</code> if the encoding succeeded, <code>false</code> otherwise
|
||||
*/
|
||||
* \param value The value to which the Property will be encoded
|
||||
* \return <code>true</code> if the encoding succeeded, <code>false</code> otherwise
|
||||
*/
|
||||
virtual bool getStringValue(std::string& value) const;
|
||||
|
||||
/**
|
||||
* This method sets the value encapsulated by this Property by deserializing the
|
||||
/**
|
||||
* This method sets the value encapsulated by this Property by deserializing the
|
||||
* passed <code>std::string</code>. The specific details of the deserialization are up
|
||||
* to the Property developer. The implementation has to be synchronized with the
|
||||
* to the Property developer. The implementation has to be synchronized with the
|
||||
* Property::getLuaValue method. The default implementation is a no-op.
|
||||
* \param value The value from which the Property will be decoded
|
||||
* \return <code>true</code> if the decoding and setting of the value succeeded,
|
||||
* <code>false</code> otherwise
|
||||
*/
|
||||
* \param value The value from which the Property will be decoded
|
||||
* \return <code>true</code> if the decoding and setting of the value succeeded,
|
||||
* <code>false</code> otherwise
|
||||
*/
|
||||
virtual bool setStringValue(std::string value);
|
||||
|
||||
/**
|
||||
* This method registers a <code>callback</code> function that will be called every
|
||||
* time if either Property:set or Property::setLuaValue was called with a value that
|
||||
/**
|
||||
* This method registers a <code>callback</code> function that will be called every
|
||||
* time if either Property:set or Property::setLuaValue was called with a value that
|
||||
* is different from the previously stored value. The callback can be removed by
|
||||
* passing an empty <code>std::function<void()></code> object.
|
||||
* \param callback The callback function that is called when the encapsulated type has
|
||||
* been successfully changed by either the Property::set or Property::setLuaValue
|
||||
* \param callback The callback function that is called when the encapsulated type has
|
||||
* been successfully changed by either the Property::set or Property::setLuaValue
|
||||
* methods.
|
||||
*/
|
||||
*/
|
||||
virtual void onChange(std::function<void()> callback);
|
||||
|
||||
/**
|
||||
* This method returns the unique identifier of this Property.
|
||||
* \return The unique identifier of this Property
|
||||
*/
|
||||
/**
|
||||
* This method returns the unique identifier of this Property.
|
||||
* \return The unique identifier of this Property
|
||||
*/
|
||||
const std::string& identifier() const;
|
||||
|
||||
/**
|
||||
* Returns the fully qualified name for this Property that uniquely identifies this
|
||||
* Property within OpenSpace. It consists of the <code>identifier</code> preceded by
|
||||
* all levels of PropertyOwner%s separated with <code>.</code>; for example:
|
||||
* <code>owner1.owner2.identifier</code>.
|
||||
* \return The fully qualified identifier for this Property
|
||||
*/
|
||||
std::string fullyQualifiedIdentifier() const;
|
||||
|
||||
/**
|
||||
* Returns the fully qualified name for this Property that uniquely identifies this
|
||||
* Property within OpenSpace. It consists of the <code>identifier</code> preceded by
|
||||
* all levels of PropertyOwner%s separated with <code>.</code>; for example:
|
||||
* <code>owner1.owner2.identifier</code>.
|
||||
* \return The fully qualified identifier for this Property
|
||||
*/
|
||||
std::string fullyQualifiedIdentifier() const;
|
||||
|
||||
/**
|
||||
* Returns the PropertyOwner of this Property or <code>nullptr</code>, if it does not
|
||||
* have an owner.
|
||||
*\ return The Property of this Property
|
||||
*/
|
||||
/**
|
||||
* Returns the PropertyOwner of this Property or <code>nullptr</code>, if it does not
|
||||
* have an owner.
|
||||
*\ return The Property of this Property
|
||||
*/
|
||||
PropertyOwner* owner() const;
|
||||
|
||||
/**
|
||||
* Assigned the Property to a new PropertyOwner. This method does not inform the
|
||||
* PropertyOwner of this action.
|
||||
* \param owner The new PropertyOwner for this Property
|
||||
*/
|
||||
/**
|
||||
* Assigned the Property to a new PropertyOwner. This method does not inform the
|
||||
* PropertyOwner of this action.
|
||||
* \param owner The new PropertyOwner for this Property
|
||||
*/
|
||||
void setPropertyOwner(PropertyOwner* owner);
|
||||
|
||||
/**
|
||||
* Returns the human-readable GUI name for this Property that has been set in the
|
||||
* constructor. This method returns the same value as accessing the metaData object
|
||||
* and requesting the <code>std::string</code> stored for the <code>guiName</code>
|
||||
* key.
|
||||
* \return The human-readable GUI name for this Property
|
||||
*/
|
||||
std::string guiName() const;
|
||||
|
||||
/**
|
||||
* Returns the human-readable GUI name for this Property that has been set in the
|
||||
* constructor. This method returns the same value as accessing the metaData object
|
||||
* and requesting the <code>std::string</code> stored for the <code>guiName</code>
|
||||
* key.
|
||||
* \return The human-readable GUI name for this Property
|
||||
*/
|
||||
std::string guiName() const;
|
||||
|
||||
/**
|
||||
* Returns the description for this Property that contains all necessary information
|
||||
* required for creating a GUI representation. The format of the description is a
|
||||
* valid Lua table, i.e., it is surrounded by a pair of <code>{</code> and
|
||||
* <code>}</code> with key,value pairs between. Each value can either be a number, a
|
||||
* string, a bool, or another table. The general values set by this base function
|
||||
* are: <code>Identifier</code>, <code>Name</code>, <code>Type</code>. All other
|
||||
* values are specific to the type and are added in a specific subclass, which require
|
||||
* the subclass to call this method first.
|
||||
* \return The descriptive text for the Property that can be used for constructing a
|
||||
* GUI representation
|
||||
*/
|
||||
virtual std::string description() const;
|
||||
/**
|
||||
* Returns the description for this Property that contains all necessary information
|
||||
* required for creating a GUI representation. The format of the description is a
|
||||
* valid Lua table, i.e., it is surrounded by a pair of <code>{</code> and
|
||||
* <code>}</code> with key,value pairs between. Each value can either be a number, a
|
||||
* string, a bool, or another table. The general values set by this base function
|
||||
* are: <code>Identifier</code>, <code>Name</code>, <code>Type</code>. All other
|
||||
* values are specific to the type and are added in a specific subclass, which require
|
||||
* the subclass to call this method first.
|
||||
* \return The descriptive text for the Property that can be used for constructing a
|
||||
* GUI representation
|
||||
*/
|
||||
virtual std::string description() const;
|
||||
|
||||
/**
|
||||
* Sets the identifier of the group that this Property belongs to. Property groups can
|
||||
* be used, for example, by GUI application to visually group different properties,
|
||||
* but it has no impact on the Property itself. The default value for the groupID is
|
||||
* <code>""</code>.
|
||||
* \param groupId The group id that this property should belong to
|
||||
*/
|
||||
/**
|
||||
* Sets the identifier of the group that this Property belongs to. Property groups can
|
||||
* be used, for example, by GUI application to visually group different properties,
|
||||
* but it has no impact on the Property itself. The default value for the groupID is
|
||||
* <code>""</code>.
|
||||
* \param groupId The group id that this property should belong to
|
||||
*/
|
||||
void setGroupIdentifier(std::string groupId);
|
||||
|
||||
/**
|
||||
* Returns the group idenfier that this Property belongs to, or <code>""</code> if it
|
||||
* belongs to no group.
|
||||
* \return The group identifier that this Property belongs to
|
||||
*/
|
||||
/**
|
||||
* Returns the group idenfier that this Property belongs to, or <code>""</code> if it
|
||||
* belongs to no group.
|
||||
* \return The group identifier that this Property belongs to
|
||||
*/
|
||||
std::string groupIdentifier() const;
|
||||
|
||||
/**
|
||||
* Determines a hint if this Property should be visible, or hidden. Each application
|
||||
* accessing the properties is free to ignore this hint. It is stored in the metaData
|
||||
* Dictionary with the key: <code>isVisible</code>. The default value is
|
||||
* <code>true</code>.
|
||||
* \param state <code>true</code> if the Property should be visible,
|
||||
* <code>false</code> otherwise.
|
||||
*/
|
||||
/**
|
||||
* Determines a hint if this Property should be visible, or hidden. Each application
|
||||
* accessing the properties is free to ignore this hint. It is stored in the metaData
|
||||
* Dictionary with the key: <code>isVisible</code>. The default value is
|
||||
* <code>true</code>.
|
||||
* \param state <code>true</code> if the Property should be visible,
|
||||
* <code>false</code> otherwise.
|
||||
*/
|
||||
void setVisible(bool state);
|
||||
|
||||
/**
|
||||
* This method determines if this Property should be read-only in external
|
||||
* applications. This setting is only a hint and does not need to be followed by GUI
|
||||
* applications and does not have any effect on the Property::set,
|
||||
/**
|
||||
* This method determines if this Property should be read-only in external
|
||||
* applications. This setting is only a hint and does not need to be followed by GUI
|
||||
* applications and does not have any effect on the Property::set,
|
||||
* Property::setLuaValue, or Property::setStringValue methods. The value is stored in
|
||||
* the metaData Dictionary with the key: <code>isReadOnly</code>. The default value is
|
||||
* <code>false</code>.
|
||||
* \param state <code>true</code> if the Property should be read only,
|
||||
* <code>false</code> otherwise
|
||||
*/
|
||||
void setReadOnly(bool state);
|
||||
* \param state <code>true</code> if the Property should be read only,
|
||||
* <code>false</code> otherwise
|
||||
*/
|
||||
void setReadOnly(bool state);
|
||||
|
||||
/**
|
||||
* This method allows the developer to give hints to the GUI about different
|
||||
* representations for the GUI. The same Property (for example Vec4Property) can be
|
||||
* used in different ways, each requiring a different input method. These values are
|
||||
* stored in the metaData object using the <code>views.</code> prefix in front of the
|
||||
* <code>option</code> parameter. See Property::ViewOptions for a default list of
|
||||
* possible options. As these are only hints, the GUI is free to ignore any suggestion
|
||||
* by the developer.
|
||||
* \param option The view option that should be modified
|
||||
* \param value Determines if the view option should be active (<code>true</code>) or
|
||||
* deactivated (<code>false</code>)
|
||||
*/
|
||||
/**
|
||||
* This method allows the developer to give hints to the GUI about different
|
||||
* representations for the GUI. The same Property (for example Vec4Property) can be
|
||||
* used in different ways, each requiring a different input method. These values are
|
||||
* stored in the metaData object using the <code>views.</code> prefix in front of the
|
||||
* <code>option</code> parameter. See Property::ViewOptions for a default list of
|
||||
* possible options. As these are only hints, the GUI is free to ignore any suggestion
|
||||
* by the developer.
|
||||
* \param option The view option that should be modified
|
||||
* \param value Determines if the view option should be active (<code>true</code>) or
|
||||
* deactivated (<code>false</code>)
|
||||
*/
|
||||
void setViewOption(std::string option, bool value = true);
|
||||
|
||||
/**
|
||||
* Default view options that can be used in the Property::setViewOption method. The
|
||||
* values are: Property::ViewOptions::Color = <code>color</code>,
|
||||
* Property::ViewOptions::LightPosition = <code>lightPosition</code>,
|
||||
* Property::ViewOptions::PowerScaledScalar = <code>powerScaledScalar</code>, and
|
||||
* Property::ViewOptions::PowerScaledCoordinate = <code>powerScaledCoordinate</code>.
|
||||
*/
|
||||
/**
|
||||
* Default view options that can be used in the Property::setViewOption method. The
|
||||
* values are: Property::ViewOptions::Color = <code>color</code>,
|
||||
* Property::ViewOptions::LightPosition = <code>lightPosition</code>,
|
||||
* Property::ViewOptions::PowerScaledScalar = <code>powerScaledScalar</code>, and
|
||||
* Property::ViewOptions::PowerScaledCoordinate = <code>powerScaledCoordinate</code>.
|
||||
*/
|
||||
struct ViewOptions {
|
||||
static const std::string Color;
|
||||
static const std::string LightPosition;
|
||||
@@ -302,68 +302,68 @@ public:
|
||||
static const std::string PowerScaledCoordinate;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the metaData that contains all information for external applications to
|
||||
* correctly display information about the Property. No information that is stored in
|
||||
* this Dictionary is necessary for the programmatic use of the Property.
|
||||
* \return The Dictionary containing all meta data information about this Property
|
||||
*/
|
||||
/**
|
||||
* Returns the metaData that contains all information for external applications to
|
||||
* correctly display information about the Property. No information that is stored in
|
||||
* this Dictionary is necessary for the programmatic use of the Property.
|
||||
* \return The Dictionary containing all meta data information about this Property
|
||||
*/
|
||||
const ghoul::Dictionary& metaData() const;
|
||||
|
||||
protected:
|
||||
static const std::string IdentifierKey;
|
||||
static const std::string NameKey;
|
||||
static const std::string TypeKey;
|
||||
static const std::string MetaDataKey;
|
||||
static const std::string IdentifierKey;
|
||||
static const std::string NameKey;
|
||||
static const std::string TypeKey;
|
||||
static const std::string MetaDataKey;
|
||||
|
||||
/**
|
||||
* Creates the information that is general to every Property and adds the
|
||||
* <code>Identifier</code>, <code>Name</code>, <code>Type</code>, and
|
||||
* <code>MetaData</code> keys and their values. The meta data is handles by the
|
||||
* generateMetaDataDescription method, which has to be overloaded if a concrete base
|
||||
* class wants to add meta data that is not curated by the Property class
|
||||
* \return The base description common to all Property classes
|
||||
*/
|
||||
std::string generateBaseDescription() const;
|
||||
/**
|
||||
* Creates the information that is general to every Property and adds the
|
||||
* <code>Identifier</code>, <code>Name</code>, <code>Type</code>, and
|
||||
* <code>MetaData</code> keys and their values. The meta data is handles by the
|
||||
* generateMetaDataDescription method, which has to be overloaded if a concrete base
|
||||
* class wants to add meta data that is not curated by the Property class
|
||||
* \return The base description common to all Property classes
|
||||
*/
|
||||
std::string generateBaseDescription() const;
|
||||
|
||||
/**
|
||||
* Creates the information for the <code>MetaData</code> key-part of the Lua
|
||||
* description for the Property. The result can be included as one key-value pair in
|
||||
* the description text generated by subclasses. Only the metadata curated by the
|
||||
* Property class is used in this method.
|
||||
* \return The metadata information text for the property
|
||||
*/
|
||||
virtual std::string generateMetaDataDescription() const;
|
||||
/**
|
||||
* Creates the information for the <code>MetaData</code> key-part of the Lua
|
||||
* description for the Property. The result can be included as one key-value pair in
|
||||
* the description text generated by subclasses. Only the metadata curated by the
|
||||
* Property class is used in this method.
|
||||
* \return The metadata information text for the property
|
||||
*/
|
||||
virtual std::string generateMetaDataDescription() const;
|
||||
|
||||
/**
|
||||
* Creates the information that is specific to each subclass of Property%s. If a
|
||||
* subclass needs to add additional information into the description, it has to
|
||||
* override this method and return the string containing all of the additional
|
||||
* information. The base implementation of the #description method will return the Lua
|
||||
* script:
|
||||
* <code>return { generateBaseDescription(), generateMetaDataDescription(),</code>
|
||||
* <code>generateAdditionalDescription()}</code>, which #generateMetaDataDescription
|
||||
* and this method being the override points to customize the behavior.
|
||||
* \return The information specific to each subclass of Property
|
||||
*/
|
||||
virtual std::string generateAdditionalDescription() const;
|
||||
/**
|
||||
* Creates the information that is specific to each subclass of Property%s. If a
|
||||
* subclass needs to add additional information into the description, it has to
|
||||
* override this method and return the string containing all of the additional
|
||||
* information. The base implementation of the #description method will return the Lua
|
||||
* script:
|
||||
* <code>return { generateBaseDescription(), generateMetaDataDescription(),</code>
|
||||
* <code>generateAdditionalDescription()}</code>, which #generateMetaDataDescription
|
||||
* and this method being the override points to customize the behavior.
|
||||
* \return The information specific to each subclass of Property
|
||||
*/
|
||||
virtual std::string generateAdditionalDescription() const;
|
||||
|
||||
/**
|
||||
* This method must be called by all subclasses whenever the encapsulated value has
|
||||
* changed and a potential listener has to be informed.
|
||||
*/
|
||||
void notifyListener();
|
||||
/**
|
||||
* This method must be called by all subclasses whenever the encapsulated value has
|
||||
* changed and a potential listener has to be informed.
|
||||
*/
|
||||
void notifyListener();
|
||||
|
||||
/// The PropetyOwner this Property belongs to, or <code>nullptr</code>
|
||||
/// The PropetyOwner this Property belongs to, or <code>nullptr</code>
|
||||
PropertyOwner* _owner;
|
||||
|
||||
/// The identifier for this Property
|
||||
/// The identifier for this Property
|
||||
std::string _identifier;
|
||||
|
||||
/// The Dictionary containing all meta data necessary for external applications
|
||||
/// The Dictionary containing all meta data necessary for external applications
|
||||
ghoul::Dictionary _metaData;
|
||||
|
||||
/// The callback function that will be invoked whenever the encapsulated value changes
|
||||
/// The callback function that will be invoked whenever the encapsulated value changes
|
||||
std::function<void()> _onChangeCallback;
|
||||
};
|
||||
|
||||
|
||||
@@ -47,108 +47,108 @@ namespace properties {
|
||||
template <typename T>
|
||||
class PropertyDelegate {
|
||||
public:
|
||||
/**
|
||||
* This method returns the class name for the class <code>T</code>. The default
|
||||
* implementation will lead to a compile-time error if the class method is not
|
||||
* specialized.
|
||||
* \return The class name for the class <code>T</code>
|
||||
*/
|
||||
/**
|
||||
* This method returns the class name for the class <code>T</code>. The default
|
||||
* implementation will lead to a compile-time error if the class method is not
|
||||
* specialized.
|
||||
* \return The class name for the class <code>T</code>
|
||||
*/
|
||||
static std::string className();
|
||||
|
||||
/**
|
||||
* This method will return the preferred default value for the class <code>T</code>.
|
||||
* The default implementation will lead to a compile-time error if the class method is
|
||||
* not specialized.
|
||||
* \return The default value that the class <code>T</code> should use
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = TemplateProperty<std::string></code>, then <code>U = std::string</code>
|
||||
*/
|
||||
/**
|
||||
* This method will return the preferred default value for the class <code>T</code>.
|
||||
* The default implementation will lead to a compile-time error if the class method is
|
||||
* not specialized.
|
||||
* \return The default value that the class <code>T</code> should use
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = TemplateProperty<std::string></code>, then <code>U = std::string</code>
|
||||
*/
|
||||
template <typename U>
|
||||
static U defaultValue();
|
||||
|
||||
/**
|
||||
* This method will return the preferred default minimum value for the class
|
||||
* <code>T</code>. The default implementation will lead to a compile-time error if the
|
||||
* class method is not specialized. This method is not used in TemplateProperty, but
|
||||
* only NumericalProperty, so the TemplateProperty does not require this method to be
|
||||
* specialized.
|
||||
* \return The default minimum value that the class <code>T</code> should use
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = NumericalProperty<int></code>, then <code>U = int</code>
|
||||
*/
|
||||
/**
|
||||
* This method will return the preferred default minimum value for the class
|
||||
* <code>T</code>. The default implementation will lead to a compile-time error if the
|
||||
* class method is not specialized. This method is not used in TemplateProperty, but
|
||||
* only NumericalProperty, so the TemplateProperty does not require this method to be
|
||||
* specialized.
|
||||
* \return The default minimum value that the class <code>T</code> should use
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = NumericalProperty<int></code>, then <code>U = int</code>
|
||||
*/
|
||||
template <typename U>
|
||||
static U defaultMinimumValue();
|
||||
|
||||
/**
|
||||
* This method will return the preferred default maximum value for the class
|
||||
* <code>T</code>. The default implementation will lead to a compile-time error if the
|
||||
* class method is not specialized. This method is not used in TemplateProperty, but
|
||||
* only NumericalProperty, so the TemplateProperty does not require this method to be
|
||||
* specialized.
|
||||
* \return The default maximum value that the class <code>T</code> should use
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = NumericalProperty<int></code>, then <code>U = int</code>
|
||||
*/
|
||||
/**
|
||||
* This method will return the preferred default maximum value for the class
|
||||
* <code>T</code>. The default implementation will lead to a compile-time error if the
|
||||
* class method is not specialized. This method is not used in TemplateProperty, but
|
||||
* only NumericalProperty, so the TemplateProperty does not require this method to be
|
||||
* specialized.
|
||||
* \return The default maximum value that the class <code>T</code> should use
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = NumericalProperty<int></code>, then <code>U = int</code>
|
||||
*/
|
||||
template <typename U>
|
||||
static U defaultMaximumValue();
|
||||
|
||||
/**
|
||||
* The method returns the default stepping value for the class <code>T</code> used in
|
||||
* GUI elements. The default implementation will lead to a compile-time error if the
|
||||
* class method is not specialized. This method is not used in TemplateProperty, but
|
||||
* only NumericalProperty, so the TemplateProperty does not require this method to be
|
||||
* specialized.
|
||||
* \return The default stepping that the class <code>T</code> should use
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = NumericalProperty<int></code>, then <code>U = int</code>
|
||||
*/
|
||||
template <typename U>
|
||||
static U defaultSteppingValue();
|
||||
/**
|
||||
* The method returns the default stepping value for the class <code>T</code> used in
|
||||
* GUI elements. The default implementation will lead to a compile-time error if the
|
||||
* class method is not specialized. This method is not used in TemplateProperty, but
|
||||
* only NumericalProperty, so the TemplateProperty does not require this method to be
|
||||
* specialized.
|
||||
* \return The default stepping that the class <code>T</code> should use
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = NumericalProperty<int></code>, then <code>U = int</code>
|
||||
*/
|
||||
template <typename U>
|
||||
static U defaultSteppingValue();
|
||||
|
||||
/**
|
||||
* This method converts the top value from the Lua stack into a value of type
|
||||
* <code>U</code> and reports the <code>success</code> back to the caller. The default
|
||||
* implementation will lead to a compile-time error if the class method is not
|
||||
* specialized.
|
||||
* \param state The Lua state from which the value is retrieved
|
||||
* \param success Will be <code>true</code> if the conversion succeeded;
|
||||
* <code>false</code> otherwise
|
||||
* \return The value that was created by converting the top value from the stack
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = TemplateProperty<std::string></code>, then <code>U = std::string</code>
|
||||
*/
|
||||
template <typename U>
|
||||
static U fromLuaValue(lua_State* state, bool& success);
|
||||
/**
|
||||
* This method converts the top value from the Lua stack into a value of type
|
||||
* <code>U</code> and reports the <code>success</code> back to the caller. The default
|
||||
* implementation will lead to a compile-time error if the class method is not
|
||||
* specialized.
|
||||
* \param state The Lua state from which the value is retrieved
|
||||
* \param success Will be <code>true</code> if the conversion succeeded;
|
||||
* <code>false</code> otherwise
|
||||
* \return The value that was created by converting the top value from the stack
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = TemplateProperty<std::string></code>, then <code>U = std::string</code>
|
||||
*/
|
||||
template <typename U>
|
||||
static U fromLuaValue(lua_State* state, bool& success);
|
||||
|
||||
/**
|
||||
* This method converts the passed <code>value</code>, encodes it and places it on the
|
||||
* top value of the Lua stack and returns the success back to the caller. The default
|
||||
* implementation will lead to a compile-time error if the class method is not
|
||||
* specialized.
|
||||
* \param state The Lua state from which the value is retrieved
|
||||
* \param value The value that will be converted into a Lua object
|
||||
* \return <code>true</code> if the conversion succeeded; <code>false</code> otherwise
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = TemplateProperty<std::string></code>, then <code>U = std::string</code>
|
||||
*/
|
||||
template <typename U>
|
||||
static bool toLuaValue(lua_State* state, U value);
|
||||
/**
|
||||
* This method converts the passed <code>value</code>, encodes it and places it on the
|
||||
* top value of the Lua stack and returns the success back to the caller. The default
|
||||
* implementation will lead to a compile-time error if the class method is not
|
||||
* specialized.
|
||||
* \param state The Lua state from which the value is retrieved
|
||||
* \param value The value that will be converted into a Lua object
|
||||
* \return <code>true</code> if the conversion succeeded; <code>false</code> otherwise
|
||||
* \tparam U The type by which the class T is specialized. If
|
||||
* <code>T = TemplateProperty<std::string></code>, then <code>U = std::string</code>
|
||||
*/
|
||||
template <typename U>
|
||||
static bool toLuaValue(lua_State* state, U value);
|
||||
|
||||
/**
|
||||
* Returns the Lua type that will be put onto the stack in the
|
||||
* PropertyDelegate::toLuaValue method and which will be consumed by the
|
||||
* PropertyDelegate::fromLuaValue method. The returned value can belong to the set of
|
||||
* Lua types: <code>LUA_TNONE</code>, <code>LUA_TNIL</code>,
|
||||
* <code>LUA_TBOOLEAN</code>, <code>LUA_TLIGHTUSERDATA</code>,
|
||||
* <code>LUA_TNUMBER</code>, <code>LUA_TSTRING</code>, <code>LUA_TTABLE</code>,
|
||||
* <code>LUA_TFUNCTION</code>, <code>LUA_TUSERDATA</code>, or
|
||||
* <code>LUA_TTHREAD</code>. The default implementation will return
|
||||
* <code>LUA_TNONE</code>. The default implementation will lead to a compile-time
|
||||
* error if the class method is not specialized.
|
||||
* \return The Lua type that will be consumed or produced by the
|
||||
* PropertyDelegate::toLuaValue and PropertyDelegate::fromLuaValue methods.
|
||||
*/
|
||||
static int typeLua();
|
||||
/**
|
||||
* Returns the Lua type that will be put onto the stack in the
|
||||
* PropertyDelegate::toLuaValue method and which will be consumed by the
|
||||
* PropertyDelegate::fromLuaValue method. The returned value can belong to the set of
|
||||
* Lua types: <code>LUA_TNONE</code>, <code>LUA_TNIL</code>,
|
||||
* <code>LUA_TBOOLEAN</code>, <code>LUA_TLIGHTUSERDATA</code>,
|
||||
* <code>LUA_TNUMBER</code>, <code>LUA_TSTRING</code>, <code>LUA_TTABLE</code>,
|
||||
* <code>LUA_TFUNCTION</code>, <code>LUA_TUSERDATA</code>, or
|
||||
* <code>LUA_TTHREAD</code>. The default implementation will return
|
||||
* <code>LUA_TNONE</code>. The default implementation will lead to a compile-time
|
||||
* error if the class method is not specialized.
|
||||
* \return The Lua type that will be consumed or produced by the
|
||||
* PropertyDelegate::toLuaValue and PropertyDelegate::fromLuaValue methods.
|
||||
*/
|
||||
static int typeLua();
|
||||
|
||||
template <typename U>
|
||||
static U fromString(std::string value, bool& success);
|
||||
|
||||
@@ -30,14 +30,14 @@ namespace properties {
|
||||
template <typename T>
|
||||
std::string PropertyDelegate<T>::className() {
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::className specialization");
|
||||
"Unimplemented PropertyDelegate::className specialization");
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename U>
|
||||
U PropertyDelegate<T>::defaultValue() {
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::defaultValue specialization");
|
||||
"Unimplemented PropertyDelegate::defaultValue specialization");
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -57,28 +57,28 @@ U PropertyDelegate<T>::defaultMaximumValue() {
|
||||
template <typename T>
|
||||
template <typename U>
|
||||
U PropertyDelegate<T>::defaultSteppingValue() {
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::defaultSteppingValue specialization");
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::defaultSteppingValue specialization");
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename U>
|
||||
U PropertyDelegate<T>::fromLuaValue(lua_State* state, bool& success) {
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::fromLuaValue specialization");
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::fromLuaValue specialization");
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename U>
|
||||
bool PropertyDelegate<T>::toLuaValue(lua_State* state, U value) {
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::toLuaValue specialization");
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::toLuaValue specialization");
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int PropertyDelegate<T>::typeLua() {
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::luaType specialization");
|
||||
static_assert(sizeof(T) == 0,
|
||||
"Unimplemented PropertyDelegate::luaType specialization");
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -49,173 +49,173 @@ namespace properties {
|
||||
*/
|
||||
class PropertyOwner {
|
||||
public:
|
||||
/// The separator that is used while accessing the properties and/or sub-owners
|
||||
/// The separator that is used while accessing the properties and/or sub-owners
|
||||
static const char URISeparator = '.';
|
||||
|
||||
/// The constructor initializing the PropertyOwner's name to <code>""</code>
|
||||
/// The constructor initializing the PropertyOwner's name to <code>""</code>
|
||||
PropertyOwner();
|
||||
|
||||
/**
|
||||
* The destructor will remove all Propertys and PropertyOwners it owns along with
|
||||
* itself.
|
||||
*/
|
||||
/**
|
||||
* The destructor will remove all Propertys and PropertyOwners it owns along with
|
||||
* itself.
|
||||
*/
|
||||
virtual ~PropertyOwner();
|
||||
|
||||
/**
|
||||
* Sets the name for this PropertyOwner. If the PropertyOwner does not have an owner
|
||||
* itself, the name must be globally unique. If the PropertyOwner has an owner, the
|
||||
* name must be unique to the owner (including the owner's properties). No uniqueness
|
||||
* check will be preformed here, but rather in the PropertyOwner::addProperty and
|
||||
* PropertyOwner::addPropertySubOwner methods).
|
||||
* \param name The name of this PropertyOwner. It may not contain any <code>.</code>s
|
||||
*/
|
||||
/**
|
||||
* Sets the name for this PropertyOwner. If the PropertyOwner does not have an owner
|
||||
* itself, the name must be globally unique. If the PropertyOwner has an owner, the
|
||||
* name must be unique to the owner (including the owner's properties). No uniqueness
|
||||
* check will be preformed here, but rather in the PropertyOwner::addProperty and
|
||||
* PropertyOwner::addPropertySubOwner methods).
|
||||
* \param name The name of this PropertyOwner. It may not contain any <code>.</code>s
|
||||
*/
|
||||
void setName(std::string name);
|
||||
|
||||
/**
|
||||
* Returns the name of this PropertyOwner.
|
||||
* \return The name of this PropertyOwner
|
||||
*/
|
||||
/**
|
||||
* Returns the name of this PropertyOwner.
|
||||
* \return The name of this PropertyOwner
|
||||
*/
|
||||
const std::string& name() const;
|
||||
|
||||
/**
|
||||
* Returns a list of all Propertys directly owned by this PropertyOwner. This list not
|
||||
* include Propertys owned by other sub-owners.
|
||||
* \return A list of all Propertys directly owned by this PropertyOwner
|
||||
*/
|
||||
/**
|
||||
* Returns a list of all Propertys directly owned by this PropertyOwner. This list not
|
||||
* include Propertys owned by other sub-owners.
|
||||
* \return A list of all Propertys directly owned by this PropertyOwner
|
||||
*/
|
||||
const std::vector<Property*>& properties() const;
|
||||
|
||||
/**
|
||||
* Returns a list of all Propertys directly or indirectly owned by this PropertyOwner.
|
||||
* \return A list of all Propertys directly or indirectly owned by this PropertyOwner
|
||||
*/
|
||||
std::vector<Property*> propertiesRecursive() const;
|
||||
/**
|
||||
* Returns a list of all Propertys directly or indirectly owned by this PropertyOwner.
|
||||
* \return A list of all Propertys directly or indirectly owned by this PropertyOwner
|
||||
*/
|
||||
std::vector<Property*> propertiesRecursive() const;
|
||||
|
||||
/**
|
||||
* Retrieves a Property identified by <code>URI</code> from this PropertyOwner. If
|
||||
* <code>id</code> does not contain a <code>.</code> the identifier must refer to a
|
||||
* Property directly owned by this PropertyOwner. If the identifier contains one or
|
||||
* more <code>.</code>, the first part of the name will be recursively extracted and
|
||||
* used as a name for a sub-owner and only the last part of the identifier is
|
||||
* referring to a Property owned by PropertyOwner named by the second-but-last name.
|
||||
* \param URI The identifier of the Property that should be extracted
|
||||
* \return If the Property cannot be found, <code>nullptr</code> is returned,
|
||||
* otherwise the pointer to the Property is returned
|
||||
*/
|
||||
/**
|
||||
* Retrieves a Property identified by <code>URI</code> from this PropertyOwner. If
|
||||
* <code>id</code> does not contain a <code>.</code> the identifier must refer to a
|
||||
* Property directly owned by this PropertyOwner. If the identifier contains one or
|
||||
* more <code>.</code>, the first part of the name will be recursively extracted and
|
||||
* used as a name for a sub-owner and only the last part of the identifier is
|
||||
* referring to a Property owned by PropertyOwner named by the second-but-last name.
|
||||
* \param URI The identifier of the Property that should be extracted
|
||||
* \return If the Property cannot be found, <code>nullptr</code> is returned,
|
||||
* otherwise the pointer to the Property is returned
|
||||
*/
|
||||
Property* property(const std::string& URI) const;
|
||||
|
||||
/**
|
||||
* This method checks if a Property with the provided <code>URI</code> exists in this
|
||||
* PropertyOwner (or any sub-owner). If the identifier contains one or more
|
||||
* <code>.</code>, the first part of the name will be recursively extracted and is
|
||||
* used as a name for a sub-owner and only the last part of the identifier is
|
||||
* referring to a Property owned by PropertyOwner named by the second-but-last name.
|
||||
* \return <code>true</code> if the <code>URI</code> refers to a Property;
|
||||
* <code>false</code> otherwise.
|
||||
*/
|
||||
/**
|
||||
* This method checks if a Property with the provided <code>URI</code> exists in this
|
||||
* PropertyOwner (or any sub-owner). If the identifier contains one or more
|
||||
* <code>.</code>, the first part of the name will be recursively extracted and is
|
||||
* used as a name for a sub-owner and only the last part of the identifier is
|
||||
* referring to a Property owned by PropertyOwner named by the second-but-last name.
|
||||
* \return <code>true</code> if the <code>URI</code> refers to a Property;
|
||||
* <code>false</code> otherwise.
|
||||
*/
|
||||
bool hasProperty(const std::string& URI) const;
|
||||
|
||||
void setPropertyOwner(PropertyOwner* owner) { _owner = owner; }
|
||||
PropertyOwner* owner() const { return _owner; }
|
||||
PropertyOwner* owner() const { return _owner; }
|
||||
|
||||
/**
|
||||
* Returns a list of all sub-owners this PropertyOwner has. Each name of a sub-owner
|
||||
* has to be unique with respect to other sub-owners as well as Property's owned by
|
||||
* this PropertyOwner.
|
||||
* \return A list of all sub-owners this PropertyOwner has
|
||||
*/
|
||||
/**
|
||||
* Returns a list of all sub-owners this PropertyOwner has. Each name of a sub-owner
|
||||
* has to be unique with respect to other sub-owners as well as Property's owned by
|
||||
* this PropertyOwner.
|
||||
* \return A list of all sub-owners this PropertyOwner has
|
||||
*/
|
||||
const std::vector<PropertyOwner*>& propertySubOwners() const;
|
||||
|
||||
/**
|
||||
* This method returns the direct sub-owner of this PropertyOwner with the provided
|
||||
* <code>name</code>. This means that <code>name</code> cannot contain any
|
||||
* <code>.</code> as this character is not allowed in PropertyOwner names. If the
|
||||
* <code>name</code> does not name a valid sub-owner of this PropertyOwner, a
|
||||
* <code>nullptr</code> will be returned.
|
||||
* \param name The name of the sub-owner that should be returned
|
||||
* \return The PropertyOwner with the given <code>name</code>, or <code>nullptr</code>
|
||||
*/
|
||||
/**
|
||||
* This method returns the direct sub-owner of this PropertyOwner with the provided
|
||||
* <code>name</code>. This means that <code>name</code> cannot contain any
|
||||
* <code>.</code> as this character is not allowed in PropertyOwner names. If the
|
||||
* <code>name</code> does not name a valid sub-owner of this PropertyOwner, a
|
||||
* <code>nullptr</code> will be returned.
|
||||
* \param name The name of the sub-owner that should be returned
|
||||
* \return The PropertyOwner with the given <code>name</code>, or <code>nullptr</code>
|
||||
*/
|
||||
PropertyOwner* propertySubOwner(const std::string& name) const;
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if this PropertyOwner owns a sub-owner with the provided
|
||||
* <code>name</code>; returns <code>false</code> otherwise.
|
||||
* \param name The name of the sub-owner that should be looked up
|
||||
* \return <code>true</code> if this PropertyOwner owns a sub-owner with the provided
|
||||
* <code>name</code>; returns <code>false</code> otherwise
|
||||
*/
|
||||
/**
|
||||
* Returns <code>true</code> if this PropertyOwner owns a sub-owner with the provided
|
||||
* <code>name</code>; returns <code>false</code> otherwise.
|
||||
* \param name The name of the sub-owner that should be looked up
|
||||
* \return <code>true</code> if this PropertyOwner owns a sub-owner with the provided
|
||||
* <code>name</code>; returns <code>false</code> otherwise
|
||||
*/
|
||||
bool hasPropertySubOwner(const std::string& name) const;
|
||||
|
||||
/**
|
||||
* This method converts a provided <code>groupID</code>, used by the Propertys, into a
|
||||
* human-readable <code>name</code> which can be used by some external application.
|
||||
* \param groupID The group identifier whose human-readable name should be set
|
||||
* \param name The human-readable name for the group identifier
|
||||
*/
|
||||
/**
|
||||
* This method converts a provided <code>groupID</code>, used by the Propertys, into a
|
||||
* human-readable <code>name</code> which can be used by some external application.
|
||||
* \param groupID The group identifier whose human-readable name should be set
|
||||
* \param name The human-readable name for the group identifier
|
||||
*/
|
||||
void setPropertyGroupName(std::string groupID, std::string name);
|
||||
|
||||
/**
|
||||
* Returns the human-readable name for the <code>groupID</code> for the Propertys of
|
||||
* this PropertyOwner.
|
||||
* \param groupID The group identifier whose human-readable name should be returned
|
||||
* \return The human readable name for the Propertys identified by
|
||||
* <code>groupID</code>
|
||||
*/
|
||||
/**
|
||||
* Returns the human-readable name for the <code>groupID</code> for the Propertys of
|
||||
* this PropertyOwner.
|
||||
* \param groupID The group identifier whose human-readable name should be returned
|
||||
* \return The human readable name for the Propertys identified by
|
||||
* <code>groupID</code>
|
||||
*/
|
||||
const std::string& propertyGroupName(const std::string& groupID) const;
|
||||
|
||||
/**
|
||||
* Assigns the Property <code>prop</code> to this PropertyOwner. This method will
|
||||
* check if the name of the Property is unique amongst Propertys and sub-owners in
|
||||
* this PropertyOwner. This method will also inform the Property about the change in
|
||||
* ownership by calling the Property::setPropertyOwner method.
|
||||
* \param prop The Property whose ownership is changed.
|
||||
*/
|
||||
/**
|
||||
* Assigns the Property <code>prop</code> to this PropertyOwner. This method will
|
||||
* check if the name of the Property is unique amongst Propertys and sub-owners in
|
||||
* this PropertyOwner. This method will also inform the Property about the change in
|
||||
* ownership by calling the Property::setPropertyOwner method.
|
||||
* \param prop The Property whose ownership is changed.
|
||||
*/
|
||||
void addProperty(Property* prop);
|
||||
|
||||
/// \see Property::addProperty(Property*)
|
||||
|
||||
/// \see Property::addProperty(Property*)
|
||||
void addProperty(Property& prop);
|
||||
|
||||
/**
|
||||
* Adds the provided PropertyOwner to the list of sub-owners for this PropertyOwner.
|
||||
* This means that the name of the <code>owner</code> has to be unique amonst the
|
||||
* direct Property's as well as other PropertyOwner's that this PropertyOwner owns.
|
||||
* This uniqueness will be tested in this method.
|
||||
* \param owner The owner that should be assigned to this PropertyOwner
|
||||
*/
|
||||
/**
|
||||
* Adds the provided PropertyOwner to the list of sub-owners for this PropertyOwner.
|
||||
* This means that the name of the <code>owner</code> has to be unique amonst the
|
||||
* direct Property's as well as other PropertyOwner's that this PropertyOwner owns.
|
||||
* This uniqueness will be tested in this method.
|
||||
* \param owner The owner that should be assigned to this PropertyOwner
|
||||
*/
|
||||
void addPropertySubOwner(PropertyOwner* owner);
|
||||
|
||||
/// \see PropertyOwner::addPropertySubOwner(PropertyOwner*)
|
||||
/// \see PropertyOwner::addPropertySubOwner(PropertyOwner*)
|
||||
void addPropertySubOwner(PropertyOwner& owner);
|
||||
|
||||
/**
|
||||
* Removes the Property from this PropertyOwner. Notifies the Property about this
|
||||
* change by calling the Property::setPropertyOwner method with a <code>nullptr</code>
|
||||
* as parameter.
|
||||
* \param prop The Property that should be removed from this PropertyOwner
|
||||
*/
|
||||
/**
|
||||
* Removes the Property from this PropertyOwner. Notifies the Property about this
|
||||
* change by calling the Property::setPropertyOwner method with a <code>nullptr</code>
|
||||
* as parameter.
|
||||
* \param prop The Property that should be removed from this PropertyOwner
|
||||
*/
|
||||
void removeProperty(Property* prop);
|
||||
|
||||
/// \see PropertyOwner::removeProperty(Property*)
|
||||
/// \see PropertyOwner::removeProperty(Property*)
|
||||
void removeProperty(Property& prop);
|
||||
|
||||
/**
|
||||
* Removes the sub-owner from this PropertyOwner.
|
||||
* \param owner The PropertyOwner that should be removed
|
||||
*/
|
||||
/**
|
||||
* Removes the sub-owner from this PropertyOwner.
|
||||
* \param owner The PropertyOwner that should be removed
|
||||
*/
|
||||
void removePropertySubOwner(PropertyOwner* owner);
|
||||
|
||||
/// \see PropertyOwner::removePropertySubOwner(PropertyOwner*)
|
||||
/// \see PropertyOwner::removePropertySubOwner(PropertyOwner*)
|
||||
void removePropertySubOwner(PropertyOwner& owner);
|
||||
|
||||
private:
|
||||
/// The name of this PropertyOwner
|
||||
/// The name of this PropertyOwner
|
||||
std::string _name;
|
||||
/// The owner of this PropertyOwner
|
||||
PropertyOwner* _owner;
|
||||
/// A list of all registered Property's
|
||||
/// The owner of this PropertyOwner
|
||||
PropertyOwner* _owner;
|
||||
/// A list of all registered Property's
|
||||
std::vector<Property*> _properties;
|
||||
/// A list of all sub-owners
|
||||
/// A list of all sub-owners
|
||||
std::vector<PropertyOwner*> _subOwners;
|
||||
/// The associations between group identifiers of Property's and human-readable names
|
||||
/// The associations between group identifiers of Property's and human-readable names
|
||||
std::map<std::string, std::string> _groupNames;
|
||||
};
|
||||
|
||||
|
||||
@@ -34,23 +34,23 @@ namespace properties {
|
||||
|
||||
class SelectionProperty : public TemplateProperty<std::vector<int>> {
|
||||
public:
|
||||
struct Option {
|
||||
int value;
|
||||
std::string description;
|
||||
};
|
||||
struct Option {
|
||||
int value;
|
||||
std::string description;
|
||||
};
|
||||
|
||||
SelectionProperty(std::string identifier, std::string guiName);
|
||||
|
||||
void addOption(Option option);
|
||||
const std::vector<Option>& options() const;
|
||||
SelectionProperty(std::string identifier, std::string guiName);
|
||||
|
||||
void addOption(Option option);
|
||||
const std::vector<Option>& options() const;
|
||||
|
||||
private:
|
||||
static const std::string OptionsKey;
|
||||
std::string generateAdditionalDescription() const;
|
||||
static const std::string OptionsKey;
|
||||
std::string generateAdditionalDescription() const;
|
||||
|
||||
/// The list of options which have been registered with this OptionProperty
|
||||
std::vector<Option> _options;
|
||||
std::vector<int> _values;
|
||||
/// The list of options which have been registered with this OptionProperty
|
||||
std::vector<Option> _options;
|
||||
std::vector<int> _values;
|
||||
};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -52,135 +52,135 @@ namespace properties {
|
||||
template <typename T>
|
||||
class TemplateProperty : public Property {
|
||||
public:
|
||||
typedef T ValueType;
|
||||
typedef T ValueType;
|
||||
|
||||
/**
|
||||
* The constructor initializing the TemplateProperty with the provided
|
||||
* <code>identifier</code> and human-readable <code>guiName</code>. The default value
|
||||
* for the stored type <code>T</code> is retrieved using the PropertyDelegate's
|
||||
* PropertyDelegate::defaultValue method, which must be specialized for new types or
|
||||
* a compile-error will occur.
|
||||
* \param identifier The identifier that is used for this TemplateProperty
|
||||
* \param guiName The human-readable GUI name for this TemplateProperty
|
||||
*/
|
||||
/**
|
||||
* The constructor initializing the TemplateProperty with the provided
|
||||
* <code>identifier</code> and human-readable <code>guiName</code>. The default value
|
||||
* for the stored type <code>T</code> is retrieved using the PropertyDelegate's
|
||||
* PropertyDelegate::defaultValue method, which must be specialized for new types or
|
||||
* a compile-error will occur.
|
||||
* \param identifier The identifier that is used for this TemplateProperty
|
||||
* \param guiName The human-readable GUI name for this TemplateProperty
|
||||
*/
|
||||
TemplateProperty(std::string identifier, std::string guiName);
|
||||
|
||||
/**
|
||||
* The constructor initializing the TemplateProperty with the provided
|
||||
* <code>identifier</code>, human-readable <code>guiName</code> and provided
|
||||
* <code>value</code>.
|
||||
*/
|
||||
/**
|
||||
* The constructor initializing the TemplateProperty with the provided
|
||||
* <code>identifier</code>, human-readable <code>guiName</code> and provided
|
||||
* <code>value</code>.
|
||||
*/
|
||||
TemplateProperty(std::string identifier, std::string guiName, T value);
|
||||
|
||||
/**
|
||||
* Returns the class name for this TemplateProperty. The default implementation makes
|
||||
* a call to the PropertyDelegate::className method with the template parameter
|
||||
* <code>T</code> as argument. For this to work, that method needs to be specialized
|
||||
* to return the correct class name for the new template parameter T, or a
|
||||
* compile-time error will occur.
|
||||
* \return The class name for the TemplateProperty
|
||||
*/
|
||||
/**
|
||||
* Returns the class name for this TemplateProperty. The default implementation makes
|
||||
* a call to the PropertyDelegate::className method with the template parameter
|
||||
* <code>T</code> as argument. For this to work, that method needs to be specialized
|
||||
* to return the correct class name for the new template parameter T, or a
|
||||
* compile-time error will occur.
|
||||
* \return The class name for the TemplateProperty
|
||||
*/
|
||||
virtual std::string className() const override;
|
||||
|
||||
/**
|
||||
* Returns the stored value packed into a ghoul::any object.
|
||||
* \return The stored value packed into a ghoul::any object
|
||||
*/
|
||||
/**
|
||||
* Returns the stored value packed into a ghoul::any object.
|
||||
* \return The stored value packed into a ghoul::any object
|
||||
*/
|
||||
virtual ghoul::any get() const override;
|
||||
|
||||
/**
|
||||
* Sets the value fro the provided ghoul::any object. If the types between
|
||||
/**
|
||||
* Sets the value fro the provided ghoul::any object. If the types between
|
||||
* <code>T</code> and <code>value</code> disagree, an error is logged and the stored
|
||||
* value remains unchanged.
|
||||
*/
|
||||
*/
|
||||
virtual void set(ghoul::any value) override;
|
||||
|
||||
/**
|
||||
* Returns the <code>std::type_info</code> describing the template parameter
|
||||
* <code>T</code>. It can be used to test against a ghoul::any value before trying to
|
||||
/**
|
||||
* Returns the <code>std::type_info</code> describing the template parameter
|
||||
* <code>T</code>. It can be used to test against a ghoul::any value before trying to
|
||||
* assign it.
|
||||
* \return The type info object describing the template parameter <code>T</code>
|
||||
*/
|
||||
* \return The type info object describing the template parameter <code>T</code>
|
||||
*/
|
||||
virtual const std::type_info& type() const override;
|
||||
|
||||
/**
|
||||
* This method encodes the stored value into a Lua object and pushes that object onto
|
||||
* the stack. The encoding is performed by calling PropertyDelegate::toLuaValue with
|
||||
* the template parameter <code>T</code> as an argument. This method has to be
|
||||
* specialized for each new type, or a compile-time error will occur.
|
||||
* \param state The Lua state onto which the encoded object will be pushed
|
||||
* \return <code>true</code> if the encoding succeeded; <code>false</code> otherwise
|
||||
*/
|
||||
bool getLuaValue(lua_State* state) const override;
|
||||
/**
|
||||
* This method encodes the stored value into a Lua object and pushes that object onto
|
||||
* the stack. The encoding is performed by calling PropertyDelegate::toLuaValue with
|
||||
* the template parameter <code>T</code> as an argument. This method has to be
|
||||
* specialized for each new type, or a compile-time error will occur.
|
||||
* \param state The Lua state onto which the encoded object will be pushed
|
||||
* \return <code>true</code> if the encoding succeeded; <code>false</code> otherwise
|
||||
*/
|
||||
bool getLuaValue(lua_State* state) const override;
|
||||
|
||||
/**
|
||||
* Sets the value of this TemplateProprty by decoding the object at the top of the Lua
|
||||
* stack and, if successful, assigning it using the Property::set method. The decoding
|
||||
* is performed by calling the PropertyDelegate::fromLuaValue with the template
|
||||
* parameter <code>T</code> as argument. If the decoding is successful, the new value
|
||||
* is set, otherwise it remains unchanged.
|
||||
* \param state The Lua state from which the value will be decoded
|
||||
* \return <code>true</code> if the decoding succeeded; <code>false</code> otherwise
|
||||
*/
|
||||
bool setLuaValue(lua_State* state) override;
|
||||
/**
|
||||
* Sets the value of this TemplateProprty by decoding the object at the top of the Lua
|
||||
* stack and, if successful, assigning it using the Property::set method. The decoding
|
||||
* is performed by calling the PropertyDelegate::fromLuaValue with the template
|
||||
* parameter <code>T</code> as argument. If the decoding is successful, the new value
|
||||
* is set, otherwise it remains unchanged.
|
||||
* \param state The Lua state from which the value will be decoded
|
||||
* \return <code>true</code> if the decoding succeeded; <code>false</code> otherwise
|
||||
*/
|
||||
bool setLuaValue(lua_State* state) override;
|
||||
|
||||
/// \see Property::typeLua
|
||||
int typeLua() const override;
|
||||
/// \see Property::typeLua
|
||||
int typeLua() const override;
|
||||
|
||||
bool getStringValue(std::string& value) const override;
|
||||
|
||||
bool setStringValue(std::string value) override;
|
||||
|
||||
/**
|
||||
* Returns the description for this TemplateProperty as a Lua script that returns a
|
||||
* table on execution
|
||||
* \return The description for this TemplateProperty
|
||||
*/
|
||||
//virtual std::string description() override;
|
||||
/**
|
||||
* Returns the description for this TemplateProperty as a Lua script that returns a
|
||||
* table on execution
|
||||
* \return The description for this TemplateProperty
|
||||
*/
|
||||
//virtual std::string description() override;
|
||||
|
||||
/**
|
||||
* This operator allows the TemplateProperty to be used almost transparently as if it
|
||||
* was of the type <code>T</code>. It makes assignments such as
|
||||
* <code>T v = property;</code> possible by allowing implicit casts (even though,
|
||||
* internally, not casts are performed. This method is next to zero overhead).
|
||||
* \return The internal representation of the Property
|
||||
*/
|
||||
/**
|
||||
* This operator allows the TemplateProperty to be used almost transparently as if it
|
||||
* was of the type <code>T</code>. It makes assignments such as
|
||||
* <code>T v = property;</code> possible by allowing implicit casts (even though,
|
||||
* internally, not casts are performed. This method is next to zero overhead).
|
||||
* \return The internal representation of the Property
|
||||
*/
|
||||
operator T();
|
||||
|
||||
/**
|
||||
* This operator allows the TemplateProperty to be used almost transparently as if it
|
||||
* was of the type <code>T</code>. It makes assignments such as
|
||||
* <code>T v = property;</code> possible by allowing implicit casts (even though,
|
||||
* internally, not casts are performed. This method is next to zero overhead).
|
||||
* \return The internal representation of the Property
|
||||
*/
|
||||
operator T() const;
|
||||
/**
|
||||
* This operator allows the TemplateProperty to be used almost transparently as if it
|
||||
* was of the type <code>T</code>. It makes assignments such as
|
||||
* <code>T v = property;</code> possible by allowing implicit casts (even though,
|
||||
* internally, not casts are performed. This method is next to zero overhead).
|
||||
* \return The internal representation of the Property
|
||||
*/
|
||||
operator T() const;
|
||||
|
||||
/**
|
||||
* The assignment operator allows the TemplateProperty's value to be set without using
|
||||
* the TemplateProperty::set method. It will be done internally by thos method and it
|
||||
* allows assignments such as <code>prop = T(1)</code>.
|
||||
* \param val The value that should be set.
|
||||
*/
|
||||
/**
|
||||
* The assignment operator allows the TemplateProperty's value to be set without using
|
||||
* the TemplateProperty::set method. It will be done internally by thos method and it
|
||||
* allows assignments such as <code>prop = T(1)</code>.
|
||||
* \param val The value that should be set.
|
||||
*/
|
||||
TemplateProperty<T>& operator=(T val);
|
||||
|
||||
/**
|
||||
* These method sets the stored value to the provided value <code>val</code>,
|
||||
* moving it into place. This move only happens if the provided value <code>val</code>
|
||||
* is different from the stored value, which needs an operator== to exist for the type
|
||||
* <code>T</code>. If the value are different, the listeners are notified.
|
||||
* \param val The new value for this TemplateProperty
|
||||
*/
|
||||
/**
|
||||
* These method sets the stored value to the provided value <code>val</code>,
|
||||
* moving it into place. This move only happens if the provided value <code>val</code>
|
||||
* is different from the stored value, which needs an operator== to exist for the type
|
||||
* <code>T</code>. If the value are different, the listeners are notified.
|
||||
* \param val The new value for this TemplateProperty
|
||||
*/
|
||||
virtual void setValue(T val);
|
||||
|
||||
/**
|
||||
* Returns the currently stored value.
|
||||
* \return The currently stored value
|
||||
*/
|
||||
/**
|
||||
* Returns the currently stored value.
|
||||
* \return The currently stored value
|
||||
*/
|
||||
T value() const;
|
||||
|
||||
protected:
|
||||
/// The value that this TemplateProperty currently stores
|
||||
/// The value that this TemplateProperty currently stores
|
||||
T _value;
|
||||
};
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace properties {
|
||||
|
||||
// The following macros can be used to quickly generate the necessary PropertyDelegate
|
||||
// specializations required by the TemplateProperty class. Use the
|
||||
// REGISTER_TEMPLATEPROPERTY_HEADER macro in the header file and the
|
||||
// REGISTER_TEMPLATEPROPERTY_HEADER macro in the header file and the
|
||||
// REGISTER_TEMPLATEPROPERTY_SOURCE macro in the source file of your new specialization of
|
||||
// a TemplateProperty
|
||||
|
||||
@@ -77,13 +77,13 @@ namespace properties {
|
||||
// DEFAULT_VALUE = The value (as type T) which should be used as a default value
|
||||
// FROM_LUA_LAMBDA_EXPRESSION = A lambda expression receiving a lua_State* as the first
|
||||
// parameter, a bool& as the second parameter and returning
|
||||
// a value T. It is used by the fromLua method of
|
||||
// TemplateProperty. The lambda expression must extract the
|
||||
// stored value from the lua_State, return the value and
|
||||
// report success in the second argument
|
||||
// a value T. It is used by the fromLua method of
|
||||
// TemplateProperty. The lambda expression must extract the
|
||||
// stored value from the lua_State, return the value and
|
||||
// report success in the second argument
|
||||
// TO_LUA_LAMBDA_EXPRESSION = A lambda expression receiving a lua_State*, a value T and
|
||||
// returning a bool. The lambda expression must encode the
|
||||
// value T onto the lua_State stack and return the success
|
||||
// value T onto the lua_State stack and return the success
|
||||
// LUA_TYPE = The Lua type that will be produced/consumed by the previous
|
||||
// Lambda expressions
|
||||
#define REGISTER_TEMPLATEPROPERTY_SOURCE(CLASS_NAME, TYPE, DEFAULT_VALUE, \
|
||||
@@ -170,7 +170,7 @@ std::string TemplateProperty<T>::className() const {
|
||||
|
||||
//template <typename T>
|
||||
//std::string TemplateProperty<T>::description() {
|
||||
// return
|
||||
// return
|
||||
//}
|
||||
|
||||
template <typename T>
|
||||
@@ -180,7 +180,7 @@ TemplateProperty<T>::operator T() {
|
||||
|
||||
template <typename T>
|
||||
TemplateProperty<T>::operator T() const {
|
||||
return _value;
|
||||
return _value;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -198,11 +198,11 @@ T openspace::properties::TemplateProperty<T>::value() const
|
||||
template <typename T>
|
||||
void openspace::properties::TemplateProperty<T>::setValue(T val)
|
||||
{
|
||||
const bool changed = (val != _value);
|
||||
if (changed) {
|
||||
_value = std::move(val);
|
||||
notifyListener();
|
||||
}
|
||||
const bool changed = (val != _value);
|
||||
if (changed) {
|
||||
_value = std::move(val);
|
||||
notifyListener();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -220,14 +220,14 @@ template <typename T>
|
||||
void TemplateProperty<T>::set(ghoul::any value) {
|
||||
try {
|
||||
T v = ghoul::any_cast<T>(std::move(value));
|
||||
if (v != _value) {
|
||||
_value = std::move(v);
|
||||
notifyListener();
|
||||
}
|
||||
if (v != _value) {
|
||||
_value = std::move(v);
|
||||
notifyListener();
|
||||
}
|
||||
}
|
||||
catch (ghoul::bad_any_cast&) {
|
||||
LERRORC("TemplateProperty", "Illegal cast from '" << value.type().name()
|
||||
<< "' to '" << typeid(T).name() << "'");
|
||||
<< "' to '" << typeid(T).name() << "'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,16 +244,16 @@ bool TemplateProperty<T>::getLuaValue(lua_State* state) const {
|
||||
|
||||
template <typename T>
|
||||
bool TemplateProperty<T>::setLuaValue(lua_State* state) {
|
||||
bool success = false;
|
||||
T thisValue = PropertyDelegate<TemplateProperty<T>>::template fromLuaValue<T>(state, success);
|
||||
if (success)
|
||||
set(ghoul::any(thisValue));
|
||||
return success;
|
||||
bool success = false;
|
||||
T thisValue = PropertyDelegate<TemplateProperty<T>>::template fromLuaValue<T>(state, success);
|
||||
if (success)
|
||||
set(ghoul::any(thisValue));
|
||||
return success;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int TemplateProperty<T>::typeLua() const {
|
||||
return PropertyDelegate<TemplateProperty<T>>::typeLua();
|
||||
return PropertyDelegate<TemplateProperty<T>>::typeLua();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -36,34 +36,34 @@ namespace properties {
|
||||
*/
|
||||
class TriggerProperty : public Property {
|
||||
public:
|
||||
/**
|
||||
* Initializes the TriggerProperty by delegating the <code>identifier</code> and
|
||||
* <code>guiName</code> to the Property constructor.
|
||||
* \param identifier The unique identifier used for this Property
|
||||
* \param guiName The human-readable name of this Property
|
||||
*/
|
||||
TriggerProperty(std::string identifier, std::string guiName);
|
||||
/**
|
||||
* Initializes the TriggerProperty by delegating the <code>identifier</code> and
|
||||
* <code>guiName</code> to the Property constructor.
|
||||
* \param identifier The unique identifier used for this Property
|
||||
* \param guiName The human-readable name of this Property
|
||||
*/
|
||||
TriggerProperty(std::string identifier, std::string guiName);
|
||||
|
||||
/**
|
||||
* Returns the class name <code>TriggerProperty</code>.
|
||||
* \return The class name <code>TriggerProperty</code>
|
||||
*/
|
||||
std::string className() const;
|
||||
/**
|
||||
* Returns the class name <code>TriggerProperty</code>.
|
||||
* \return The class name <code>TriggerProperty</code>
|
||||
*/
|
||||
std::string className() const;
|
||||
|
||||
/**
|
||||
* Accepts only the <code>LUA_TNIL</code> type and will notify all the listeners
|
||||
* that the event has been triggered.
|
||||
* \param state The unused Lua state
|
||||
* \return Returns always <code>true</code>
|
||||
*/
|
||||
bool setLuaValue(lua_State* state);
|
||||
/**
|
||||
* Accepts only the <code>LUA_TNIL</code> type and will notify all the listeners
|
||||
* that the event has been triggered.
|
||||
* \param state The unused Lua state
|
||||
* \return Returns always <code>true</code>
|
||||
*/
|
||||
bool setLuaValue(lua_State* state);
|
||||
|
||||
/**
|
||||
* Silently ignores any value that is passed into this function and will trigger the
|
||||
* listeners regardless of the value
|
||||
* \param value The ignored value
|
||||
*/
|
||||
void set(ghoul::any value);
|
||||
/**
|
||||
* Silently ignores any value that is passed into this function and will trigger the
|
||||
* listeners regardless of the value
|
||||
* \param value The ignored value
|
||||
*/
|
||||
void set(ghoul::any value);
|
||||
};
|
||||
|
||||
} // namespace properties
|
||||
|
||||
@@ -41,14 +41,14 @@
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
namespace ghoul {
|
||||
|
||||
|
||||
namespace filesystem {
|
||||
class File;
|
||||
}
|
||||
namespace opengl {
|
||||
namespace opengl {
|
||||
class ProgramObject;
|
||||
class Texture;
|
||||
}
|
||||
class Texture;
|
||||
}
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
@@ -56,11 +56,11 @@ namespace openspace {
|
||||
class RenderableVolume;
|
||||
class Camera;
|
||||
class Scene;
|
||||
|
||||
|
||||
class ABufferRenderer : public Renderer, public RaycasterListener {
|
||||
public:
|
||||
ABufferRenderer();
|
||||
virtual ~ABufferRenderer();
|
||||
ABufferRenderer();
|
||||
virtual ~ABufferRenderer();
|
||||
|
||||
void initialize() override;
|
||||
void deinitialize() override;
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
void setResolution(glm::ivec2 res) override;
|
||||
|
||||
void update();
|
||||
void render(float blackoutFactor, bool doPerformanceMeasurements) override;
|
||||
void render(float blackoutFactor, bool doPerformanceMeasurements) override;
|
||||
|
||||
|
||||
/**
|
||||
@@ -120,7 +120,7 @@ private:
|
||||
int _nAaSamples;
|
||||
|
||||
ghoul::Dictionary _rendererData;
|
||||
}; // ABufferRenderer
|
||||
} // openspace
|
||||
}; // ABufferRenderer
|
||||
} // openspace
|
||||
|
||||
#endif // __RENDERER_H__
|
||||
#endif // __RENDERER_H__
|
||||
|
||||
@@ -37,15 +37,15 @@
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
namespace ghoul {
|
||||
class Dictionary;
|
||||
|
||||
class Dictionary;
|
||||
|
||||
namespace filesystem {
|
||||
class File;
|
||||
}
|
||||
namespace opengl {
|
||||
namespace opengl {
|
||||
class ProgramObject;
|
||||
class Texture;
|
||||
}
|
||||
class Texture;
|
||||
}
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
@@ -53,11 +53,11 @@ namespace openspace {
|
||||
class RenderableVolume;
|
||||
class Camera;
|
||||
class Scene;
|
||||
|
||||
|
||||
class FramebufferRenderer : public Renderer, public RaycasterListener {
|
||||
public:
|
||||
FramebufferRenderer();
|
||||
virtual ~FramebufferRenderer();
|
||||
FramebufferRenderer();
|
||||
virtual ~FramebufferRenderer();
|
||||
|
||||
void initialize() override;
|
||||
void deinitialize() override;
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
void setResolution(glm::ivec2 res) override;
|
||||
|
||||
void update() override;
|
||||
void render(float blackoutFactor, bool doPerformanceMeasurements) override;
|
||||
void render(float blackoutFactor, bool doPerformanceMeasurements) override;
|
||||
|
||||
/**
|
||||
* Update render data
|
||||
@@ -105,7 +105,7 @@ private:
|
||||
int _nAaSamples;
|
||||
|
||||
ghoul::Dictionary _rendererData;
|
||||
}; // FramebufferRenderer
|
||||
} // openspace
|
||||
}; // FramebufferRenderer
|
||||
} // openspace
|
||||
|
||||
#endif // __FRAMEBUFFERRENDERER_H__
|
||||
#endif // __FRAMEBUFFERRENDERER_H__
|
||||
|
||||
@@ -36,10 +36,10 @@
|
||||
|
||||
// Forward declare to minimize dependencies
|
||||
namespace ghoul {
|
||||
namespace opengl {
|
||||
class Texture;
|
||||
}
|
||||
class Dictionary;
|
||||
namespace opengl {
|
||||
class Texture;
|
||||
}
|
||||
class Dictionary;
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
@@ -60,8 +60,8 @@ public:
|
||||
virtual bool initialize() = 0;
|
||||
virtual bool deinitialize() = 0;
|
||||
|
||||
virtual bool isReady() const = 0;
|
||||
bool isEnabled() const;
|
||||
virtual bool isReady() const = 0;
|
||||
bool isEnabled() const;
|
||||
|
||||
void setBoundingSphere(const PowerScaledScalar& boundingSphere);
|
||||
const PowerScaledScalar& getBoundingSphere();
|
||||
@@ -70,29 +70,29 @@ public:
|
||||
virtual void render(const RenderData& data, RendererTasks& rendererTask);
|
||||
virtual void update(const UpdateData& data);
|
||||
|
||||
bool isVisible() const;
|
||||
|
||||
bool hasTimeInterval();
|
||||
bool getInterval(double& start, double& end);
|
||||
|
||||
bool hasBody();
|
||||
bool getBody(std::string& body);
|
||||
void setBody(std::string& body);
|
||||
bool isVisible() const;
|
||||
|
||||
bool hasTimeInterval();
|
||||
bool getInterval(double& start, double& end);
|
||||
|
||||
bool hasBody();
|
||||
bool getBody(std::string& body);
|
||||
void setBody(std::string& body);
|
||||
|
||||
void onEnabledChange(std::function<void(bool)> callback);
|
||||
|
||||
static void setPscUniforms(ghoul::opengl::ProgramObject& program, const Camera& camera, const PowerScaledCoordinate& position);
|
||||
|
||||
protected:
|
||||
properties::BoolProperty _enabled;
|
||||
|
||||
properties::BoolProperty _enabled;
|
||||
|
||||
private:
|
||||
PowerScaledScalar boundingSphere_;
|
||||
std::string _startTime;
|
||||
std::string _endTime;
|
||||
std::string _targetBody;
|
||||
bool _hasBody;
|
||||
bool _hasTimeInterval;
|
||||
std::string _startTime;
|
||||
std::string _endTime;
|
||||
std::string _targetBody;
|
||||
bool _hasBody;
|
||||
bool _hasTimeInterval;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -62,16 +62,16 @@ public:
|
||||
Invalid
|
||||
};
|
||||
|
||||
static const std::string PerformanceMeasurementSharedData;
|
||||
static const std::string PerformanceMeasurementSharedData;
|
||||
|
||||
static const std::string KeyFontMono;
|
||||
static const std::string KeyFontLight;
|
||||
|
||||
RenderEngine();
|
||||
~RenderEngine();
|
||||
|
||||
bool initialize();
|
||||
bool deinitialize();
|
||||
RenderEngine();
|
||||
~RenderEngine();
|
||||
|
||||
bool initialize();
|
||||
bool deinitialize();
|
||||
|
||||
void setSceneGraph(Scene* sceneGraph);
|
||||
Scene* scene();
|
||||
@@ -81,24 +81,24 @@ public:
|
||||
RendererImplementation rendererImplementation() const;
|
||||
RaycasterManager& raycasterManager();
|
||||
|
||||
// sgct wrapped functions
|
||||
// sgct wrapped functions
|
||||
bool initializeGL();
|
||||
void postSynchronizationPreDraw();
|
||||
void preSynchronization();
|
||||
void render(const glm::mat4 &projectionMatrix, const glm::mat4 &viewMatrix);
|
||||
void preSynchronization();
|
||||
void render(const glm::mat4 &projectionMatrix, const glm::mat4 &viewMatrix);
|
||||
void postDraw();
|
||||
|
||||
void takeScreenshot();
|
||||
void toggleInfoText(bool b);
|
||||
void takeScreenshot();
|
||||
void toggleInfoText(bool b);
|
||||
|
||||
void setPerformanceMeasurements(bool performanceMeasurements);
|
||||
bool doesPerformanceMeasurements() const;
|
||||
void setPerformanceMeasurements(bool performanceMeasurements);
|
||||
bool doesPerformanceMeasurements() const;
|
||||
|
||||
void serialize(SyncBuffer* syncBuffer);
|
||||
void deserialize(SyncBuffer* syncBuffer);
|
||||
void serialize(SyncBuffer* syncBuffer);
|
||||
void deserialize(SyncBuffer* syncBuffer);
|
||||
|
||||
float globalBlackOutFactor();
|
||||
void setGlobalBlackOutFactor(float factor);
|
||||
float globalBlackOutFactor();
|
||||
void setGlobalBlackOutFactor(float factor);
|
||||
|
||||
void setDisableRenderingOnMaster(bool enabled);
|
||||
|
||||
@@ -129,18 +129,18 @@ public:
|
||||
* as a 'rendererData' variable in the dictionary.
|
||||
*/
|
||||
void setRendererData(const ghoul::Dictionary& renderer);
|
||||
|
||||
/**
|
||||
* Returns the Lua library that contains all Lua functions available to affect the
|
||||
* rendering.
|
||||
*/
|
||||
static scripting::ScriptEngine::LuaLibrary luaLibrary();
|
||||
|
||||
/**
|
||||
* Returns the Lua library that contains all Lua functions available to affect the
|
||||
* rendering.
|
||||
*/
|
||||
static scripting::ScriptEngine::LuaLibrary luaLibrary();
|
||||
|
||||
// This is a temporary method to change the origin of the coordinate system ---abock
|
||||
void changeViewPoint(std::string origin);
|
||||
|
||||
// Temporary fade functionality
|
||||
void startFading(int direction, float fadeDuration);
|
||||
// Temporary fade functionality
|
||||
void startFading(int direction, float fadeDuration);
|
||||
|
||||
void sortScreenspaceRenderables();
|
||||
// This is temporary until a proper screenspace solution is found ---abock
|
||||
@@ -153,30 +153,30 @@ public:
|
||||
private:
|
||||
void setRenderer(std::unique_ptr<Renderer> renderer);
|
||||
RendererImplementation rendererFromString(const std::string& method);
|
||||
void storePerformanceMeasurements();
|
||||
void storePerformanceMeasurements();
|
||||
void renderInformation();
|
||||
void renderScreenLog();
|
||||
|
||||
Camera* _mainCamera;
|
||||
Scene* _sceneGraph;
|
||||
Camera* _mainCamera;
|
||||
Scene* _sceneGraph;
|
||||
RaycasterManager* _raycasterManager;
|
||||
|
||||
std::unique_ptr<Renderer> _renderer;
|
||||
RendererImplementation _rendererImplementation;
|
||||
ghoul::Dictionary _rendererData;
|
||||
ScreenLog* _log;
|
||||
ScreenLog* _log;
|
||||
|
||||
bool _showInfo;
|
||||
bool _showLog;
|
||||
bool _takeScreenshot;
|
||||
bool _showInfo;
|
||||
bool _showLog;
|
||||
bool _takeScreenshot;
|
||||
|
||||
bool _doPerformanceMeasurements;
|
||||
ghoul::SharedMemory* _performanceMemory;
|
||||
bool _doPerformanceMeasurements;
|
||||
ghoul::SharedMemory* _performanceMemory;
|
||||
|
||||
float _globalBlackOutFactor;
|
||||
float _fadeDuration;
|
||||
float _currentFadeTime;
|
||||
int _fadeDirection;
|
||||
float _globalBlackOutFactor;
|
||||
float _fadeDuration;
|
||||
float _currentFadeTime;
|
||||
int _fadeDirection;
|
||||
|
||||
std::vector<ghoul::opengl::ProgramObject*> _programs;
|
||||
std::vector<std::shared_ptr<ScreenSpaceRenderable>> _screenSpaceRenderables;
|
||||
|
||||
@@ -33,15 +33,15 @@
|
||||
#include <map>
|
||||
|
||||
namespace ghoul {
|
||||
class Dictionary;
|
||||
|
||||
class Dictionary;
|
||||
|
||||
namespace filesystem {
|
||||
class File;
|
||||
}
|
||||
namespace opengl {
|
||||
namespace opengl {
|
||||
class ProgramObject;
|
||||
class Texture;
|
||||
}
|
||||
class Texture;
|
||||
}
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
@@ -49,7 +49,7 @@ namespace openspace {
|
||||
class RenderableVolume;
|
||||
class Camera;
|
||||
class Scene;
|
||||
|
||||
|
||||
class Renderer {
|
||||
public:
|
||||
virtual void initialize() = 0;
|
||||
@@ -60,14 +60,14 @@ public:
|
||||
virtual void setResolution(glm::ivec2 res) = 0;
|
||||
|
||||
virtual void update() = 0;
|
||||
virtual void render(float blackoutFactor, bool doPerformanceMeasurements) = 0;
|
||||
virtual void render(float blackoutFactor, bool doPerformanceMeasurements) = 0;
|
||||
/**
|
||||
* Update render data
|
||||
* Responsible for calling renderEngine::setRenderData
|
||||
*/
|
||||
virtual void updateRendererData() = 0;
|
||||
|
||||
}; // Renderer
|
||||
} // openspace
|
||||
}; // Renderer
|
||||
} // openspace
|
||||
|
||||
#endif // __RENDERER_H__
|
||||
#endif // __RENDERER_H__
|
||||
|
||||
@@ -53,73 +53,73 @@ namespace openspace {
|
||||
*/
|
||||
class ScreenSpaceRenderable : public properties::PropertyOwner {
|
||||
public:
|
||||
ScreenSpaceRenderable();
|
||||
~ScreenSpaceRenderable();
|
||||
ScreenSpaceRenderable();
|
||||
~ScreenSpaceRenderable();
|
||||
|
||||
virtual void render() = 0;
|
||||
virtual bool initialize() = 0;
|
||||
virtual bool deinitialize() = 0;
|
||||
virtual void update() = 0;
|
||||
virtual bool isReady() const = 0;
|
||||
bool isEnabled() const;
|
||||
|
||||
glm::vec2 euclideanPosition() const {return _euclideanPosition.value();};
|
||||
glm::vec2 sphericalPosition() const {return _sphericalPosition.value();};
|
||||
float depth() const {return _depth.value();};
|
||||
|
||||
virtual void render() = 0;
|
||||
virtual bool initialize() = 0;
|
||||
virtual bool deinitialize() = 0;
|
||||
virtual void update() = 0;
|
||||
virtual bool isReady() const = 0;
|
||||
bool isEnabled() const;
|
||||
|
||||
glm::vec2 euclideanPosition() const {return _euclideanPosition.value();};
|
||||
glm::vec2 sphericalPosition() const {return _sphericalPosition.value();};
|
||||
float depth() const {return _depth.value();};
|
||||
|
||||
protected:
|
||||
void createPlane();
|
||||
void useEuclideanCoordinates(bool b);
|
||||
void createPlane();
|
||||
void useEuclideanCoordinates(bool b);
|
||||
|
||||
/**
|
||||
* @brief Converts vec2 polar coordinates to euclidean
|
||||
*
|
||||
* @param polar the coordinates theta and phi
|
||||
* @param radius the radius position value of the plane
|
||||
*
|
||||
* @return glm::vec2 with the x and y position value of the plane
|
||||
*/
|
||||
glm::vec2 toEuclidean(glm::vec2 polar, float radius);
|
||||
/**
|
||||
* @brief Converts vec2 polar coordinates to euclidean
|
||||
*
|
||||
* @param polar the coordinates theta and phi
|
||||
* @param radius the radius position value of the plane
|
||||
*
|
||||
* @return glm::vec2 with the x and y position value of the plane
|
||||
*/
|
||||
glm::vec2 toEuclidean(glm::vec2 polar, float radius);
|
||||
|
||||
/**
|
||||
* @brief Converts vec2 euclidean coordinates to sperical
|
||||
*
|
||||
* @param euclidean the coordinates x and y
|
||||
* @return glm::vec2 with the spherical coordinates theta and phi.
|
||||
*/
|
||||
glm::vec2 toSpherical(glm::vec2 euclidean);
|
||||
void registerProperties();
|
||||
void unregisterProperties();
|
||||
/**
|
||||
* @brief Converts vec2 euclidean coordinates to sperical
|
||||
*
|
||||
* @param euclidean the coordinates x and y
|
||||
* @return glm::vec2 with the spherical coordinates theta and phi.
|
||||
*/
|
||||
glm::vec2 toSpherical(glm::vec2 euclidean);
|
||||
void registerProperties();
|
||||
void unregisterProperties();
|
||||
|
||||
void createShaders();
|
||||
glm::mat4 scaleMatrix();
|
||||
glm::mat4 rotationMatrix();
|
||||
glm::mat4 translationMatrix();
|
||||
void draw(glm::mat4 modelTransform);
|
||||
void createShaders();
|
||||
glm::mat4 scaleMatrix();
|
||||
glm::mat4 rotationMatrix();
|
||||
glm::mat4 translationMatrix();
|
||||
void draw(glm::mat4 modelTransform);
|
||||
|
||||
properties::BoolProperty _enabled;
|
||||
properties::BoolProperty _useFlatScreen;
|
||||
properties::Vec2Property _euclideanPosition;
|
||||
properties::Vec2Property _sphericalPosition;
|
||||
properties::FloatProperty _depth;
|
||||
properties::FloatProperty _scale;
|
||||
properties::FloatProperty _alpha;
|
||||
properties::TriggerProperty _delete;
|
||||
properties::BoolProperty _enabled;
|
||||
properties::BoolProperty _useFlatScreen;
|
||||
properties::Vec2Property _euclideanPosition;
|
||||
properties::Vec2Property _sphericalPosition;
|
||||
properties::FloatProperty _depth;
|
||||
properties::FloatProperty _scale;
|
||||
properties::FloatProperty _alpha;
|
||||
properties::TriggerProperty _delete;
|
||||
|
||||
GLuint _quad;
|
||||
GLuint _vertexPositionBuffer;
|
||||
const std::string _rendererPath;
|
||||
ghoul::Dictionary _rendererData;
|
||||
const std::string _vertexPath;
|
||||
const std::string _fragmentPath;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _texture;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
|
||||
GLuint _quad;
|
||||
GLuint _vertexPositionBuffer;
|
||||
const std::string _rendererPath;
|
||||
ghoul::Dictionary _rendererData;
|
||||
const std::string _vertexPath;
|
||||
const std::string _fragmentPath;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _texture;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
|
||||
|
||||
bool _useEuclideanCoordinates;
|
||||
const float _planeDepth = -2.0;
|
||||
glm::vec2 _originalViewportSize;
|
||||
bool _useEuclideanCoordinates;
|
||||
const float _planeDepth = -2.0;
|
||||
glm::vec2 _originalViewportSize;
|
||||
|
||||
float _radius;
|
||||
float _radius;
|
||||
};
|
||||
} // namespace openspace
|
||||
#endif // __SCREENSPACERENDERABLE_H__
|
||||
@@ -0,0 +1,70 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2015 *
|
||||
* *
|
||||
* 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 __TRANSFERFUNCTION_H__
|
||||
#define __TRANSFERFUNCTION_H__
|
||||
|
||||
#include <string>
|
||||
#include <glm/glm.hpp>
|
||||
#include <functional>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
#include <ghoul/filesystem/file.h>
|
||||
#include <memory>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class TransferFunction {
|
||||
public:
|
||||
typedef std::function<void (const TransferFunction&)> TfChangedCallback;
|
||||
|
||||
TransferFunction(const std::string& filepath, TfChangedCallback tfChangedCallback = TfChangedCallback());
|
||||
void setPath(const std::string& filepath);
|
||||
ghoul::opengl::Texture& getTexture();
|
||||
void update();
|
||||
glm::vec4 sample(size_t t);
|
||||
size_t width();
|
||||
void setCallback(TfChangedCallback callback);
|
||||
private:
|
||||
void setTextureFromTxt();
|
||||
void setTextureFromImage();
|
||||
void uploadTexture();
|
||||
|
||||
std::string _filepath;
|
||||
std::unique_ptr<ghoul::filesystem::File> _file = nullptr;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _texture = nullptr;
|
||||
bool _needsUpdate = false;
|
||||
TfChangedCallback _tfChangedCallback;
|
||||
};
|
||||
|
||||
struct MappingKey {
|
||||
float position{0.0f};
|
||||
glm::vec4 color{0.0f,0.0f,0.0f,0.0f};
|
||||
MappingKey(float p, const glm::vec4& c): position(p), color(c) {};
|
||||
MappingKey(float p): position(p), color(glm::vec4(0.0f)) {};
|
||||
bool operator<(const MappingKey& rhs) {return position < rhs.position;};
|
||||
};
|
||||
} // namespace openspace
|
||||
|
||||
#endif
|
||||
|
||||
@@ -44,11 +44,11 @@ namespace openspace {
|
||||
|
||||
class SceneGraphNode : public properties::PropertyOwner {
|
||||
public:
|
||||
struct PerformanceRecord {
|
||||
long long renderTime; // time in ns
|
||||
long long updateTimeRenderable; // time in ns
|
||||
long long updateTimeEphemeris; // time in ns
|
||||
};
|
||||
struct PerformanceRecord {
|
||||
long long renderTime; // time in ns
|
||||
long long updateTimeRenderable; // time in ns
|
||||
long long updateTimeEphemeris; // time in ns
|
||||
};
|
||||
|
||||
static std::string RootNodeName;
|
||||
|
||||
@@ -61,19 +61,19 @@ public:
|
||||
|
||||
static SceneGraphNode* createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
|
||||
bool initialize();
|
||||
bool initialize();
|
||||
bool deinitialize();
|
||||
|
||||
void update(const UpdateData& data);
|
||||
void evaluate(const Camera* camera, const psc& parentPosition = psc());
|
||||
void render(const RenderData& data, RendererTasks& tasks);
|
||||
void updateCamera(Camera* camera) const;
|
||||
void updateCamera(Camera* camera) const;
|
||||
|
||||
//void addNode(SceneGraphNode* child);
|
||||
|
||||
void addChild(SceneGraphNode* child);
|
||||
void setParent(SceneGraphNode* parent);
|
||||
//bool abandonChild(SceneGraphNode* child);
|
||||
//bool abandonChild(SceneGraphNode* child);
|
||||
|
||||
const psc& position() const;
|
||||
psc worldPosition() const;
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
|
||||
SceneGraphNode* childNode(const std::string& name);
|
||||
|
||||
const PerformanceRecord& performanceRecord() const { return _performanceRecord; }
|
||||
const PerformanceRecord& performanceRecord() const { return _performanceRecord; }
|
||||
|
||||
void setRenderable(Renderable* renderable);
|
||||
const Renderable* renderable() const;
|
||||
@@ -101,11 +101,11 @@ public:
|
||||
private:
|
||||
bool sphereInsideFrustum(const psc& s_pos, const PowerScaledScalar& s_rad, const Camera* camera);
|
||||
|
||||
std::vector<SceneGraphNode*> _children;
|
||||
std::vector<SceneGraphNode*> _children;
|
||||
SceneGraphNode* _parent;
|
||||
Ephemeris* _ephemeris;
|
||||
|
||||
PerformanceRecord _performanceRecord;
|
||||
PerformanceRecord _performanceRecord;
|
||||
|
||||
Renderable* _renderable;
|
||||
bool _renderableVisible;
|
||||
|
||||
@@ -58,26 +58,26 @@ public:
|
||||
* describing the function, and whether it should be shared in a parallel
|
||||
* connection (#parallelShared)
|
||||
*/
|
||||
struct Function {
|
||||
struct Function {
|
||||
/// The name of the function
|
||||
std::string name;
|
||||
std::string name;
|
||||
/// The function pointer that is executed if the function is called
|
||||
lua_CFunction function;
|
||||
lua_CFunction function;
|
||||
/// A text describing the arugments to this function
|
||||
std::string argumentText;
|
||||
std::string argumentText;
|
||||
/// A help text describing what the function does/
|
||||
std::string helpText;
|
||||
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;
|
||||
/// The list of all functions for this library
|
||||
std::vector<Function> functions;
|
||||
std::vector<Function> functions;
|
||||
|
||||
/// Comparison function that compares two LuaLibrary%s name
|
||||
bool operator<(const LuaLibrary& rhs) const;
|
||||
bool operator<(const LuaLibrary& rhs) const;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -92,25 +92,25 @@ public:
|
||||
*/
|
||||
void deinitialize();
|
||||
|
||||
void initializeLuaState(lua_State* state);
|
||||
void initializeLuaState(lua_State* state);
|
||||
|
||||
void addLibrary(LuaLibrary library);
|
||||
void addLibrary(LuaLibrary library);
|
||||
bool hasLibrary(const std::string& name);
|
||||
|
||||
bool runScript(const std::string& script);
|
||||
bool runScriptFile(const std::string& filename);
|
||||
|
||||
bool writeDocumentation(const std::string& filename, const std::string& type) const;
|
||||
bool writeDocumentation(const std::string& filename, const std::string& type) const;
|
||||
|
||||
void serialize(SyncBuffer* syncBuffer);
|
||||
void serialize(SyncBuffer* syncBuffer);
|
||||
|
||||
void deserialize(SyncBuffer* syncBuffer);
|
||||
void deserialize(SyncBuffer* syncBuffer);
|
||||
|
||||
void postSynchronizationPreDraw();
|
||||
void postSynchronizationPreDraw();
|
||||
|
||||
void preSynchronization();
|
||||
void preSynchronization();
|
||||
|
||||
void queueScript(const std::string &script);
|
||||
void queueScript(const std::string &script);
|
||||
|
||||
std::vector<std::string> cachedScripts();
|
||||
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
void cacheScript(const std::string &library, const std::string &function, const std::string &script);
|
||||
|
||||
private:
|
||||
bool registerLuaLibrary(lua_State* state, const LuaLibrary& library);
|
||||
bool registerLuaLibrary(lua_State* state, const LuaLibrary& library);
|
||||
void addLibraryFunctions(lua_State* state, const LuaLibrary& library, bool replace);
|
||||
|
||||
bool isLibraryNameAllowed(lua_State* state, const std::string& name);
|
||||
@@ -133,11 +133,11 @@ private:
|
||||
lua_State* _state = nullptr;
|
||||
std::set<LuaLibrary> _registeredLibraries;
|
||||
|
||||
//sync variables
|
||||
std::mutex _mutex;
|
||||
std::vector<std::string> _queuedScripts;
|
||||
std::vector<std::string> _receivedScripts;
|
||||
std::string _currentSyncedScript;
|
||||
//sync variables
|
||||
std::mutex _mutex;
|
||||
std::vector<std::string> _queuedScripts;
|
||||
std::vector<std::string> _receivedScripts;
|
||||
std::string _currentSyncedScript;
|
||||
|
||||
//parallel variables
|
||||
std::map<std::string, std::map<std::string, std::string>> _cachedScripts;
|
||||
|
||||
@@ -48,8 +48,8 @@ private:
|
||||
void updateVertices();
|
||||
std::vector<float> _vertices;
|
||||
bool _initialized;
|
||||
GLuint _vaoId;
|
||||
GLuint _vBufferId;
|
||||
GLuint _vaoId;
|
||||
GLuint _vBufferId;
|
||||
glm::vec3 _size;
|
||||
glm::vec3 _normal;
|
||||
float _planeDistance;
|
||||
|
||||
@@ -39,8 +39,8 @@ public:
|
||||
bool initialize();
|
||||
void render();
|
||||
|
||||
GLuint _vaoId;
|
||||
GLuint _vBufferId;
|
||||
GLuint _vaoId;
|
||||
GLuint _vBufferId;
|
||||
glm::vec3 _size;
|
||||
};
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace openspace {
|
||||
// mutable bool _viewMatrixIsDirty;
|
||||
//};
|
||||
|
||||
class SyncBuffer;
|
||||
class SyncBuffer;
|
||||
|
||||
class Camera {
|
||||
public:
|
||||
@@ -99,38 +99,38 @@ public:
|
||||
|
||||
void setPosition(psc pos);
|
||||
const psc& position() const;
|
||||
|
||||
const psc& unsynchedPosition() const;
|
||||
|
||||
const psc& unsynchedPosition() const;
|
||||
|
||||
void setModelMatrix(glm::mat4 modelMatrix);
|
||||
const glm::mat4& modelMatrix() const;
|
||||
void setModelMatrix(glm::mat4 modelMatrix);
|
||||
const glm::mat4& modelMatrix() const;
|
||||
|
||||
void setViewMatrix(glm::mat4 viewMatrix);
|
||||
const glm::mat4& viewMatrix() const;
|
||||
void setViewMatrix(glm::mat4 viewMatrix);
|
||||
const glm::mat4& viewMatrix() const;
|
||||
|
||||
void setProjectionMatrix(glm::mat4 projectionMatrix);
|
||||
const glm::mat4& projectionMatrix() const;
|
||||
void setProjectionMatrix(glm::mat4 projectionMatrix);
|
||||
const glm::mat4& projectionMatrix() const;
|
||||
|
||||
const glm::mat4& viewProjectionMatrix() const;
|
||||
|
||||
void setCameraDirection(glm::vec3 cameraDirection);
|
||||
glm::vec3 cameraDirection() const;
|
||||
|
||||
void setFocusPosition(psc pos);
|
||||
const psc& focusPosition() const;
|
||||
void setFocusPosition(psc pos);
|
||||
const psc& focusPosition() const;
|
||||
|
||||
void setViewRotationMatrix(glm::mat4 m);
|
||||
const glm::mat4& viewRotationMatrix() const;
|
||||
void setViewRotationMatrix(glm::mat4 m);
|
||||
const glm::mat4& viewRotationMatrix() const;
|
||||
void compileViewRotationMatrix();
|
||||
|
||||
void rotate(const glm::quat& rotation);
|
||||
void setRotation(glm::quat rotation);
|
||||
// const glm::quat& rotation() const;
|
||||
void setRotation(glm::mat4 rotation);
|
||||
void setRotation(glm::mat4 rotation);
|
||||
|
||||
const glm::vec3& viewDirection() const;
|
||||
const glm::vec3& viewDirection() const;
|
||||
|
||||
const float& maxFov() const;
|
||||
const float& maxFov() const;
|
||||
const float& sinMaxFov() const;
|
||||
void setMaxFov(float fov);
|
||||
void setScaling(glm::vec2 scaling);
|
||||
@@ -139,43 +139,43 @@ public:
|
||||
void setLookUpVector(glm::vec3 lookUp);
|
||||
const glm::vec3& lookUpVector() const;
|
||||
|
||||
void postSynchronizationPreDraw();
|
||||
void preSynchronization();
|
||||
void serialize(SyncBuffer* syncBuffer);
|
||||
void deserialize(SyncBuffer* syncBuffer);
|
||||
void postSynchronizationPreDraw();
|
||||
void preSynchronization();
|
||||
void serialize(SyncBuffer* syncBuffer);
|
||||
void deserialize(SyncBuffer* syncBuffer);
|
||||
|
||||
private:
|
||||
float _maxFov;
|
||||
float _sinMaxFov;
|
||||
mutable glm::mat4 _viewProjectionMatrix;
|
||||
glm::mat4 _modelMatrix;
|
||||
glm::mat4 _viewMatrix;
|
||||
glm::mat4 _projectionMatrix;
|
||||
glm::mat4 _modelMatrix;
|
||||
glm::mat4 _viewMatrix;
|
||||
glm::mat4 _projectionMatrix;
|
||||
mutable bool _dirtyViewProjectionMatrix;
|
||||
glm::vec3 _viewDirection;
|
||||
glm::vec3 _cameraDirection;
|
||||
psc _focusPosition;
|
||||
psc _focusPosition;
|
||||
// glm::quat _viewRotation;
|
||||
|
||||
glm::vec3 _lookUp;
|
||||
|
||||
mutable std::mutex _mutex;
|
||||
|
||||
//local variables
|
||||
glm::mat4 _localViewRotationMatrix;
|
||||
glm::vec2 _localScaling;
|
||||
psc _localPosition;
|
||||
mutable std::mutex _mutex;
|
||||
|
||||
//local variables
|
||||
glm::mat4 _localViewRotationMatrix;
|
||||
glm::vec2 _localScaling;
|
||||
psc _localPosition;
|
||||
|
||||
//shared copies of local variables
|
||||
glm::vec2 _sharedScaling;
|
||||
psc _sharedPosition;
|
||||
glm::mat4 _sharedViewRotationMatrix;
|
||||
//shared copies of local variables
|
||||
glm::vec2 _sharedScaling;
|
||||
psc _sharedPosition;
|
||||
glm::mat4 _sharedViewRotationMatrix;
|
||||
|
||||
//synced copies of local variables
|
||||
glm::vec2 _syncedScaling;
|
||||
psc _syncedPosition;
|
||||
glm::mat4 _syncedViewRotationMatrix;
|
||||
|
||||
//synced copies of local variables
|
||||
glm::vec2 _syncedScaling;
|
||||
psc _syncedPosition;
|
||||
glm::mat4 _syncedViewRotationMatrix;
|
||||
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
+152
-130
@@ -62,144 +62,166 @@
|
||||
|
||||
namespace openspace {
|
||||
|
||||
enum class KeyAction {
|
||||
enum class KeyAction : int {
|
||||
Release = 0,
|
||||
Press = 1,
|
||||
Repeat = 2
|
||||
Press = 1,
|
||||
Repeat = 2
|
||||
};
|
||||
|
||||
enum class KeyModifier {
|
||||
NoModifier = 0,
|
||||
Shift = 0x0001,
|
||||
Control = 0x0002,
|
||||
Alt = 0x0004,
|
||||
Super = 0x0008
|
||||
KeyAction operator|(KeyAction lhs, KeyAction rhs);
|
||||
KeyAction operator|=(KeyAction& lhs, KeyAction rhs);
|
||||
|
||||
enum class KeyModifier : int {
|
||||
NoModifier = 0,
|
||||
Shift = 0x0001,
|
||||
Control = 0x0002,
|
||||
Alt = 0x0004,
|
||||
Super = 0x0008
|
||||
};
|
||||
|
||||
KeyModifier operator|(KeyModifier lhs, KeyModifier rhs);
|
||||
KeyModifier operator|=(KeyModifier& lhs, KeyModifier rhs);
|
||||
|
||||
enum class Key {
|
||||
Unknown = -1,
|
||||
Space = 32,
|
||||
Apostrophe = 39,
|
||||
Comma = 44,
|
||||
Minus = 45,
|
||||
Period = 46,
|
||||
Slash = 47,
|
||||
Num0 = 48,
|
||||
Num1 = 49,
|
||||
Num2 = 50,
|
||||
Num3 = 51,
|
||||
Num4 = 52,
|
||||
Num5 = 53,
|
||||
Num6 = 54,
|
||||
Num7 = 55,
|
||||
Num8 = 56,
|
||||
Num9 = 57,
|
||||
SemiColon = 59,
|
||||
Equal = 61,
|
||||
A = 65,
|
||||
B = 66,
|
||||
C = 67,
|
||||
D = 68,
|
||||
E = 69,
|
||||
F = 70,
|
||||
G = 71,
|
||||
H = 72,
|
||||
I = 73,
|
||||
J = 74,
|
||||
K = 75,
|
||||
L = 76,
|
||||
M = 77,
|
||||
N = 78,
|
||||
O = 79,
|
||||
P = 80,
|
||||
Q = 81,
|
||||
R = 82,
|
||||
S = 83,
|
||||
T = 84,
|
||||
U = 85,
|
||||
V = 86,
|
||||
W = 87,
|
||||
X = 88,
|
||||
Y = 89,
|
||||
Z = 90,
|
||||
LeftBracket = 91,
|
||||
BackSlash = 92,
|
||||
RightBracket = 93,
|
||||
GraveAccent = 96,
|
||||
World1 = 161,
|
||||
World2 = 162,
|
||||
Escape = 256,
|
||||
Enter = 257,
|
||||
Tab = 258,
|
||||
BackSpace = 259,
|
||||
Insert = 260,
|
||||
Delete = 261,
|
||||
Right = 262,
|
||||
Left = 263,
|
||||
Down = 264,
|
||||
Up = 265,
|
||||
PageUp = 266,
|
||||
PageDown = 267,
|
||||
Home = 268,
|
||||
End = 269,
|
||||
CapsLock = 280,
|
||||
ScrollLock = 281,
|
||||
NumLock = 282,
|
||||
PrintScreen = 283,
|
||||
Pause = 284,
|
||||
F1 = 290,
|
||||
F2 = 291,
|
||||
F3 = 292,
|
||||
F4 = 293,
|
||||
F5 = 294,
|
||||
F6 = 295,
|
||||
F7 = 296,
|
||||
F8 = 297,
|
||||
F9 = 298,
|
||||
F10 = 299,
|
||||
F11 = 300,
|
||||
F12 = 301,
|
||||
F13 = 302,
|
||||
F14 = 303,
|
||||
F15 = 304,
|
||||
F16 = 305,
|
||||
F17 = 306,
|
||||
F18 = 307,
|
||||
F19 = 308,
|
||||
F20 = 309,
|
||||
F21 = 310,
|
||||
F22 = 311,
|
||||
F23 = 312,
|
||||
F24 = 313,
|
||||
F25 = 314,
|
||||
Keypad0 = 320,
|
||||
Keypad1 = 321,
|
||||
Keypad2 = 322,
|
||||
Keypad3 = 323,
|
||||
Keypad4 = 324,
|
||||
Keypad5 = 325,
|
||||
Keypad6 = 326,
|
||||
Keypad7 = 327,
|
||||
Keypad8 = 328,
|
||||
Keypad9 = 329,
|
||||
KeypadDecimal = 330,
|
||||
KeypadDivide = 331,
|
||||
KeypadMultiply = 332,
|
||||
KeypadSubtract = 333,
|
||||
KeypadAdd = 334,
|
||||
KeypadEnter = 335,
|
||||
LeftShift = 340,
|
||||
LeftControl = 341,
|
||||
LeftAlt = 342,
|
||||
LeftSuper = 343,
|
||||
RightShift = 344,
|
||||
RightControl = 345,
|
||||
RightAlt = 346,
|
||||
RightSuper = 347,
|
||||
Menu = 348,
|
||||
Last = Menu
|
||||
Unknown = -1,
|
||||
Space = 32,
|
||||
Apostrophe = 39,
|
||||
Comma = 44,
|
||||
Minus = 45,
|
||||
Period = 46,
|
||||
Slash = 47,
|
||||
Num0 = 48,
|
||||
Num1 = 49,
|
||||
Num2 = 50,
|
||||
Num3 = 51,
|
||||
Num4 = 52,
|
||||
Num5 = 53,
|
||||
Num6 = 54,
|
||||
Num7 = 55,
|
||||
Num8 = 56,
|
||||
Num9 = 57,
|
||||
SemiColon = 59,
|
||||
Equal = 61,
|
||||
A = 65,
|
||||
B = 66,
|
||||
C = 67,
|
||||
D = 68,
|
||||
E = 69,
|
||||
F = 70,
|
||||
G = 71,
|
||||
H = 72,
|
||||
I = 73,
|
||||
J = 74,
|
||||
K = 75,
|
||||
L = 76,
|
||||
M = 77,
|
||||
N = 78,
|
||||
O = 79,
|
||||
P = 80,
|
||||
Q = 81,
|
||||
R = 82,
|
||||
S = 83,
|
||||
T = 84,
|
||||
U = 85,
|
||||
V = 86,
|
||||
W = 87,
|
||||
X = 88,
|
||||
Y = 89,
|
||||
Z = 90,
|
||||
LeftBracket = 91,
|
||||
BackSlash = 92,
|
||||
RightBracket = 93,
|
||||
GraveAccent = 96,
|
||||
World1 = 161,
|
||||
World2 = 162,
|
||||
Escape = 256,
|
||||
Enter = 257,
|
||||
Tab = 258,
|
||||
BackSpace = 259,
|
||||
Insert = 260,
|
||||
Delete = 261,
|
||||
Right = 262,
|
||||
Left = 263,
|
||||
Down = 264,
|
||||
Up = 265,
|
||||
PageUp = 266,
|
||||
PageDown = 267,
|
||||
Home = 268,
|
||||
End = 269,
|
||||
CapsLock = 280,
|
||||
ScrollLock = 281,
|
||||
NumLock = 282,
|
||||
PrintScreen = 283,
|
||||
Pause = 284,
|
||||
F1 = 290,
|
||||
F2 = 291,
|
||||
F3 = 292,
|
||||
F4 = 293,
|
||||
F5 = 294,
|
||||
F6 = 295,
|
||||
F7 = 296,
|
||||
F8 = 297,
|
||||
F9 = 298,
|
||||
F10 = 299,
|
||||
F11 = 300,
|
||||
F12 = 301,
|
||||
F13 = 302,
|
||||
F14 = 303,
|
||||
F15 = 304,
|
||||
F16 = 305,
|
||||
F17 = 306,
|
||||
F18 = 307,
|
||||
F19 = 308,
|
||||
F20 = 309,
|
||||
F21 = 310,
|
||||
F22 = 311,
|
||||
F23 = 312,
|
||||
F24 = 313,
|
||||
F25 = 314,
|
||||
Keypad0 = 320,
|
||||
Keypad1 = 321,
|
||||
Keypad2 = 322,
|
||||
Keypad3 = 323,
|
||||
Keypad4 = 324,
|
||||
Keypad5 = 325,
|
||||
Keypad6 = 326,
|
||||
Keypad7 = 327,
|
||||
Keypad8 = 328,
|
||||
Keypad9 = 329,
|
||||
KeypadDecimal = 330,
|
||||
KeypadDivide = 331,
|
||||
KeypadMultiply = 332,
|
||||
KeypadSubtract = 333,
|
||||
KeypadAdd = 334,
|
||||
KeypadEnter = 335,
|
||||
LeftShift = 340,
|
||||
LeftControl = 341,
|
||||
LeftAlt = 342,
|
||||
LeftSuper = 343,
|
||||
RightShift = 344,
|
||||
RightControl = 345,
|
||||
RightAlt = 346,
|
||||
RightSuper = 347,
|
||||
Menu = 348,
|
||||
Last = Menu
|
||||
};
|
||||
|
||||
struct KeyWithModifier {
|
||||
Key key;
|
||||
KeyModifier modifier;
|
||||
};
|
||||
|
||||
KeyWithModifier stringToKey(std::string str);
|
||||
bool operator<(const KeyWithModifier& lhs, const KeyWithModifier& rhs);
|
||||
|
||||
|
||||
static const std::map<std::string, KeyModifier> KeyModifierMapping = {
|
||||
{ "SHIFT", KeyModifier::Shift },
|
||||
{ "ALT", KeyModifier::Alt },
|
||||
{ "CTRL", KeyModifier::Control },
|
||||
{ "SUPER", KeyModifier::Super }
|
||||
};
|
||||
|
||||
static const std::map<std::string, Key> KeyMapping = {
|
||||
{ "SPACE", Key::Space },
|
||||
{ "APOSTROPHE", Key::Apostrophe },
|
||||
|
||||
@@ -61,8 +61,8 @@ namespace openspace {
|
||||
|
||||
enum class MouseAction {
|
||||
Release = 0,
|
||||
Press = 1,
|
||||
Repeat = 2
|
||||
Press = 1,
|
||||
Repeat = 2
|
||||
};
|
||||
|
||||
// The X11 library header files define Button1-Button5 as defines, so they have to be
|
||||
@@ -85,7 +85,7 @@ enum class MouseButton {
|
||||
Button7 = 6,
|
||||
Button8 = 8,
|
||||
Last = Button8,
|
||||
Left = Button1,
|
||||
Left = Button1,
|
||||
Right = Button2,
|
||||
Middle = Button3
|
||||
};
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
PowerScaledCoordinate();
|
||||
|
||||
PowerScaledCoordinate(PowerScaledCoordinate&& rhs);
|
||||
PowerScaledCoordinate(const PowerScaledCoordinate& rhs);
|
||||
PowerScaledCoordinate(const PowerScaledCoordinate& rhs);
|
||||
|
||||
// Sets the power scaled coordinates directly
|
||||
PowerScaledCoordinate(glm::vec4 v);
|
||||
@@ -61,11 +61,11 @@ public:
|
||||
// returns the rescaled, "normal" coordinates
|
||||
glm::vec3 vec3() const;
|
||||
|
||||
// return the full psc as dvec4()
|
||||
glm::dvec4 dvec4() const;
|
||||
// return the full psc as dvec4()
|
||||
glm::dvec4 dvec4() const;
|
||||
|
||||
// rescaled return as dvec3
|
||||
glm::dvec3 dvec3() const;
|
||||
// rescaled return as dvec3
|
||||
glm::dvec3 dvec3() const;
|
||||
|
||||
// length of the vector as a pss
|
||||
PowerScaledScalar length() const;
|
||||
|
||||
@@ -36,52 +36,52 @@ namespace openspace {
|
||||
|
||||
class PowerScaledScalar {
|
||||
public:
|
||||
// constructors
|
||||
PowerScaledScalar();
|
||||
PowerScaledScalar(const glm::vec2 &v);
|
||||
PowerScaledScalar(float f1, float f2);
|
||||
static PowerScaledScalar CreatePSS(double d1);
|
||||
// constructors
|
||||
PowerScaledScalar();
|
||||
PowerScaledScalar(const glm::vec2 &v);
|
||||
PowerScaledScalar(float f1, float f2);
|
||||
static PowerScaledScalar CreatePSS(double d1);
|
||||
|
||||
const glm::vec2& vec2() const;
|
||||
float lengthf() const;
|
||||
const glm::vec2& vec2() const;
|
||||
float lengthf() const;
|
||||
|
||||
// operator overloading
|
||||
PowerScaledScalar& operator=(const PowerScaledScalar& rhs);
|
||||
PowerScaledScalar& operator+=(const PowerScaledScalar& rhs);
|
||||
const PowerScaledScalar operator+(const PowerScaledScalar& rhs) const;
|
||||
PowerScaledScalar& operator-=(const PowerScaledScalar& rhs);
|
||||
const PowerScaledScalar operator-(const PowerScaledScalar& rhs) const;
|
||||
PowerScaledScalar& operator*=(const PowerScaledScalar& rhs);
|
||||
const PowerScaledScalar operator*(const PowerScaledScalar& rhs) const;
|
||||
PowerScaledScalar& operator*=(const float& rhs);
|
||||
const PowerScaledScalar operator*(const float& rhs) const;
|
||||
float& operator[](unsigned int idx);
|
||||
float operator[](unsigned int idx) const;
|
||||
// operator overloading
|
||||
PowerScaledScalar& operator=(const PowerScaledScalar& rhs);
|
||||
PowerScaledScalar& operator+=(const PowerScaledScalar& rhs);
|
||||
const PowerScaledScalar operator+(const PowerScaledScalar& rhs) const;
|
||||
PowerScaledScalar& operator-=(const PowerScaledScalar& rhs);
|
||||
const PowerScaledScalar operator-(const PowerScaledScalar& rhs) const;
|
||||
PowerScaledScalar& operator*=(const PowerScaledScalar& rhs);
|
||||
const PowerScaledScalar operator*(const PowerScaledScalar& rhs) const;
|
||||
PowerScaledScalar& operator*=(const float& rhs);
|
||||
const PowerScaledScalar operator*(const float& rhs) const;
|
||||
float& operator[](unsigned int idx);
|
||||
float operator[](unsigned int idx) const;
|
||||
|
||||
// comparison
|
||||
bool operator==(const PowerScaledScalar& other) const;
|
||||
bool operator<(const PowerScaledScalar& other) const;
|
||||
bool operator>(const PowerScaledScalar& other) const;
|
||||
bool operator<=(const PowerScaledScalar& other) const;
|
||||
bool operator>=(const PowerScaledScalar& other) const;
|
||||
|
||||
bool operator==(double other) const;
|
||||
bool operator<(double other) const;
|
||||
bool operator>(double other) const;
|
||||
bool operator<=(double other) const;
|
||||
bool operator>=(double other) const;
|
||||
// comparison
|
||||
bool operator==(const PowerScaledScalar& other) const;
|
||||
bool operator<(const PowerScaledScalar& other) const;
|
||||
bool operator>(const PowerScaledScalar& other) const;
|
||||
bool operator<=(const PowerScaledScalar& other) const;
|
||||
bool operator>=(const PowerScaledScalar& other) const;
|
||||
|
||||
bool operator==(double other) const;
|
||||
bool operator<(double other) const;
|
||||
bool operator>(double other) const;
|
||||
bool operator<=(double other) const;
|
||||
bool operator>=(double other) const;
|
||||
|
||||
// glm integration
|
||||
PowerScaledScalar& operator=(const glm::vec2& rhs);
|
||||
PowerScaledScalar& operator=(float rhs);
|
||||
// glm integration
|
||||
PowerScaledScalar& operator=(const glm::vec2& rhs);
|
||||
PowerScaledScalar& operator=(float rhs);
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const PowerScaledScalar& rhs);
|
||||
|
||||
// allow the power scaled coordinates to access private members
|
||||
friend class PowerScaledCoordinate;
|
||||
|
||||
// allow the power scaled coordinates to access private members
|
||||
friend class PowerScaledCoordinate;
|
||||
private:
|
||||
// float vector used when returning float values
|
||||
glm::vec2 _data;
|
||||
// float vector used when returning float values
|
||||
glm::vec2 _data;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@ class PowerScaledSphere {
|
||||
public:
|
||||
// initializers
|
||||
PowerScaledSphere(const PowerScaledScalar& radius,
|
||||
int segments = 8);
|
||||
PowerScaledSphere(properties::Vec4Property &radius,
|
||||
int segments, std::string planetName);
|
||||
int segments = 8);
|
||||
PowerScaledSphere(properties::Vec4Property &radius,
|
||||
int segments, std::string planetName);
|
||||
|
||||
~PowerScaledSphere();
|
||||
PowerScaledSphere(const PowerScaledSphere& cpy);
|
||||
@@ -57,9 +57,9 @@ public:
|
||||
GLubyte padding[28]; // Pads the struct out to 64 bytes for performance increase
|
||||
} Vertex;
|
||||
|
||||
GLuint _vaoID;
|
||||
GLuint _vBufferID;
|
||||
GLuint _iBufferID;
|
||||
GLuint _vaoID;
|
||||
GLuint _vBufferID;
|
||||
GLuint _iBufferID;
|
||||
|
||||
unsigned int _isize;
|
||||
unsigned int _vsize;
|
||||
|
||||
@@ -31,18 +31,18 @@ namespace openspace {
|
||||
|
||||
class ProgressBar {
|
||||
public:
|
||||
ProgressBar(int end, int width = 70, std::ostream& stream = std::cout);
|
||||
~ProgressBar();
|
||||
ProgressBar(int end, int width = 70, std::ostream& stream = std::cout);
|
||||
~ProgressBar();
|
||||
|
||||
ProgressBar& operator=(const ProgressBar& rhs) = delete;
|
||||
|
||||
void print(int current);
|
||||
void print(int current);
|
||||
|
||||
private:
|
||||
int _width;
|
||||
int _previous;
|
||||
int _end;
|
||||
std::ostream& _stream;
|
||||
int _width;
|
||||
int _previous;
|
||||
int _end;
|
||||
std::ostream& _stream;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -45,22 +45,22 @@ public:
|
||||
* This struct stores the incoming log entries with their #level, #timeString,
|
||||
* #category, #message, and the generated #timeStamp used for the expiry calculation.
|
||||
*/
|
||||
struct LogEntry {
|
||||
struct LogEntry {
|
||||
/// The ghoul::logging::LogManager::LogLevel of the log message
|
||||
LogLevel level;
|
||||
LogLevel level;
|
||||
|
||||
/// The timepoint when the log message arrived at the ScreenLog
|
||||
std::chrono::time_point<std::chrono::steady_clock> timeStamp;
|
||||
|
||||
/// The time string as retrieved from the log message
|
||||
std::string timeString;
|
||||
std::string timeString;
|
||||
|
||||
/// The category as retrieved from the log message
|
||||
std::string category;
|
||||
std::string category;
|
||||
|
||||
/// The actual message of the log entry
|
||||
std::string message;
|
||||
};
|
||||
std::string message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor that creates a ScreenLog with the provided \p timeToLive, and the
|
||||
@@ -80,8 +80,8 @@ public:
|
||||
* \param category The category of the log message
|
||||
* \param message The actual log message that was transmitted
|
||||
*/
|
||||
void log(ghoul::logging::LogManager::LogLevel level, const std::string& category,
|
||||
const std::string& message) override;
|
||||
void log(ghoul::logging::LogManager::LogLevel level, const std::string& category,
|
||||
const std::string& message) override;
|
||||
|
||||
/**
|
||||
* This method removes all the stored LogEntry%s that have expired, calculated by
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
|
||||
private:
|
||||
/// The list of all LogEntry%s stored by this ScreenLog
|
||||
std::vector<LogEntry> _entries;
|
||||
std::vector<LogEntry> _entries;
|
||||
|
||||
/// The time-to-live for the LogEntry%s in this ScreenLog. Is used by the
|
||||
/// #removeExpiredEntries method to remove expired entries.
|
||||
|
||||
@@ -142,7 +142,7 @@ public:
|
||||
* <code>UMBRAL</code> and <code>PENUMBRAL</code>. All other values will result in an
|
||||
* exception.
|
||||
* \param type The terminator type
|
||||
* \param The terminator type enum
|
||||
* \return The terminator type enum
|
||||
* \throws std::out_of_range if \p type is not a valid string
|
||||
* \pre \p type must not be empty
|
||||
*/
|
||||
@@ -519,10 +519,8 @@ public:
|
||||
* compute the intercept
|
||||
* \param ephemerisTime Intercept time in ephemeris seconds past J2000 TDB
|
||||
* \param directionVector Probing ray's direction
|
||||
* \param surfaceIntercept Surface intercept point on the target body
|
||||
* \param surfaceVector Vector from observer to intercept point
|
||||
* \param isVisible Flag indicating whether intercept was found
|
||||
* \return <code>true</code> if not error occurred, <code>false</code> otherwise
|
||||
* \return A SurfaceInterceptResult structure that contains all information about the
|
||||
* intercept, including whether an intercept was found
|
||||
* \throws SpiceException If the \p target or \p observer do not name the same
|
||||
* NAIF object, the \p target or \p observer name the same NAIF object or are in the
|
||||
* same location, the \p referenceFrame or \p fovFrame are not recognized,
|
||||
@@ -618,11 +616,12 @@ public:
|
||||
* \param referenceFrame The reference frame of the output position vector
|
||||
* \param aberrationCorrection The aberration correction method
|
||||
* \param ephemerisTime The time at which the position is to be queried
|
||||
* \return A TargetStateResult object that contains the <code>position>, containing
|
||||
* the position of the target; the <code>velocity</code>, containing the velocity of
|
||||
* the target; and the <code>lightTime</code>, containing the one-way light time
|
||||
* between the \p target and the \p observer. This method is only set if the
|
||||
* \p aberrationCorrection is set to a valid different from AberrationCorrection::None
|
||||
* \return A TargetStateResult object that contains the <code>position</code>,
|
||||
* containing the position of the target; the <code>velocity</code>, containing the
|
||||
* velocity of the target; and the <code>lightTime</code>, containing the one-way
|
||||
* light time between the \p target and the \p observer. This method is only set if
|
||||
* the \p aberrationCorrection is set to a valid different from
|
||||
* AberrationCorrection::None
|
||||
* \throws SpiceException If the \p target or \p observer do not name a valid
|
||||
* NAIF object, the \p referenceFrame is not a valid frame, or if there is
|
||||
* insufficient kernel information.
|
||||
@@ -770,8 +769,9 @@ public:
|
||||
* surface that is completely illuminated. Note that in astronomy references, the
|
||||
* unqualified word "terminator" refers to the umbral terminator.
|
||||
* \param aberrationCorrection The aberration correction method that is used
|
||||
* \param numberOfPoints The number of points along terminator that should be computed
|
||||
* by this method
|
||||
* \param ephemerisTime The time at which the terminator ellipse shall be computed
|
||||
* \param numberOfTerminatorPoints The number of points along terminator that should
|
||||
* be computed by this method
|
||||
* \return A TerminatorEllipseResult structure that contains all outputs of this
|
||||
* function
|
||||
* \throws SpiceException If the \p target, \p observer, or \p lightSource are
|
||||
@@ -807,7 +807,7 @@ public:
|
||||
* \return the frame of the body
|
||||
* \todo I think this function should die ---abock
|
||||
*/
|
||||
std::string frameFromBody(const std::string body) const;
|
||||
std::string frameFromBody(const std::string& body) const;
|
||||
|
||||
private:
|
||||
/// Struct storing the information about all loaded kernels
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace openspace {
|
||||
class SyncBuffer {
|
||||
public:
|
||||
|
||||
SyncBuffer(size_t n);
|
||||
SyncBuffer(size_t n);
|
||||
|
||||
void encode(const std::string& s) {
|
||||
const size_t size = sizeof(char) * s.size() + sizeof(int32_t);
|
||||
@@ -48,14 +48,14 @@ public:
|
||||
_encodeOffset += length;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void encode(const T& v) {
|
||||
const size_t size = sizeof(T);
|
||||
assert(_encodeOffset + size < _n);
|
||||
template <typename T>
|
||||
void encode(const T& v) {
|
||||
const size_t size = sizeof(T);
|
||||
assert(_encodeOffset + size < _n);
|
||||
|
||||
memcpy(_dataStream.data() + _encodeOffset, &v, size);
|
||||
_encodeOffset += size;
|
||||
}
|
||||
memcpy(_dataStream.data() + _encodeOffset, &v, size);
|
||||
_encodeOffset += size;
|
||||
}
|
||||
|
||||
std::string decode() {
|
||||
int32_t length;
|
||||
@@ -70,38 +70,38 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T decode() {
|
||||
const size_t size = sizeof(T);
|
||||
assert(_decodeOffset + size < _n);
|
||||
T value;
|
||||
memcpy(&value, _dataStream.data() + _decodeOffset, size);
|
||||
_decodeOffset += size;
|
||||
return value;
|
||||
}
|
||||
template <typename T>
|
||||
T decode() {
|
||||
const size_t size = sizeof(T);
|
||||
assert(_decodeOffset + size < _n);
|
||||
T value;
|
||||
memcpy(&value, _dataStream.data() + _decodeOffset, size);
|
||||
_decodeOffset += size;
|
||||
return value;
|
||||
}
|
||||
|
||||
void decode(std::string& s) {
|
||||
s = decode();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void decode(T& value) {
|
||||
const size_t size = sizeof(T);
|
||||
assert(_decodeOffset + size < _n);
|
||||
memcpy(&value, _dataStream.data() + _decodeOffset, size);
|
||||
_decodeOffset += size;
|
||||
}
|
||||
template <typename T>
|
||||
void decode(T& value) {
|
||||
const size_t size = sizeof(T);
|
||||
assert(_decodeOffset + size < _n);
|
||||
memcpy(&value, _dataStream.data() + _decodeOffset, size);
|
||||
_decodeOffset += size;
|
||||
}
|
||||
|
||||
void write();
|
||||
|
||||
void read();
|
||||
void read();
|
||||
|
||||
private:
|
||||
size_t _n;
|
||||
size_t _encodeOffset;
|
||||
size_t _decodeOffset;
|
||||
std::vector<char> _dataStream;
|
||||
sgct::SharedVector<char> _synchronizationBuffer;
|
||||
size_t _n;
|
||||
size_t _encodeOffset;
|
||||
size_t _decodeOffset;
|
||||
std::vector<char> _dataStream;
|
||||
sgct::SharedVector<char> _synchronizationBuffer;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
+108
-108
@@ -58,92 +58,92 @@ class SyncBuffer;
|
||||
|
||||
class Time {
|
||||
public:
|
||||
/**
|
||||
* Initializes the Time singleton.
|
||||
* \return <code>true</code> if the initialization succeeded, <code>false</code>
|
||||
* otherwise
|
||||
/**
|
||||
* Initializes the Time singleton.
|
||||
* \return <code>true</code> if the initialization succeeded, <code>false</code>
|
||||
* otherwise
|
||||
* \pre The Time singleton must not have been initialized
|
||||
*/
|
||||
static void initialize();
|
||||
*/
|
||||
static void initialize();
|
||||
|
||||
/**
|
||||
* Deinitializes the Time singleton. This method will not unload the kernel that was
|
||||
* possibly loaded during the initialize method.
|
||||
/**
|
||||
* Deinitializes the Time singleton. This method will not unload the kernel that was
|
||||
* possibly loaded during the initialize method.
|
||||
* \pre The Time singleton must have been initialized
|
||||
*/
|
||||
static void deinitialize();
|
||||
*/
|
||||
static void deinitialize();
|
||||
|
||||
/**
|
||||
* Returns the reference to the Time singleton object.
|
||||
* \return The reference to the Time singleton object
|
||||
/**
|
||||
* Returns the reference to the Time singleton object.
|
||||
* \return The reference to the Time singleton object
|
||||
* \pre The Time singleton must have been initialized
|
||||
*/
|
||||
*/
|
||||
static Time& ref();
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the singleton has been successfully initialized,
|
||||
* <code>false</code> otherwise
|
||||
* \return <code>true</code> if the singleton has been successfully initialized,
|
||||
* <code>false</code> otherwise
|
||||
*/
|
||||
static bool isInitialized();
|
||||
|
||||
/**
|
||||
* Sets the current time to the specified value in seconds past the J2000 epoch. This
|
||||
* value can be negative to represent dates before the epoch.
|
||||
* \param value The number of seconds after the J2000 epoch
|
||||
/**
|
||||
* Returns <code>true</code> if the singleton has been successfully initialized,
|
||||
* <code>false</code> otherwise
|
||||
* \return <code>true</code> if the singleton has been successfully initialized,
|
||||
* <code>false</code> otherwise
|
||||
*/
|
||||
static bool isInitialized();
|
||||
|
||||
/**
|
||||
* Sets the current time to the specified value in seconds past the J2000 epoch. This
|
||||
* value can be negative to represent dates before the epoch.
|
||||
* \param value The number of seconds after the J2000 epoch
|
||||
* \param requireJump Whether or not the time change is big enough to require a
|
||||
* time-jump; defaults to true as most calls to set time will require recomputation of
|
||||
* planetary paths etc.
|
||||
*/
|
||||
void setTime(double value, bool requireJump = true);
|
||||
*/
|
||||
void setTime(double value, bool requireJump = true);
|
||||
|
||||
/**
|
||||
* Sets the current time to the specified value given as a Spice compliant string as
|
||||
* described in the Spice documentation
|
||||
* (http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/str2et_c.html)
|
||||
* \param time The time to be set as a date string
|
||||
/**
|
||||
* Sets the current time to the specified value given as a Spice compliant string as
|
||||
* described in the Spice documentation
|
||||
* (http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/str2et_c.html)
|
||||
* \param time The time to be set as a date string
|
||||
* \param requireJump Whether or not the time change is big enough to require a
|
||||
* time-jump; defaults to true as most calls to set time will require recomputation of
|
||||
* planetary paths etc.
|
||||
*/
|
||||
void setTime(std::string time, bool requireJump = true);
|
||||
*/
|
||||
void setTime(std::string time, bool requireJump = true);
|
||||
|
||||
/**
|
||||
* Returns the current time as the number of seconds past the J2000 epoch. If the
|
||||
* current time is a date before that epoch, the returned value will be negative.
|
||||
* \return The current time as the number of seconds past the J2000 epoch
|
||||
*/
|
||||
double currentTime() const;
|
||||
/**
|
||||
* Returns the current time as the number of seconds past the J2000 epoch. If the
|
||||
* current time is a date before that epoch, the returned value will be negative.
|
||||
* \return The current time as the number of seconds past the J2000 epoch
|
||||
*/
|
||||
double currentTime() const;
|
||||
|
||||
/**
|
||||
* Returns the current time as a formatted date string compliant with ISO 8601 and
|
||||
* thus also compliant with the Spice library.
|
||||
* \return The current time as a formatted date string
|
||||
*/
|
||||
std::string currentTimeUTC() const;
|
||||
/**
|
||||
* Returns the current time as a formatted date string compliant with ISO 8601 and
|
||||
* thus also compliant with the Spice library.
|
||||
* \return The current time as a formatted date string
|
||||
*/
|
||||
std::string currentTimeUTC() const;
|
||||
|
||||
/**
|
||||
* Sets the delta time value that is the number of seconds that should pass for each
|
||||
* real-time second. This value is used in the advanceTime(double) method to easily
|
||||
* advance the simulation time.
|
||||
* \param deltaT The number of seconds that should pass for each real-time second
|
||||
*/
|
||||
void setDeltaTime(double deltaT);
|
||||
/**
|
||||
* Sets the delta time value that is the number of seconds that should pass for each
|
||||
* real-time second. This value is used in the advanceTime(double) method to easily
|
||||
* advance the simulation time.
|
||||
* \param deltaT The number of seconds that should pass for each real-time second
|
||||
*/
|
||||
void setDeltaTime(double deltaT);
|
||||
|
||||
/**
|
||||
* Returns the delta time, that is the number of seconds that pass in the simulation
|
||||
* for each real-time second
|
||||
* \return The number of seconds that pass for each real-time second
|
||||
*/
|
||||
double deltaTime() const;
|
||||
/**
|
||||
* Returns the delta time, that is the number of seconds that pass in the simulation
|
||||
* for each real-time second
|
||||
* \return The number of seconds that pass for each real-time second
|
||||
*/
|
||||
double deltaTime() const;
|
||||
|
||||
/**
|
||||
* Sets the pause function, i.e. setting the deltaTime to 0 (<code>pause</code> =
|
||||
* <code>true</code>) and restoring it when the function is called with a parameter of
|
||||
* <code>false</code>.
|
||||
* \param If <code>true</code>, the simulation time stops; if <code>false</code>, the
|
||||
* simulation time continues at the previous rate
|
||||
* \param pause If <code>true</code>, the simulation time stops;
|
||||
* if <code>false</code>, the simulation time continues at the previous rate
|
||||
*/
|
||||
void setPause(bool pause);
|
||||
|
||||
@@ -156,67 +156,67 @@ public:
|
||||
*/
|
||||
bool togglePause();
|
||||
|
||||
/**
|
||||
* Advances the simulation time using the deltaTime() and the <code>tickTime</code>.
|
||||
* The deltaTime() is the number of simulation seconds that pass for each real-time
|
||||
* second. <code>tickTime</code> is the number of real-time seconds that passed since
|
||||
* the last call to this method. If this method is called in the render loop, the
|
||||
* <code>tickTime</code> should be equivalent to the frame time.
|
||||
* \param tickTime The number of real-time seconds that passed since the last call
|
||||
* to this method
|
||||
* \return The new time value after advancing the time
|
||||
*/
|
||||
double advanceTime(double tickTime);
|
||||
/**
|
||||
* Advances the simulation time using the deltaTime() and the <code>tickTime</code>.
|
||||
* The deltaTime() is the number of simulation seconds that pass for each real-time
|
||||
* second. <code>tickTime</code> is the number of real-time seconds that passed since
|
||||
* the last call to this method. If this method is called in the render loop, the
|
||||
* <code>tickTime</code> should be equivalent to the frame time.
|
||||
* \param tickTime The number of real-time seconds that passed since the last call
|
||||
* to this method
|
||||
* \return The new time value after advancing the time
|
||||
*/
|
||||
double advanceTime(double tickTime);
|
||||
|
||||
void serialize(SyncBuffer* syncBuffer);
|
||||
void serialize(SyncBuffer* syncBuffer);
|
||||
|
||||
void deserialize(SyncBuffer* syncBuffer);
|
||||
void deserialize(SyncBuffer* syncBuffer);
|
||||
|
||||
void postSynchronizationPreDraw();
|
||||
void postSynchronizationPreDraw();
|
||||
|
||||
void preSynchronization();
|
||||
void preSynchronization();
|
||||
|
||||
bool timeJumped() const;
|
||||
bool timeJumped() const;
|
||||
|
||||
void setTimeJumped(bool jumped);
|
||||
void setTimeJumped(bool jumped);
|
||||
|
||||
bool paused() const;
|
||||
|
||||
/**
|
||||
* Returns the Lua library that contains all Lua functions available to change the
|
||||
* current time, retrieve the current time etc. The functions contained are
|
||||
* - openspace::luascriptfunctions::time_setDeltaTime
|
||||
* - openspace::luascriptfunctions::time_deltaTime
|
||||
* - openspace::luascriptfunctions::time_setTime
|
||||
* - openspace::luascriptfunctions::time_currentTime
|
||||
* - openspace::luascriptfunctions::time_currentTimeUTC
|
||||
* \return The Lua library that contains all Lua functions available to change the
|
||||
* Time singleton
|
||||
*/
|
||||
static scripting::ScriptEngine::LuaLibrary luaLibrary();
|
||||
/**
|
||||
* Returns the Lua library that contains all Lua functions available to change the
|
||||
* current time, retrieve the current time etc. The functions contained are
|
||||
* - openspace::luascriptfunctions::time_setDeltaTime
|
||||
* - openspace::luascriptfunctions::time_deltaTime
|
||||
* - openspace::luascriptfunctions::time_setTime
|
||||
* - openspace::luascriptfunctions::time_currentTime
|
||||
* - openspace::luascriptfunctions::time_currentTimeUTC
|
||||
* \return The Lua library that contains all Lua functions available to change the
|
||||
* Time singleton
|
||||
*/
|
||||
static scripting::ScriptEngine::LuaLibrary luaLibrary();
|
||||
|
||||
private:
|
||||
static Time* _instance; ///< The singleton instance
|
||||
|
||||
//local copies
|
||||
static Time* _instance; ///< The singleton instance
|
||||
|
||||
//local copies
|
||||
/// The time stored as the number of seconds past the J2000 epoch
|
||||
double _time = -1.0;
|
||||
double _dt = 1.0;
|
||||
bool _timeJumped = false;
|
||||
double _time = -1.0;
|
||||
double _dt = 1.0;
|
||||
bool _timeJumped = false;
|
||||
bool _timePaused = false;
|
||||
bool _jockeHasToFixThisLater;
|
||||
|
||||
//shared copies
|
||||
double _sharedTime = -1.0;
|
||||
double _sharedDt = 1.0;
|
||||
bool _sharedTimeJumped = false;
|
||||
//shared copies
|
||||
double _sharedTime = -1.0;
|
||||
double _sharedDt = 1.0;
|
||||
bool _sharedTimeJumped = false;
|
||||
|
||||
//synced copies
|
||||
double _syncedTime = -1.0;
|
||||
double _syncedDt = 1.0;
|
||||
bool _syncedTimeJumped = false;
|
||||
|
||||
std::mutex _syncMutex;
|
||||
//synced copies
|
||||
double _syncedTime = -1.0;
|
||||
double _syncedDt = 1.0;
|
||||
bool _syncedTimeJumped = false;
|
||||
|
||||
std::mutex _syncMutex;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -37,16 +37,16 @@ struct InitializeData {
|
||||
};
|
||||
|
||||
struct UpdateData {
|
||||
double time;
|
||||
double time;
|
||||
bool isTimeJump;
|
||||
double delta;
|
||||
bool doPerformanceMeasurement;
|
||||
double delta;
|
||||
bool doPerformanceMeasurement;
|
||||
};
|
||||
|
||||
struct RenderData {
|
||||
const Camera& camera;
|
||||
psc position;
|
||||
bool doPerformanceMeasurement;
|
||||
const Camera& camera;
|
||||
psc position;
|
||||
bool doPerformanceMeasurement;
|
||||
};
|
||||
|
||||
struct RaycasterTask {
|
||||
|
||||
Reference in New Issue
Block a user