Clean include guards in OpenSpace core

Remove unused files
This commit is contained in:
Alexander Bock
2016-12-09 13:54:22 +01:00
parent df543f0ec3
commit d139dd2d22
152 changed files with 681 additions and 1681 deletions

View File

@@ -47,14 +47,6 @@ set(OPENSPACE_SOURCE
${OPENSPACE_BASE_DIR}/src/interaction/keyboardcontroller.cpp
${OPENSPACE_BASE_DIR}/src/interaction/luaconsole.cpp
${OPENSPACE_BASE_DIR}/src/interaction/luaconsole_lua.inl
${OPENSPACE_BASE_DIR}/src/interaction/mousecontroller.cpp
${OPENSPACE_BASE_DIR}/src/interaction/externalcontrol/externalconnectioncontroller.cpp
${OPENSPACE_BASE_DIR}/src/interaction/externalcontrol/externalcontrol.cpp
${OPENSPACE_BASE_DIR}/src/interaction/externalcontrol/joystickexternalcontrol.cpp
${OPENSPACE_BASE_DIR}/src/interaction/externalcontrol/keyboardexternalcontrol.cpp
${OPENSPACE_BASE_DIR}/src/interaction/externalcontrol/mouseexternalcontrol.cpp
${OPENSPACE_BASE_DIR}/src/interaction/externalcontrol/pythonexternalcontrol.cpp
${OPENSPACE_BASE_DIR}/src/interaction/externalcontrol/randomexternalcontrol.cpp
${OPENSPACE_BASE_DIR}/src/mission/mission.cpp
${OPENSPACE_BASE_DIR}/src/mission/missionmanager.cpp
${OPENSPACE_BASE_DIR}/src/mission/missionmanager_lua.inl
@@ -189,14 +181,6 @@ set(OPENSPACE_HEADER
${OPENSPACE_BASE_DIR}/include/openspace/interaction/interactionmode.h
${OPENSPACE_BASE_DIR}/include/openspace/interaction/keyboardcontroller.h
${OPENSPACE_BASE_DIR}/include/openspace/interaction/luaconsole.h
${OPENSPACE_BASE_DIR}/include/openspace/interaction/mousecontroller.h
${OPENSPACE_BASE_DIR}/include/openspace/interaction/externalcontrol/externalconnectioncontroller.h
${OPENSPACE_BASE_DIR}/include/openspace/interaction/externalcontrol/externalcontrol.h
${OPENSPACE_BASE_DIR}/include/openspace/interaction/externalcontrol/joystickexternalcontrol.h
${OPENSPACE_BASE_DIR}/include/openspace/interaction/externalcontrol/keyboardexternalcontrol.h
${OPENSPACE_BASE_DIR}/include/openspace/interaction/externalcontrol/mouseexternalcontrol.h
${OPENSPACE_BASE_DIR}/include/openspace/interaction/externalcontrol/pythonexternalcontrol.h
${OPENSPACE_BASE_DIR}/include/openspace/interaction/externalcontrol/randomexternalcontrol.h
${OPENSPACE_BASE_DIR}/include/openspace/mission/mission.h
${OPENSPACE_BASE_DIR}/include/openspace/mission/missionmanager.h
${OPENSPACE_BASE_DIR}/include/openspace/network/networkengine.h
@@ -309,6 +293,7 @@ set(OPENSPACE_HEADER
${OPENSPACE_BASE_DIR}/include/openspace/util/syncdata.h
${OPENSPACE_BASE_DIR}/include/openspace/util/time.h
${OPENSPACE_BASE_DIR}/include/openspace/util/timemanager.h
${OPENSPACE_BASE_DIR}/include/openspace/util/timerange.h
${OPENSPACE_BASE_DIR}/include/openspace/util/updatestructures.h
${OPENSPACE_BASE_DIR}/include/openspace/util/transformationmanager.h
${OPENSPACE_BASE_DIR}/include/openspace/util/histogram.h

View File

@@ -38,7 +38,6 @@
#include <openspace/interaction/interactionhandler.h>
#include <openspace/interaction/keyboardcontroller.h>
#include <openspace/interaction/luaconsole.h>
#include <openspace/interaction/mousecontroller.h>
#include <openspace/mission/missionmanager.h>
#include <openspace/network/networkengine.h>
#include <openspace/properties/propertyowner.h>
@@ -79,7 +78,7 @@
#endif
#ifdef OPENSPACE_MODULE_ISWA_ENABLED
#include <modules/iswa/rendering/iswagroup.h>
#include <modules/iswa/rendering/iswabasegroup.h>
#include <modules/iswa/util/iswamanager.h>
#endif

View File

@@ -1,3 +1,26 @@
/*****************************************************************************************
* *
* 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. *
****************************************************************************************/
// open space includes
#include <openspace/interaction/deviceidentifier.h>

View File

@@ -1,12 +0,0 @@
#include <openspace/interaction/externalcontrol/externalconnectioncontroller.h>
namespace openspace {
ExternalConnectionController::ExternalConnectionController() {
}
ExternalConnectionController::~ExternalConnectionController() {
}
} // namespace openspace

View File

@@ -1,33 +0,0 @@
#include <openspace/interaction/externalcontrol/externalcontrol.h>
#include <openspace/interaction/interactionhandler.h>
#include <openspace/engine/openspaceengine.h>
#include <cstdio>
namespace openspace {
ExternalControl::ExternalControl() {
}
ExternalControl::~ExternalControl() {
}
void ExternalControl::update() {
}
void ExternalControl::rotate(const glm::quat &rotation) {
//OsEng.interactionHandler().rotate(rotation);
}
void ExternalControl::orbit(const glm::quat &rotation) {
//OsEng.interactionHandler().orbit(rotation);
}
void ExternalControl::distance(const PowerScaledScalar &distance) {
//OsEng.interactionHandler().distance(distance);
}
} // namespace openspace

View File

@@ -1,63 +0,0 @@
//#include "externalcontrol/joystickexternalcontrol.h"
//#include "deviceidentifier.h"
//
//// workaround since Python debug does not work on windows
//#ifdef _DEBUG
//#undef _DEBUG
//#include <Python.h>
//#define _DEBUG
//#else
//#include <Python.h>
//#endif
//
//namespace openspace {
//
//
//JoystickExternalControl::JoystickExternalControl(const char *filename): PythonExternalControl(filename) {
//}
//
//void JoystickExternalControl::setInputDevice(const int device) {
// if(device >= 0 && device <= 16) {
// inputDevice_ = device;
// numberOfButtons_ = DeviceIdentifier::ref().getButtons(inputDevice_);
// numberOfAxes_ = DeviceIdentifier::ref().getAxes(inputDevice_);
// clear();
// pyarrSize_ = numberOfButtons_ + numberOfAxes_;
// pyarr_ = new PyObject*[pyarrSize_];
// }
//
//}
//
//void JoystickExternalControl::update() {
//
// if(inputDevice_ != -1) {
// float *axesPos;
// unsigned char *buttons;
// DeviceIdentifier::ref().getButtons(inputDevice_, &buttons);
// DeviceIdentifier::ref().getAxes(inputDevice_, &axesPos);
//
// // init array
// for(int i = 0; i < numberOfButtons_; ++i){
// pyarr_[i] = PyLong_FromLong(buttons[i]);
// }
// for(int i = 0; i < numberOfAxes_; ++i){
// pyarr_[i+numberOfButtons_] = PyFloat_FromDouble(axesPos[i]);
// }
// }
//
// run();
//
// if(inputDevice_ != -1) {
// // cleanup
// for(int i = 0; i < pyarrSize_; ++i) {
// Py_DECREF(pyarr_[i]);
// }
// }
//
//}
//
//JoystickExternalControl::~JoystickExternalControl() {
//}
//
//} // namespace openspace
//

View File

@@ -1,62 +0,0 @@
//#include "externalcontrol/keyboardexternalcontrol.h"
//
//// workaround since Python debug does not work on windows
//#ifdef _DEBUG
//#undef _DEBUG
//#include <Python.h>
//#define _DEBUG
//#else
//#include <Python.h>
//#endif
//
//
//namespace openspace {
//
//
//KeyboardExternalControl::KeyboardExternalControl(const char *filename): PythonExternalControl(filename) {
// clear();
// pyarrSize_ = 'Z' - 'A' + 80; // all letters, 69 special keys, space and 10 numbers
// pyarr_ = new PyObject*[pyarrSize_];
// for(int i = 0; i < pyarrSize_; ++i) {
// pyarr_[i] = PyLong_FromLong(0);
// }
//}
//
//void KeyboardExternalControl::keyboardCallback(int key, int action) {
//
// //printf("key: %i\n",key);
// int pos = -1;
// if(key >= '0' && key <= '9') {
// pos = key - '0';
// Py_XDECREF(pyarr_[pos]);
// pyarr_[pos] = PyLong_FromLong(action);
// } else if(key >= 'A' && key <= 'Z') {
// pos = key - 'A' + 10;
// Py_XDECREF(pyarr_[pos]);
// pyarr_[pos] = PyLong_FromLong(action);
// } else if (key > 256 && key < 256+69) {
// pos = key - 256 + 'Z'-'A' +10;
// Py_XDECREF(pyarr_[pos]);
// pyarr_[pos] = PyLong_FromLong(action);
// } else if (key == 32) {
// pos = 'Z' - 'A' + 11;
// Py_XDECREF(pyarr_[pos]);
// pyarr_[pos] = PyLong_FromLong(action);
// }
// //printf("pos: %i\n",pos);
//}
//
//
//
//void KeyboardExternalControl::update() {
// run();
//}
//
//KeyboardExternalControl::~KeyboardExternalControl() {
// for(int i = 0; i < pyarrSize_; ++i) {
// Py_XDECREF(pyarr_[i]);
// }
//}
//
//} // namespace openspace
//

View File

@@ -1,79 +0,0 @@
//#include "externalcontrol/mouseexternalcontrol.h"
//
//// workaround since Python debug does not work on windows
//#ifdef _DEBUG
//#undef _DEBUG
//#include <Python.h>
//#define _DEBUG
//#else
//#include <Python.h>
//#endif
//
//
//namespace openspace {
//
//
//MouseExternalControl::MouseExternalControl(const char *filename): PythonExternalControl(filename) {
// clear();
// pyarrSize_ = 6*2;
// pyarr_ = new PyObject*[pyarrSize_];
// x_ = 0;
// y_ = 0;
// pos_ = 0;
// button1_ = 0;
// button2_ = 0;
// button3_ = 0;
// for(int i = 0; i < pyarrSize_; ++i) {
// pyarr_[i] = PyLong_FromLong(0);;
// }
//
//}
//
//void MouseExternalControl::mouseButtonCallback(int key, int action) {
// if(key == 0)
// button1_ = action;
// if(key == 1)
// button2_ = action;
// if(key == 2)
// button3_ = action;
//}
//
//void MouseExternalControl::mousePosCallback(int x, int y) {
// x_ = x;
// y_ = y;
//}
//
//void MouseExternalControl::mouseScrollCallback(int pos) {
// pos_ = pos;
//}
//
//void MouseExternalControl::update() {
//
// pyarr_[6] = pyarr_[0];
// pyarr_[7] = pyarr_[1];
// pyarr_[8] = pyarr_[2];
// pyarr_[9] = pyarr_[3];
// pyarr_[10] = pyarr_[4];
// pyarr_[11] = pyarr_[5];
// pyarr_[0] = PyLong_FromLong(button1_);
// pyarr_[1] = PyLong_FromLong(button2_);
// pyarr_[2] = PyLong_FromLong(button3_);
// pyarr_[3] = PyLong_FromLong(pos_);
// pyarr_[4] = PyLong_FromLong(x_);
// pyarr_[5] = PyLong_FromLong(y_);
//
// run();
//
// // cleanup
// for(int i = pyarrSize_ / 2; i < pyarrSize_; ++i) {
// Py_XDECREF(pyarr_[i]);
// }
//
//}
//
//MouseExternalControl::~MouseExternalControl() {
//
//}
//
//} // namespace openspace
//

View File

@@ -1,147 +0,0 @@
//#include "externalcontrol/pythonexternalcontrol.h"
//
//// workaround since Python debug does not work on windows
//#ifdef _DEBUG
//#undef _DEBUG
//#include <Python.h>
//#define _DEBUG
//#else
//#include <Python.h>
//#endif
//
//#include <iostream>
//#include <fstream>
//#include <string>
//#include <cstdio>
//#include "deviceidentifier.h"
//
//#include "util/pss.h"
//#include "externalcontrol/externalcontrol.h"
//#include "interactionhandler.h"
//
//namespace openspace {
//
//
//// defining python callback functions
//static PyObject* pyexcontrol_numargs(PyObject *self, PyObject *args) {
// if(!PyArg_ParseTuple(args, ":pyexcontrol_numargs"))
// return NULL;
// return PyLong_FromLong(10);
//}
//
//static PyObject* pyexcontrol_message(PyObject *self, PyObject *args)
//{
// char* text = 0;
// if(!PyArg_ParseTuple(args, "s:pyexcontrol_yeah",&text))
// Py_RETURN_NONE;
//
// PythonExternalControl * ext = 0;
// ext->message(text);
//
// Py_RETURN_NONE;
//}
//
//static PyObject* pyexcontrol_rotateCamera(PyObject *self, PyObject *args)
//{
// char* text = 0;
// float f1 = 0;
// float f2 = 0;
// float f3 = 0;
// float f4 = 0;
// if(!PyArg_ParseTuple(args, "fff:pyexcontrol_rotateCamera",&f1,&f2,&f3))
// Py_RETURN_NONE;
//
// double dt = InteractionHandler::ref().getDt();
// glm::vec3 EulerAngles(f1*dt,f2*dt, f3*dt);
// glm::quat rot = glm::quat(EulerAngles);
// ExternalControl * ext = 0;
// ext->rotate(rot);
//
// Py_RETURN_NONE;
//}
//
//static PyObject* pyexcontrol_orbitCamera(PyObject *self, PyObject *args)
//{
// char* text = 0;
// float f1 = 0;
// float f2 = 0;
// float f3 = 0;
// if(!PyArg_ParseTuple(args, "fff:pyexcontrol_rotateCamera",&f1,&f2,&f3))
// Py_RETURN_NONE;
//
// double dt = InteractionHandler::ref().getDt();
// glm::vec3 EulerAngles(f1*dt,f2*dt, f3*dt);
// glm::quat rot = glm::quat(EulerAngles);
// ExternalControl * ext = 0;
// ext->orbit(rot);
//
// Py_RETURN_NONE;
//}
//
//static PyObject* pyexcontrol_distance(PyObject *self, PyObject *args)
//{
// char* text = 0;
// float f1 = 0;
// float f2 = 0;
// if(!PyArg_ParseTuple(args, "ff:pyexcontrol_rotateCamera",&f1,&f2))
// Py_RETURN_NONE;
//
// float dt = static_cast<float>(InteractionHandler::ref().getDt());
// pss dist(f1*dt,f2);
// ExternalControl * ext = 0;
// ext->distance(dist);
//
// Py_RETURN_NONE;
//}
//
//PyMethodDef* PythonExternalControl::getMethodDef() {
// // creating the python callback function table
// static PyMethodDef pyexcontrol_methods[] = {
// {"numargs", pyexcontrol_numargs, METH_VARARGS, "function"},
// {"message", pyexcontrol_message, METH_VARARGS, "function"},
// {"rotate", pyexcontrol_rotateCamera, METH_VARARGS, "function"},
// {"orbit", pyexcontrol_orbitCamera, METH_VARARGS, "function"},
// {"distance", pyexcontrol_distance, METH_VARARGS, "function"},
// {NULL, NULL, 0, NULL}
// };
// return pyexcontrol_methods;
//}
//
//void PythonExternalControl::message(const char *text) {
//
// printf("Input message from PythonScript: %s\n", text);
//}
//
//PythonExternalControl::PythonExternalControl(const char *filename) {
// pyarr_ = nullptr;
// ps_.load(filename, true);
//}
//
//
//void PythonExternalControl::update() {
// run();
//}
//
//void PythonExternalControl::run() {
// if(pyarrSize_ > 0)
// ps_.run(pyarrSize_, pyarr_);
// else
// ps_.run();
//}
//
//
//void PythonExternalControl::clear() {
// if(pyarr_ != nullptr) {
// // cleanup
// delete pyarr_;
// pyarr_ = nullptr;
// pyarrSize_ = 0;
// }
//}
//
//PythonExternalControl::~PythonExternalControl() {
// clear();
//}
//
//} // namespace openspace
//

View File

@@ -1,60 +0,0 @@
#include <openspace/interaction/externalcontrol/randomexternalcontrol.h>
#include <cstdio>
#ifndef _WIN32
#include <unistd.h>
#endif
namespace openspace {
typedef struct
{
bool *keepGoing;
double *dx;
} parm;
void *updatedx(void * arg) {
parm *p = (parm*) arg;
bool *kg = p->keepGoing;
double *dx = p->dx;
while( *kg ) {
//printf("Hello world!\n");
*dx = *dx + 0.5;
#ifndef _WIN32
// random sleep time
int diff = rand() % 200;
usleep(10000*diff);
#endif
}
delete p;
return NULL;
}
RandomExternalControl::RandomExternalControl() {
/*
inputGuard = PTHREAD_MUTEX_INITIALIZER;
pthread_attr_t pthread_custom_attr;
pthread_attr_init(&pthread_custom_attr);
keepGoing_ = new bool;
*keepGoing_ = true;
parm *p = (parm*)malloc(sizeof(parm));
p->keepGoing = keepGoing_;
p->dx = &dx_;
pthread_create(&backgroundThread, &pthread_custom_attr, updatedx, (void*)p);
*/
}
RandomExternalControl::~RandomExternalControl() {
*keepGoing_ = false;
//pthread_join(backgroundThread, NULL);
delete keepGoing_;
}
} // namespace openspace

View File

@@ -1,257 +0,0 @@
/*****************************************************************************************
* *
* 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. *
****************************************************************************************/
//#define USE_OLD_INTERACTIONHANDLER
#ifdef USE_OLD_INTERACTIONHANDLER
#include <openspace/interaction/mousecontroller.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/wrapper/windowwrapper.h>
#include <openspace/interaction/interactionhandler.h>
namespace openspace {
namespace interaction {
MouseController::MouseController()
: _lastTrackballPos(0.f)
, _isMouseBeingPressedAndHeld(false)
{}
glm::vec3 MouseController::mapToTrackball(glm::vec2 mousePos) {
const float RADIUS = 0.5; // Sphere radius
glm::vec3 out = glm::vec3(mousePos.x - 0.5, -1.0*(mousePos.y - 0.5), 0);
// Mapping according to Holroyds trackball
// Piece-wise sphere + hyperbolic sheet
if (out.x*out.x + out.y*out.y <= RADIUS*RADIUS / 2.0) {
//Spherical Region
out.z = RADIUS*RADIUS - (out.x*out.x + out.y*out.y);
out.z = out.z > 0.0f ? sqrtf(out.z) : 0.0f;
}
else { //Hyperbolic Region - for smooth z values
out.z = (RADIUS*RADIUS) / (2.0f*sqrt(out.x*out.x + out.y*out.y));
}
return glm::normalize(out);
}
glm::vec3 MouseController::mapToCamera(glm::vec3 trackballPos) {
//Get x,y,z axis vectors of current camera view
glm::vec3 currentViewYaxis = glm::normalize(_handler->camera()->lookUpVectorCameraSpace());
psc viewDir = _handler->camera()->position() - _handler->focusNode()->worldPosition();
glm::vec3 currentViewZaxis = glm::normalize(viewDir.vec3());
glm::vec3 currentViewXaxis = glm::normalize(glm::cross(currentViewYaxis, currentViewZaxis));
//mapping to camera co-ordinate
currentViewXaxis *= trackballPos.x;
currentViewYaxis *= trackballPos.y;
currentViewZaxis *= trackballPos.z;
return (currentViewXaxis + currentViewYaxis + currentViewZaxis);
}
void MouseController::trackballRotate(int x, int y) {
// Normalize mouse coordinates to [0,1]
glm::vec2 res = OsEng.windowWrapper().currentWindowSize();
glm::vec2 mousePos = glm::vec2((float)x / res.x, (float)y / res.y);
mousePos = glm::clamp(mousePos, -0.5f, 1.5f); // Ugly fix #1: Camera position becomes NaN on mouse values outside [-0.5, 1.5]
//mousePos[1] = 0.5; // Ugly fix #2: Tempoarily only allow rotation around y
glm::vec3 curTrackballPos = mapToTrackball(mousePos);
// LDEBUG(mousePos.x << ", " << mousePos.y << " = " << curTrackballPos.x << ", " << curTrackballPos.y << ", " << curTrackballPos.z);
// Disable movement on the first click for extra smoothness
if (!_isMouseBeingPressedAndHeld) {
_lastTrackballPos = curTrackballPos;
_isMouseBeingPressedAndHeld = true;
}
if (curTrackballPos != _lastTrackballPos) {
// calculate rotation angle (in radians)
float rotationAngle = glm::angle(curTrackballPos, _lastTrackballPos);
//rotationAngle *= static_cast<float>(_handler->deltaTime()) * 100.0f;
// Map trackballpos to camera
// glm::vec3 trackballMappedToCamera = mapToCamera(_lastTrackballPos - curTrackballPos);
// psc currentCamPos = camera_->getPosition();
// glm::vec3 nextCamPos = currentCamPos.getVec3f() + trackballMappedToCamera;
// glm::vec3 rotationAxis = glm::cross(currentCamPos.getVec3f(), nextCamPos);
glm::vec3 rotationAxis = glm::cross(_lastTrackballPos, curTrackballPos);
rotationAxis = glm::normalize(rotationAxis);
glm::quat quaternion = glm::angleAxis(rotationAngle, rotationAxis);
// Apply quaternion to camera
//_handler->orbitDelta(quaternion);
_lastTrackballPos = curTrackballPos;
}
}
TrackballMouseController::TrackballMouseController()
: MouseController()
, _leftMouseButtonDown(false)
{}
void TrackballMouseController::button(MouseButton button, MouseAction action) {
if (button == MouseButton::Left && action == MouseAction::Press)
_leftMouseButtonDown = true;
else if (button == MouseButton::Left && action == MouseAction::Release) {
_leftMouseButtonDown = false;
_isMouseBeingPressedAndHeld = false;
}
}
void TrackballMouseController::move(float x, float y) {
if (_leftMouseButtonDown)
trackballRotate(static_cast<int>(x), static_cast<int>(y));
}
void TrackballMouseController::scrollWheel(int pos) {
/*
const float speed = 4.75f;
const float dt = static_cast<float>(_handler->deltaTime());
if (pos < 0) {
PowerScaledScalar dist(speed * dt, 0.0f);
_handler->distanceDelta(dist);
}
else if (pos > 0) {
PowerScaledScalar dist(-speed * dt, 0.0f);
_handler->distanceDelta(dist);
}
*/
}
void TrackballMouseController::update(const double& dt){
}
OrbitalMouseController::OrbitalMouseController()
: MouseController()
, _leftMouseButtonDown(false)
, _rightMouseButtonDown(false)
, _middleMouseButtonDown(false)
, _currentCursorPos(0)
, _rotationSpeed(10.f)
, _navigationSpeed(3.f)
{
for (int n = 0; n < 3; ++n){
_previousCursorPos[n] = glm::vec2(0);
}
}
void OrbitalMouseController::button(MouseButton button, MouseAction action) {
if (button == MouseButton::Left){
if (action == MouseAction::Press){
_leftMouseButtonDown = true;
_previousCursorPos[MouseButtons::ButtonLeft] = OsEng.windowWrapper().mousePosition();
}
else if (action == MouseAction::Release) {
_leftMouseButtonDown = false;
_currentCursorDiff[MouseButtons::ButtonLeft] = glm::vec2(0);
}
}
else if (button == MouseButton::Right){
if (action == MouseAction::Press){
_rightMouseButtonDown = true;
_previousCursorPos[MouseButtons::ButtonRight] = OsEng.windowWrapper().mousePosition();
}
else if (action == MouseAction::Release) {
_rightMouseButtonDown = false;
_currentCursorDiff[MouseButtons::ButtonRight] = glm::vec2(0);
}
}
else if (button == MouseButton::Middle){
if (action == MouseAction::Press){
_middleMouseButtonDown = true;
_previousCursorPos[MouseButtons::ButtonMiddle] = OsEng.windowWrapper().mousePosition();
}
else if (action == MouseAction::Release) {
_middleMouseButtonDown = false;
_currentCursorDiff[MouseButtons::ButtonMiddle] = glm::vec2(0);
}
}
}
void OrbitalMouseController::move(float x, float y) {
_currentCursorPos = OsEng.windowWrapper().mousePosition();
if (_leftMouseButtonDown) {
glm::vec2 diff = _currentCursorPos - _previousCursorPos[MouseButtons::ButtonLeft];
glm::vec2 res = OsEng.windowWrapper().currentWindowSize();
_currentCursorDiff[MouseButtons::ButtonLeft] = diff / res;
}
if (_rightMouseButtonDown) {
glm::vec2 diff = _currentCursorPos - _previousCursorPos[MouseButtons::ButtonRight];
glm::vec2 res = OsEng.windowWrapper().currentWindowSize();
_currentCursorDiff[MouseButtons::ButtonRight] = diff / res;
}
if (_middleMouseButtonDown) {
glm::vec2 diff = _currentCursorPos - _previousCursorPos[MouseButtons::ButtonMiddle];
glm::vec2 res = OsEng.windowWrapper().currentWindowSize();
_currentCursorDiff[MouseButtons::ButtonMiddle] = diff / res;
}
}
void OrbitalMouseController::scrollWheel(int pos) {
}
void OrbitalMouseController::update(const double& dt){
/*
const float interactionSpeed = OsEng.interactionHandler().interactionSensitivity();
const bool rotationInvert = OsEng.interactionHandler().invertRotation();
const bool rollInvert = OsEng.interactionHandler().invertRoll();
//if (_leftMouseButtonDown || _rightMouseButtonDown || _middleMouseButtonDown){
_handler->orbit(
static_cast<float>(_leftMouseButtonDown) * static_cast<float>(dt) * _currentCursorDiff[MouseButtons::ButtonLeft].x * interactionSpeed * (rotationInvert ? -1.f : 1.f),
static_cast<float>(_leftMouseButtonDown) * static_cast<float>(dt) * _currentCursorDiff[MouseButtons::ButtonLeft].y * interactionSpeed * (rotationInvert ? -1.f : 1.f),
static_cast<float>(_middleMouseButtonDown) * static_cast<float>(dt) * _currentCursorDiff[MouseButtons::ButtonMiddle].x * interactionSpeed * (rollInvert ? -1.f : 1.f),
static_cast<float>(_rightMouseButtonDown) * static_cast<float>(dt) * _currentCursorDiff[MouseButtons::ButtonRight].y * _navigationSpeed);
//}
*/
// if (_leftMouseButtonDown){
// _handler->orbit(static_cast<float>(dt)* _currentCursorDiff[MouseButtons::ButtonLeft].x * _rotationSpeed, static_cast<float>(dt)* _currentCursorDiff[MouseButtons::ButtonLeft].y * _rotationSpeed, 0.f);
// }
// if (_middleMouseButtonDown){
// _handler->orbit(0.f, 0.f, static_cast<float>(dt)* _currentCursorDiff[MouseButtons::ButtonMiddle].x * _rotationSpeed);
// }
// if (_rightMouseButtonDown){
// _handler->distance(static_cast<float>(dt)* _currentCursorDiff[MouseButtons::ButtonRight].y * _navigationSpeed);
// }
}
} // namespace interaction
} // namespace openspace
#endif // USE_OLD_INTERACTIONHANDLER

View File

@@ -31,7 +31,7 @@
#include <openspace/scene/scene.h>
#include <openspace/scene/scenegraphnode.h>
#include <modules/iswa/rendering/iswagroup.h>
#include <modules/iswa/rendering/iswabasegroup.h>
#include <openspace/rendering/screenspacerenderable.h>
#include <modules/iswa/util/iswamanager.h>
#include <modules/iswa/rendering/iswacygnet.h>