solve merge conflict with develop

This commit is contained in:
Michael Nilsson
2016-04-20 15:03:51 -04:00
182 changed files with 10662 additions and 3631 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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__

View File

@@ -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;

View File

@@ -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

View File

@@ -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 },

View File

@@ -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

View File

@@ -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

View File

@@ -142,8 +142,8 @@ public:
* 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);