From deb599f5eea68d2b14f39498606f329d1bec5a2c Mon Sep 17 00:00:00 2001 From: Alan Jeffrey Date: Wed, 14 Nov 2018 10:53:07 -0600 Subject: Use a laser pointer rather than the trackpad to control web content. --- support/magicleap/Servo2D/code/inc/Servo2D.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'support/magicleap/Servo2D/code/inc/Servo2D.h') diff --git a/support/magicleap/Servo2D/code/inc/Servo2D.h b/support/magicleap/Servo2D/code/inc/Servo2D.h index 559817ea280..2209a181f6f 100644 --- a/support/magicleap/Servo2D/code/inc/Servo2D.h +++ b/support/magicleap/Servo2D/code/inc/Servo2D.h @@ -2,16 +2,20 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include #include #include #include #include #include #include +#include +#include #include #include #include #include +#include #include #include @@ -100,22 +104,32 @@ protected: * Handle events from the server */ virtual bool eventListener(lumin::ServerEvent* event) override; - bool touchpadEventListener(lumin::ControlTouchPadInputEventData* event); + bool pose6DofEventListener(lumin::ControlPose6DofInputEventData* event); void urlBarEventListener(); bool gestureEventListener(lumin::GestureInputEventData* event); /** - * Get the current cursor position, with respect to the viewport. + * Convert a point in prism coordinates to viewport coordinates + * (ignoring the z value). */ - glm::vec2 viewportCursorPosition(); + glm::vec2 viewportPosition(glm::vec3 prism_pos); bool pointInsideViewport(glm::vec2 pt); + /** + * Redraw the laser. Returns the laser endpoint, in viewport coordinates. + */ + glm::vec2 redrawLaser(); + private: lumin::Prism* prism_ = nullptr; // represents the bounded space where the App renders. lumin::PlanarResource* plane_ = nullptr; // the plane we're rendering into lumin::QuadNode* content_node_ = nullptr; // the node containing the plane + lumin::ui::UiPanel* content_panel_ = nullptr; // the panel containing the node lumin::ui::UiButton* back_button_ = nullptr; // the back button lumin::ui::UiButton* fwd_button_ = nullptr; // the forward button lumin::ui::UiTextEdit* url_bar_ = nullptr; // the URL bar + lumin::LineNode* laser_ = nullptr; // The laser pointer + glm::vec3 controller_position_; // The last recorded position of the controller (in world coords) + glm::quat controller_orientation_; // The last recorded orientation of the controller (in world coords) ServoInstance* servo_ = nullptr; // the servo instance we're embedding }; -- cgit v1.2.3