diff --git a/ext/ghoul b/ext/ghoul index c0dc8b8380..3b859c6c54 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit c0dc8b83805c34f435770159772c23de583bb529 +Subproject commit 3b859c6c54658d16b3be26446b65bdfcc6d0d057 diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h index 4e85dee7c3..e4b593d97c 100644 --- a/include/openspace/engine/openspaceengine.h +++ b/include/openspace/engine/openspaceengine.h @@ -83,8 +83,8 @@ public: void keyboardCallback(int key, int action); void charCallback(unsigned int codepoint); void mouseButtonCallback(int key, int action); - void mousePositionCallback(int x, int y); - void mouseScrollWheelCallback(int pos); + void mousePositionCallback(double x, double y); + void mouseScrollWheelCallback(double pos); void externalControlCallback(const char* receivedChars, int size, int clientId); void encode(); void decode(); diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 55f026401b..018462997c 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -690,13 +690,13 @@ void OpenSpaceEngine::mouseButtonCallback(int key, int action) { } } -void OpenSpaceEngine::mousePositionCallback(int x, int y) { +void OpenSpaceEngine::mousePositionCallback(double x, double y) { if (_isMaster) { _interactionHandler->mousePositionCallback(x, y); } } -void OpenSpaceEngine::mouseScrollWheelCallback(int pos) { +void OpenSpaceEngine::mouseScrollWheelCallback(double pos) { if (_isMaster) { if (_gui->isEnabled()) { bool isConsumed = _gui->mouseWheelCallback(pos); diff --git a/src/main.cpp b/src/main.cpp index 9005b246f8..3396b8ef25 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -134,7 +134,7 @@ int main(int argc, char** argv) { } //is this node the master? (must be set after call to _sgctEngine->init()) - OsEng.ref().setMaster(_sgctEngine->isMaster()); + OsEng.setMaster(_sgctEngine->isMaster()); // Main loop LDEBUG("Starting rendering loop"); @@ -151,8 +151,7 @@ int main(int argc, char** argv) { exit(EXIT_SUCCESS); } -void mainInitFunc() -{ +void mainInitFunc() { bool success = OsEng.initialize(); if (success) success = OsEng.initializeGL(); @@ -168,83 +167,70 @@ void mainInitFunc() setupPostFX(); } -void mainPreSyncFunc() -{ +void mainPreSyncFunc() { OsEng.preSynchronization(); } -void mainPostSyncPreDrawFunc() -{ +void mainPostSyncPreDrawFunc() { OsEng.postSynchronizationPreDraw(); } -void mainRenderFunc() -{ +void mainRenderFunc() { + using glm::mat4; + using glm::translate; //not the most efficient, but for clarity @JK - glm::mat4 userMatrix = glm::translate(glm::mat4(1.f), _sgctEngine->getDefaultUserPtr()->getPos()); - glm::mat4 sceneMatrix = _sgctEngine->getModelMatrix(); - glm::mat4 viewMatrix = _sgctEngine->getActiveViewMatrix() * userMatrix; + mat4 userMatrix = translate(mat4(1.f), _sgctEngine->getDefaultUserPtr()->getPos()); + mat4 sceneMatrix = _sgctEngine->getModelMatrix(); + mat4 viewMatrix = _sgctEngine->getActiveViewMatrix() * userMatrix; //dont shift nav-direction on master, makes it very tricky to navigate @JK - if (!OsEng.ref().isMaster()){ + if (!OsEng.ref().isMaster()) viewMatrix = viewMatrix * sceneMatrix; - } - glm::mat4 projectionMatrix = _sgctEngine->getActiveProjectionMatrix(); + mat4 projectionMatrix = _sgctEngine->getActiveProjectionMatrix(); OsEng.render(projectionMatrix, viewMatrix); } -void mainPostDrawFunc() -{ +void mainPostDrawFunc() { OsEng.postDraw(); } -void mainExternalControlCallback(const char* receivedChars, int size) -{ - if (OsEng.ref().isMaster()) +void mainExternalControlCallback(const char* receivedChars, int size) { + if (OsEng.isMaster()) OsEng.externalControlCallback(receivedChars, size, 0); } -void mainKeyboardCallback(int key, int action) -{ - if (OsEng.ref().isMaster()) +void mainKeyboardCallback(int key, int action) { + if (OsEng.isMaster()) OsEng.keyboardCallback(key, action); } -void mainMouseButtonCallback(int key, int action) -{ - if (OsEng.ref().isMaster()) +void mainMouseButtonCallback(int key, int action) { + if (OsEng.isMaster()) OsEng.mouseButtonCallback(key, action); } -void mainMousePosCallback(double x, double y) -{ - // TODO use float instead - if (OsEng.ref().isMaster()) - OsEng.mousePositionCallback(static_cast(x), static_cast(y)); +void mainMousePosCallback(double x, double y) { + if (OsEng.isMaster()) + OsEng.mousePositionCallback(x, y); } -void mainMouseScrollCallback(double posX, double posY) -{ - // TODO use float instead - if (OsEng.ref().isMaster()) - OsEng.mouseScrollWheelCallback(static_cast(posY)); +void mainMouseScrollCallback(double posX, double posY) { + if (OsEng.isMaster()) + OsEng.mouseScrollWheelCallback(posY); } void mainCharCallback(unsigned int codepoint) { - - if (OsEng.ref().isMaster()) + if (OsEng.isMaster()) OsEng.charCallback(codepoint); } -void mainEncodeFun() -{ +void mainEncodeFun() { OsEng.encode(); } -void mainDecodeFun() -{ +void mainDecodeFun() { OsEng.decode(); } @@ -259,7 +245,7 @@ void postFXPass(){ if (OsEng.isMaster()) glUniform1f(_postFXOpacityLoc, 1.f); else - glUniform1f(_postFXOpacityLoc, OsEng.ref().renderEngine()->globalBlackOutFactor()); + glUniform1f(_postFXOpacityLoc, OsEng.renderEngine()->globalBlackOutFactor()); } void setupPostFX(){