mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-22 19:29:04 -05:00
untabify to make merge easier
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user