mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-06 19:39:56 -05:00
begin refactor parallel connection
This commit is contained in:
@@ -47,107 +47,6 @@ class SceneGraphNode;
|
||||
namespace interaction {
|
||||
|
||||
|
||||
//#define USE_OLD_INTERACTIONHANDLER
|
||||
#ifdef USE_OLD_INTERACTIONHANDLER
|
||||
|
||||
class InteractionHandler : public properties::PropertyOwner {
|
||||
public:
|
||||
InteractionHandler();
|
||||
~InteractionHandler();
|
||||
|
||||
// Mutators
|
||||
void setKeyboardController(KeyboardController* controller);
|
||||
void setMouseController(MouseController* controller);
|
||||
void setFocusNode(SceneGraphNode* node);
|
||||
void setCamera(Camera* camera);
|
||||
void setInteractionSensitivity(float sensitivity);
|
||||
void resetKeyBindings();
|
||||
void setInvertRoll(bool invert);
|
||||
void setInvertRotation(bool invert);
|
||||
|
||||
void addController(Controller* controller);
|
||||
void addKeyframe(const network::datamessagestructures::PositionKeyframe &kf);
|
||||
void clearKeyframes();
|
||||
|
||||
void bindKey(Key key, KeyModifier modifier, std::string lua);
|
||||
|
||||
void lockControls();
|
||||
void unlockControls();
|
||||
|
||||
void update(double deltaTime);
|
||||
|
||||
// Accessors
|
||||
const SceneGraphNode* const focusNode() const;
|
||||
const Camera* const camera() const;
|
||||
double deltaTime() const;
|
||||
float interactionSensitivity() const;
|
||||
bool invertRoll() const;
|
||||
bool invertRotation() const;
|
||||
|
||||
/**
|
||||
* Returns the Lua library that contains all Lua functions available to affect the
|
||||
* interaction. The functions contained are
|
||||
* - openspace::luascriptfunctions::setOrigin
|
||||
* \return The Lua library that contains all Lua functions available to affect the
|
||||
* interaction
|
||||
*/
|
||||
static scripting::LuaLibrary luaLibrary();
|
||||
|
||||
|
||||
// Callback functions
|
||||
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);
|
||||
void mouseButtonCallback(MouseButton button, MouseAction action);
|
||||
void mousePositionCallback(double x, double y);
|
||||
void mouseScrollWheelCallback(double pos);
|
||||
|
||||
// Interaction functions
|
||||
void orbitDelta(const glm::quat& rotation);
|
||||
void orbit(const float &dx, const float &dy, const float &dz, const float &dist);
|
||||
void rotateDelta(const glm::quat& rotation);
|
||||
void distanceDelta(const PowerScaledScalar& distance, size_t iterations = 0);
|
||||
void lookAt(const glm::quat& rotation);
|
||||
void setRotation(const glm::quat& rotation);
|
||||
|
||||
|
||||
private:
|
||||
// Remove copy and move constructors
|
||||
InteractionHandler(const InteractionHandler&) = delete;
|
||||
InteractionHandler& operator=(const InteractionHandler&) = delete;
|
||||
InteractionHandler(InteractionHandler&&) = delete;
|
||||
InteractionHandler& operator=(InteractionHandler&&) = delete;
|
||||
|
||||
// Settings
|
||||
float _controllerSensitivity;
|
||||
bool _invertRoll;
|
||||
bool _invertRotation;
|
||||
|
||||
// Pointers to entities to affect
|
||||
Camera* _camera;
|
||||
SceneGraphNode* _focusNode;
|
||||
|
||||
// Cached data
|
||||
double _deltaTime;
|
||||
std::mutex _mutex;
|
||||
|
||||
//bool _validKeyLua;
|
||||
std::multimap<KeyWithModifier, std::string > _keyLua;
|
||||
|
||||
|
||||
KeyboardController* _keyboardController;
|
||||
MouseController* _mouseController;
|
||||
std::vector<Controller*> _controllers;
|
||||
|
||||
properties::StringProperty _origin;
|
||||
properties::StringProperty _coordinateSystem;
|
||||
|
||||
//remote controller
|
||||
std::vector<network::datamessagestructures::PositionKeyframe> _keyframes;
|
||||
double _currentKeyframeTime;
|
||||
std::mutex _keyframeMutex;
|
||||
};
|
||||
|
||||
#else // USE_OLD_INTERACTIONHANDLER
|
||||
|
||||
class InteractionHandler : public properties::PropertyOwner
|
||||
{
|
||||
public:
|
||||
@@ -165,7 +64,7 @@ public:
|
||||
|
||||
void resetKeyBindings();
|
||||
|
||||
void addKeyframe(const network::datamessagestructures::PositionKeyframe &kf);
|
||||
void addKeyframe(const network::datamessagestructures::CameraKeyframe &kf);
|
||||
void clearKeyframes();
|
||||
|
||||
void bindKey(Key key, KeyModifier modifier, std::string lua);
|
||||
@@ -232,8 +131,6 @@ private:
|
||||
properties::FloatProperty _rapidness;
|
||||
};
|
||||
|
||||
#endif // USE_OLD_INTERACTIONHANDLER
|
||||
|
||||
} // namespace interaction
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace interaction {
|
||||
void mouseScrollWheelCallback(double mouseScrollDelta);
|
||||
|
||||
// Mutators
|
||||
void addKeyframe(const network::datamessagestructures::PositionKeyframe &kf);
|
||||
void addKeyframe(const network::datamessagestructures::CameraKeyframe &kf);
|
||||
void clearKeyframes();
|
||||
|
||||
// Accessors
|
||||
@@ -64,7 +64,7 @@ namespace interaction {
|
||||
const std::list<MouseButton>& getPressedMouseButtons() const;
|
||||
glm::dvec2 getMousePosition() const;
|
||||
double getMouseScrollDelta() const;
|
||||
std::vector<network::datamessagestructures::PositionKeyframe>& getKeyFrames() const;
|
||||
std::vector<network::datamessagestructures::CameraKeyframe>& getKeyFrames() const;
|
||||
|
||||
bool isKeyPressed(std::pair<Key, KeyModifier> keyModPair) const;
|
||||
bool isMouseButtonPressed(MouseButton mouseButton) const;
|
||||
@@ -76,8 +76,7 @@ namespace interaction {
|
||||
double _mouseScrollDelta;
|
||||
|
||||
// Remote input via keyframes
|
||||
std::vector<network::datamessagestructures::PositionKeyframe> _keyframes;
|
||||
std::mutex _keyframeMutex;
|
||||
std::vector<network::datamessagestructures::CameraKeyframe> _keyframes;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user