From 299389ccef8ece4cf0cdd87a51f9c122de767ea2 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 8 Dec 2014 09:59:33 -0800 Subject: [PATCH 1/4] Fixed typo --- interface/src/Application.cpp | 2 -- interface/src/ui/ApplicationOverlay.cpp | 28 ++++++++++++------------- interface/src/ui/ApplicationOverlay.h | 10 ++++----- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 2d92a99cab..6f12957b2d 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2347,12 +2347,10 @@ void Application::update(float deltaTime) { if (OculusManager::isConnected() && Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode)){ if (_window->cursor().shape() != Qt::BlankCursor) { - qDebug() << "Hiding cursor" << _window->cursor().shape(); cursor = _window->cursor(); _window->setCursor(QCursor(Qt::BlankCursor)); } } else if(_window->cursor().shape() == Qt::BlankCursor) { - qDebug() << "Showing cursor" << _window->cursor().shape(); _window->setCursor(cursor); } diff --git a/interface/src/ui/ApplicationOverlay.cpp b/interface/src/ui/ApplicationOverlay.cpp index f4e9e627ad..602e99ac31 100644 --- a/interface/src/ui/ApplicationOverlay.cpp +++ b/interface/src/ui/ApplicationOverlay.cpp @@ -103,7 +103,7 @@ bool raySphereIntersect(const glm::vec3 &dir, const glm::vec3 &origin, float r, } } -void renderReticule(glm::quat orientation, float alpha) { +void renderReticle(glm::quat orientation, float alpha) { glm::vec3 topLeft = getPoint(reticleSize / 2.0f, -reticleSize / 2.0f); glm::vec3 topRight = getPoint(-reticleSize / 2.0f, -reticleSize / 2.0f); glm::vec3 bottomLeft = getPoint(reticleSize / 2.0f, reticleSize / 2.0f); @@ -269,7 +269,7 @@ void ApplicationOverlay::displayOverlayTextureOculus(Camera& whichCamera) { glm::mat4 rotation = glm::toMat4(orientation); glMultMatrixf(&rotation[0][0]); glScalef(scale, scale, scale); - for (int i = 0; i < NUMBER_OF_RETICULES; i++) { + for (int i = 0; i < NUMBER_OF_RETICLES; i++) { if (_magActive[i]) { _magSizeMult[i] += MAG_SPEED; @@ -285,8 +285,8 @@ void ApplicationOverlay::displayOverlayTextureOculus(Camera& whichCamera) { if (_magSizeMult[i] > 0.0f) { //Render magnifier, but dont show border for mouse magnifier - glm::vec2 projection = screenToOverlay(glm::vec2(_reticulePosition[MOUSE].x(), - _reticulePosition[MOUSE].y())); + glm::vec2 projection = screenToOverlay(glm::vec2(_reticlePosition[MOUSE].x(), + _reticlePosition[MOUSE].y())); renderMagnifier(projection, _magSizeMult[i], i != MOUSE); } @@ -528,7 +528,7 @@ void ApplicationOverlay::renderPointers() { QPoint position = QPoint(application->getTrueMouseX(), application->getTrueMouseY()); static const int MAX_IDLE_TIME = 3; - if (_reticulePosition[MOUSE] != position) { + if (_reticlePosition[MOUSE] != position) { _lastMouseMove = usecTimestampNow(); } else if (usecTimestampNow() - _lastMouseMove > MAX_IDLE_TIME * USECS_PER_SECOND) { float pitch, yaw, roll; @@ -539,7 +539,7 @@ void ApplicationOverlay::renderPointers() { QCursor::setPos(application->getGLWidget()->mapToGlobal(position)); } - _reticulePosition[MOUSE] = position; + _reticlePosition[MOUSE] = position; _reticleActive[MOUSE] = true; _magActive[MOUSE] = true; _reticleActive[LEFT_CONTROLLER] = false; @@ -561,9 +561,9 @@ void ApplicationOverlay::renderControllerPointers() { MyAvatar* myAvatar = application->getAvatar(); //Static variables used for storing controller state - static quint64 pressedTime[NUMBER_OF_RETICULES] = { 0ULL, 0ULL, 0ULL }; - static bool isPressed[NUMBER_OF_RETICULES] = { false, false, false }; - static bool stateWhenPressed[NUMBER_OF_RETICULES] = { false, false, false }; + static quint64 pressedTime[NUMBER_OF_RETICLES] = { 0ULL, 0ULL, 0ULL }; + static bool isPressed[NUMBER_OF_RETICLES] = { false, false, false }; + static bool stateWhenPressed[NUMBER_OF_RETICLES] = { false, false, false }; const HandData* handData = Application::getInstance()->getAvatar()->getHandData(); @@ -610,7 +610,7 @@ void ApplicationOverlay::renderControllerPointers() { QPoint point = getPalmClickLocation(palmData); - _reticulePosition[index] = point; + _reticlePosition[index] = point; //When button 2 is pressed we drag the mag window if (isPressed[index]) { @@ -685,16 +685,16 @@ void ApplicationOverlay::renderPointersOculus(const glm::vec3& eyePos) { float yaw = glm::acos(-tipDirection.z) * ((yawSign == 0.0f) ? 1.0f : yawSign); glm::quat orientation = glm::quat(glm::vec3(pitch, yaw, 0.0f)); - renderReticule(orientation, _alpha); + renderReticle(orientation, _alpha); } } //Mouse Pointer if (_reticleActive[MOUSE]) { - glm::vec2 projection = screenToSpherical(glm::vec2(_reticulePosition[MOUSE].x(), - _reticulePosition[MOUSE].y())); + glm::vec2 projection = screenToSpherical(glm::vec2(_reticlePosition[MOUSE].x(), + _reticlePosition[MOUSE].y())); glm::quat orientation(glm::vec3(-projection.y, projection.x, 0.0f)); - renderReticule(orientation, _alpha); + renderReticle(orientation, _alpha); } glEnable(GL_DEPTH_TEST); diff --git a/interface/src/ui/ApplicationOverlay.h b/interface/src/ui/ApplicationOverlay.h index 538a163d0e..269adef4f3 100644 --- a/interface/src/ui/ApplicationOverlay.h +++ b/interface/src/ui/ApplicationOverlay.h @@ -94,11 +94,11 @@ private: float _textureFov; float _textureAspectRatio; - enum Reticules { MOUSE, LEFT_CONTROLLER, RIGHT_CONTROLLER, NUMBER_OF_RETICULES }; - bool _reticleActive[NUMBER_OF_RETICULES]; - QPoint _reticulePosition[NUMBER_OF_RETICULES]; - bool _magActive[NUMBER_OF_RETICULES]; - float _magSizeMult[NUMBER_OF_RETICULES]; + enum Reticles { MOUSE, LEFT_CONTROLLER, RIGHT_CONTROLLER, NUMBER_OF_RETICLES }; + bool _reticleActive[NUMBER_OF_RETICLES]; + QPoint _reticlePosition[NUMBER_OF_RETICLES]; + bool _magActive[NUMBER_OF_RETICLES]; + float _magSizeMult[NUMBER_OF_RETICLES]; quint64 _lastMouseMove; float _alpha; From a6f7a1ce15713124825193c143d3b0ba39dec9b8 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 9 Dec 2014 11:52:20 -0800 Subject: [PATCH 2/4] guard against NULL _models --- interface/src/entities/RenderableModelEntityItem.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/interface/src/entities/RenderableModelEntityItem.cpp b/interface/src/entities/RenderableModelEntityItem.cpp index 8509fa1f67..080162dc16 100644 --- a/interface/src/entities/RenderableModelEntityItem.cpp +++ b/interface/src/entities/RenderableModelEntityItem.cpp @@ -268,7 +268,10 @@ EntityItemProperties RenderableModelEntityItem::getProperties() const { bool RenderableModelEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction, bool& keepSearching, OctreeElement*& element, float& distance, BoxFace& face, void** intersectedObject, bool precisionPicking) const { - + if (!_model) { + return true; + } + glm::vec3 originInMeters = origin * (float)TREE_SCALE; QString extraInfo; float localDistance; From eaaaa0687ca19d1d2a7839616d873f44fc6436de Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 9 Dec 2014 11:53:14 -0800 Subject: [PATCH 3/4] spacing --- libraries/octree/src/ViewFrustum.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/octree/src/ViewFrustum.cpp b/libraries/octree/src/ViewFrustum.cpp index 0549c60134..1d23bf800e 100644 --- a/libraries/octree/src/ViewFrustum.cpp +++ b/libraries/octree/src/ViewFrustum.cpp @@ -591,7 +591,7 @@ PickRay ViewFrustum::computePickRay(float x, float y) { } void ViewFrustum::computePickRay(float x, float y, glm::vec3& origin, glm::vec3& direction) const { - origin = _nearTopLeft + x*(_nearTopRight - _nearTopLeft) + y*(_nearBottomLeft - _nearTopLeft); + origin = _nearTopLeft + x * (_nearTopRight - _nearTopLeft) + y * (_nearBottomLeft - _nearTopLeft); direction = glm::normalize(origin - (_position + _orientation * _eyeOffsetPosition)); } From 649940de244b7fc509818448c3addb0aa0c49d51 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 9 Dec 2014 11:53:32 -0800 Subject: [PATCH 4/4] wrong pickray function --- interface/src/ui/NodeBounds.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/src/ui/NodeBounds.cpp b/interface/src/ui/NodeBounds.cpp index 3c6b4c625a..b0d3ddd14f 100644 --- a/interface/src/ui/NodeBounds.cpp +++ b/interface/src/ui/NodeBounds.cpp @@ -38,7 +38,8 @@ void NodeBounds::draw() { // Compute ray to find selected nodes later on. We can't use the pre-computed ray in Application because it centers // itself after the cursor disappears. Application* application = Application::getInstance(); - PickRay pickRay = application->getCamera()->computeViewPickRay(application->getTrueMouseX(), application->getTrueMouseY()); + PickRay pickRay = application->getCamera()->computePickRay(application->getTrueMouseX(), + application->getTrueMouseY()); // Variables to keep track of the selected node and properties to draw the cube later if needed Node* selectedNode = NULL;