History

Merge remote-tracking branch 'upstream/master'

LionTurtle committed 13 years ago

Commit b0803c12 parents ac878c9 e31ba3b22 files · +540 −251Browse files

Showing the changes to interface/src/Application.cpp (1 of 22 files). Show all

Unified · Split

interface/src/Application.cpp+53−14
@@ -48,7 +48,7 @@ · 47 unmodified lines
48#include <NodeTypes.h>48#include <NodeTypes.h>
49#include <AudioInjectionManager.h>49#include <AudioInjectionManager.h>
50#include <AudioInjector.h>50#include <AudioInjector.h>
51#include <Logstash.h>51#include <Logging.h>
52#include <OctalCode.h>52#include <OctalCode.h>
53#include <PacketHeaders.h>53#include <PacketHeaders.h>
54#include <PairingHandler.h>54#include <PairingHandler.h>
@@ -319,7 +319,7 @@ void Application::initializeGL() { · 264 unmodified lines
319 const char LOGSTASH_INTERFACE_START_TIME_KEY[] = "interface-start-time";319 const char LOGSTASH_INTERFACE_START_TIME_KEY[] = "interface-start-time";
320 320
321 // ask the Logstash class to record the startup time321 // ask the Logstash class to record the startup time
322 Logstash::stashValue(STAT_TYPE_TIMER, LOGSTASH_INTERFACE_START_TIME_KEY, startupTime);322 Logging::stashValue(STAT_TYPE_TIMER, LOGSTASH_INTERFACE_START_TIME_KEY, startupTime);
323 }323 }
324 324
325 // update before the first render325 // update before the first render
@@ -424,9 +424,6 @@ void Application::resizeGL(int width, int height) { · 98 unmodified lines
424 resetCamerasOnResizeGL(_viewFrustumOffsetCamera, width, height);424 resetCamerasOnResizeGL(_viewFrustumOffsetCamera, width, height);
425 resetCamerasOnResizeGL(_myCamera, width, height);425 resetCamerasOnResizeGL(_myCamera, width, height);
426 426
427 // Tell our viewFrustum about this change, using the application camera
428 loadViewFrustum(_myCamera, _viewFrustum);
429
430 glViewport(0, 0, width, height); // shouldn't this account for the menu???427 glViewport(0, 0, width, height); // shouldn't this account for the menu???
431 428
432 updateProjectionMatrix();429 updateProjectionMatrix();
@@ -437,9 +434,12 @@ void Application::updateProjectionMatrix() { · 4 unmodified lines
437 glMatrixMode(GL_PROJECTION);434 glMatrixMode(GL_PROJECTION);
438 glLoadIdentity();435 glLoadIdentity();
439 436
437 // Tell our viewFrustum about this change, using the application camera
438 loadViewFrustum(_myCamera, _viewFrustum);
439
440 float left, right, bottom, top, nearVal, farVal;440 float left, right, bottom, top, nearVal, farVal;
441 glm::vec4 nearClipPlane, farClipPlane;441 glm::vec4 nearClipPlane, farClipPlane;
442 _viewFrustum.computeOffAxisFrustum(left, right, bottom, top, nearVal, farVal, nearClipPlane, farClipPlane);442 computeOffAxisFrustum(left, right, bottom, top, nearVal, farVal, nearClipPlane, farClipPlane);
443 443
444 // If we're in Display Frustum mode, then we want to use the slightly adjust near/far clip values of the444 // If we're in Display Frustum mode, then we want to use the slightly adjust near/far clip values of the
445 // _viewFrustumOffsetCamera, so that we can see more of the application content in the application's frustum445 // _viewFrustumOffsetCamera, so that we can see more of the application content in the application's frustum
@@ -632,8 +632,8 @@ void Application::keyPressEvent(QKeyEvent* event) { · 186 unmodified lines
632 632
633 case Qt::Key_J:633 case Qt::Key_J:
634 if (isShifted) {634 if (isShifted) {
635 _myCamera.setEyeOffsetOrientation(glm::normalize(635 _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() - 0.1f);
636 glm::quat(glm::vec3(0, 0.002f, 0)) * _myCamera.getEyeOffsetOrientation()));636
637 } else {637 } else {
638 _myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(-0.001, 0, 0));638 _myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(-0.001, 0, 0));
639 }639 }
@@ -642,8 +642,8 @@ void Application::keyPressEvent(QKeyEvent* event) { · 2 unmodified lines
642 642
643 case Qt::Key_M:643 case Qt::Key_M:
644 if (isShifted) {644 if (isShifted) {
645 _myCamera.setEyeOffsetOrientation(glm::normalize(645 _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() + 0.1f);
646 glm::quat(glm::vec3(0, -0.002f, 0)) * _myCamera.getEyeOffsetOrientation()));646
647 } else {647 } else {
648 _myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(0.001, 0, 0));648 _myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(0.001, 0, 0));
649 }649 }
@@ -1836,15 +1836,17 @@ void Application::update(float deltaTime) { · 1186 unmodified lines
1836 }1836 }
1837 1837
1838 if (Menu::getInstance()->isOptionChecked(MenuOption::OffAxisProjection)) {1838 if (Menu::getInstance()->isOptionChecked(MenuOption::OffAxisProjection)) {
1839 float xSign = Menu::getInstance()->isOptionChecked(MenuOption::Mirror) ? 1.0f : -1.0f;
1839 if (_faceshift.isActive()) {1840 if (_faceshift.isActive()) {
1840 const float EYE_OFFSET_SCALE = 0.005f;1841 const float EYE_OFFSET_SCALE = 0.025f;
1841 glm::vec3 position = _faceshift.getHeadTranslation() * EYE_OFFSET_SCALE;1842 glm::vec3 position = _faceshift.getHeadTranslation() * EYE_OFFSET_SCALE;
1842 _myCamera.setEyeOffsetPosition(glm::vec3(-position.x, position.y, position.z)); 1843 _myCamera.setEyeOffsetPosition(glm::vec3(position.x * xSign, position.y, position.z));
1843 updateProjectionMatrix();1844 updateProjectionMatrix();
1844 1845
1845 } else if (_webcam.isActive()) {1846 } else if (_webcam.isActive()) {
1846 const float EYE_OFFSET_SCALE = 5.0f;1847 const float EYE_OFFSET_SCALE = 0.5f;
1847 _myCamera.setEyeOffsetPosition(_webcam.getEstimatedPosition() * EYE_OFFSET_SCALE);1848 glm::vec3 position = _webcam.getEstimatedPosition() * EYE_OFFSET_SCALE;
1849 _myCamera.setEyeOffsetPosition(glm::vec3(position.x * xSign, -position.y, position.z));
1848 updateProjectionMatrix();1850 updateProjectionMatrix();
1849 }1851 }
1850 }1852 }
@@ -2166,6 +2168,19 @@ void Application::setupWorldLight(Camera& whichCamera) { · 315 unmodified lines
2166 glMateriali(GL_FRONT, GL_SHININESS, 96);2168 glMateriali(GL_FRONT, GL_SHININESS, 96);
2167}2169}
2168 2170
2171void Application::computeOffAxisFrustum(float& left, float& right, float& bottom, float& top, float& near,
2172 float& far, glm::vec4& nearClipPlane, glm::vec4& farClipPlane) const {
2173
2174 _viewFrustum.computeOffAxisFrustum(left, right, bottom, top, near, far, nearClipPlane, farClipPlane);
2175
2176 // when mirrored, we must flip left and right
2177 if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
2178 float tmp = left;
2179 left = -right;
2180 right = -tmp;
2181 }
2182}
2183
2169void Application::displaySide(Camera& whichCamera) {2184void Application::displaySide(Camera& whichCamera) {
2170 // transform by eye offset2185 // transform by eye offset
2171 2186
@@ -2969,6 +2984,30 @@ void Application::renderViewFrustum(ViewFrustum& viewFrustum) { · 797 unmodified lines
2969 // left plane - top edge - viewFrustum.getNear to distant2984 // left plane - top edge - viewFrustum.getNear to distant
2970 glVertex3f(viewFrustum.getNearTopLeft().x, viewFrustum.getNearTopLeft().y, viewFrustum.getNearTopLeft().z);2985 glVertex3f(viewFrustum.getNearTopLeft().x, viewFrustum.getNearTopLeft().y, viewFrustum.getNearTopLeft().z);
2971 glVertex3f(viewFrustum.getFarTopLeft().x, viewFrustum.getFarTopLeft().y, viewFrustum.getFarTopLeft().z);2986 glVertex3f(viewFrustum.getFarTopLeft().x, viewFrustum.getFarTopLeft().y, viewFrustum.getFarTopLeft().z);
2987
2988 // focal plane - bottom edge
2989 glColor3f(1.0f, 0.0f, 1.0f);
2990 float focalProportion = (viewFrustum.getFocalLength() - viewFrustum.getNearClip()) /
2991 (viewFrustum.getFarClip() - viewFrustum.getNearClip());
2992 glm::vec3 focalBottomLeft = glm::mix(viewFrustum.getNearBottomLeft(), viewFrustum.getFarBottomLeft(), focalProportion);
2993 glm::vec3 focalBottomRight = glm::mix(viewFrustum.getNearBottomRight(),
2994 viewFrustum.getFarBottomRight(), focalProportion);
2995 glVertex3f(focalBottomLeft.x, focalBottomLeft.y, focalBottomLeft.z);
2996 glVertex3f(focalBottomRight.x, focalBottomRight.y, focalBottomRight.z);
2997
2998 // focal plane - top edge
2999 glm::vec3 focalTopLeft = glm::mix(viewFrustum.getNearTopLeft(), viewFrustum.getFarTopLeft(), focalProportion);
3000 glm::vec3 focalTopRight = glm::mix(viewFrustum.getNearTopRight(), viewFrustum.getFarTopRight(), focalProportion);
3001 glVertex3f(focalTopLeft.x, focalTopLeft.y, focalTopLeft.z);
3002 glVertex3f(focalTopRight.x, focalTopRight.y, focalTopRight.z);
3003
3004 // focal plane - left edge
3005 glVertex3f(focalBottomLeft.x, focalBottomLeft.y, focalBottomLeft.z);
3006 glVertex3f(focalTopLeft.x, focalTopLeft.y, focalTopLeft.z);
3007
3008 // focal plane - right edge
3009 glVertex3f(focalBottomRight.x, focalBottomRight.y, focalBottomRight.z);
3010 glVertex3f(focalTopRight.x, focalTopRight.y, focalTopRight.z);
2972 }3011 }
2973 glEnd();3012 glEnd();
2974 glEnable(GL_LIGHTING);3013 glEnable(GL_LIGHTING);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t