Showing the changes to interface/src/scripting/HMDScriptingInterface.cpp (1 of 7 files). Show all
Unified · Split
| @@ -27,10 +27,9 @@ QScriptValue HMDScriptingInterface::getHUDLookAtPosition2D(QScriptContext* conte · 26 unmodified lines | |||
| 27 | MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); | 27 | MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); |
| 28 | glm::vec3 sphereCenter = myAvatar->getDefaultEyePosition(); | 28 | glm::vec3 sphereCenter = myAvatar->getDefaultEyePosition(); |
| 29 | glm::vec3 direction = glm::inverse(myAvatar->getOrientation()) * (hudIntersection - sphereCenter); | 29 | glm::vec3 direction = glm::inverse(myAvatar->getOrientation()) * (hudIntersection - sphereCenter); |
| 30 | glm::quat rotation = ::rotationBetween(glm::vec3(0.0f, 0.0f, -1.0f), direction); | 30 | glm::vec2 polar = glm::vec2(glm::atan(direction.x, -direction.z), glm::asin(direction.y)) * -1.0f; |
| 31 | glm::vec3 eulers = ::safeEulerAngles(rotation); | 31 | auto overlayPos = qApp->getApplicationCompositor().sphericalToOverlay(polar); |
| 32 | return qScriptValueFromValue<glm::vec2>(engine, qApp->getApplicationCompositor() | 32 | return qScriptValueFromValue<glm::vec2>(engine, overlayPos); |
| 33 | .sphericalToOverlay(glm::vec2(eulers.y, -eulers.x))); | ||
| 34 | } | 33 | } |
| 35 | return QScriptValue::NullValue; | 34 | return QScriptValue::NullValue; |
| 36 | } | 35 | } |
| @@ -44,14 +43,6 @@ QScriptValue HMDScriptingInterface::getHUDLookAtPosition3D(QScriptContext* conte · 7 unmodified lines | |||
| 44 | return QScriptValue::NullValue; | 43 | return QScriptValue::NullValue; |
| 45 | } | 44 | } |
| 46 | 45 | ||
| 47 | void HMDScriptingInterface::toggleMagnifier() { | ||
| 48 | qApp->getApplicationCompositor().toggleMagnifier(); | ||
| 49 | } | ||
| 50 | |||
| 51 | bool HMDScriptingInterface::getMagnifier() const { | ||
| 52 | return qApp->getApplicationCompositor().hasMagnifier(); | ||
| 53 | } | ||
| 54 | |||
| 55 | bool HMDScriptingInterface::getHUDLookAtPosition3D(glm::vec3& result) const { | 46 | bool HMDScriptingInterface::getHUDLookAtPosition3D(glm::vec3& result) const { |
| 56 | Camera* camera = qApp->getCamera(); | 47 | Camera* camera = qApp->getCamera(); |
| 57 | glm::vec3 position = camera->getPosition(); | 48 | glm::vec3 position = camera->getPosition(); |