History

Merge remote-tracking branch 'upstream/master'

wangyix committed 12 years ago

Commit 01005dc2 parents c6a9a89 49a33ff27 files · +1495 −339Browse files

Showing the changes to interface/src/ui/ApplicationOverlay.cpp (1 of 27 files). Show all

Unified · Split

interface/src/ui/ApplicationOverlay.cpp+19−2
@@ -297,6 +297,25 @@ void ApplicationOverlay::displayOverlayTexture(Camera& whichCamera) { · 296 unmodified lines
297 glDisable(GL_TEXTURE_2D);297 glDisable(GL_TEXTURE_2D);
298}298}
299 299
300const float textureFov = PI / 2.5f;
301
302void ApplicationOverlay::computeOculusPickRay(float x, float y, glm::vec3& direction) const {
303 glm::quat rot = Application::getInstance()->getAvatar()->getOrientation();
304
305 //invert y direction
306 y = 1.0 - y;
307
308 //Get position on hemisphere UI
309 x = sin((x - 0.5f) * textureFov);
310 y = sin((y - 0.5f) * textureFov);
311
312 float dist = sqrt(x * x + y * y);
313 float z = -sqrt(1.0f - dist * dist);
314
315 //Rotate the UI pick ray by the avatar orientation
316 direction = glm::normalize(rot * glm::vec3(x, y, z));
317}
318
300// Fast helper functions319// Fast helper functions
301inline float max(float a, float b) {320inline float max(float a, float b) {
302 return (a > b) ? a : b;321 return (a > b) ? a : b;
@@ -306,8 +325,6 @@ inline float min(float a, float b) { · 3 unmodified lines
306 return (a < b) ? a : b;325 return (a < b) ? a : b;
307}326}
308 327
309const float textureFov = PI / 2.5f;
310
311// Draws the FBO texture for Oculus rift. TODO: Draw a curved texture instead of plane.328// Draws the FBO texture for Oculus rift. TODO: Draw a curved texture instead of plane.
312void ApplicationOverlay::displayOverlayTextureOculus(Camera& whichCamera) {329void ApplicationOverlay::displayOverlayTextureOculus(Camera& whichCamera) {
313 330