History

merge from master

Seth Alves committed 11 years ago

Commit b258aea2 parents 0ec7d3d db56e1587 files · +3217 −1666Browse files

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

Unified · Split

interface/src/Application.cpp+28−20
@@ -115,6 +115,7 @@ · 114 unmodified lines
115115 #include "devices/Faceshift.h"
116116 #include "devices/Leapmotion.h"
117117 #include "devices/RealSense.h"
118+#include "devices/SDL2Manager.h"
118119 #include "devices/MIDIManager.h"
119120 #include "devices/OculusManager.h"
120121 #include "devices/TV3DManager.h"
@@ -129,7 +130,6 @@ · 8 unmodified lines
129130 #include "scripting/AudioDeviceScriptingInterface.h"
130131 #include "scripting/ClipboardScriptingInterface.h"
131132 #include "scripting/HMDScriptingInterface.h"
132−#include "scripting/JoystickScriptingInterface.h"
133133 #include "scripting/GlobalServicesScriptingInterface.h"
134134 #include "scripting/LocationScriptingInterface.h"
135135 #include "scripting/MenuScriptingInterface.h"
@@ -196,7 +196,6 @@ const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::D · 60 unmodified lines
196196 const QString DEFAULT_SCRIPTS_JS_URL = "http://s3.amazonaws.com/hifi-public/scripts/defaultScripts.js";
197197 Setting::Handle<int> maxOctreePacketsPerSecond("maxOctreePPS", DEFAULT_MAX_OCTREE_PPS);
198198
199−
200199 #ifdef Q_OS_WIN
201200 class MyNativeEventFilter : public QAbstractNativeEventFilter {
202201 public:
@@ -889,6 +888,9 @@ void Application::paintGL() { · 686 unmodified lines
889888 }
890889
891890 glEnable(GL_LINE_SMOOTH);
891+
892+ Menu::getInstance()->setIsOptionChecked("First Person", _myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN);
893+ Application::getInstance()->cameraMenuChanged();
892894
893895 if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
894896 // Always use the default eye position, not the actual head eye position.
@@ -907,9 +909,8 @@ void Application::paintGL() { · 12 unmodified lines
907909 }
908910
909911 } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
910− static const float THIRD_PERSON_CAMERA_DISTANCE = 1.5f;
911912 _myCamera.setPosition(_myAvatar->getDefaultEyePosition() +
912− _myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, 1.0f) * THIRD_PERSON_CAMERA_DISTANCE * _myAvatar->getScale());
913+ _myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, 1.0f) * _myAvatar->getBoomLength() * _myAvatar->getScale());
913914 if (OculusManager::isConnected()) {
914915 _myCamera.setRotation(_myAvatar->getWorldAlignedOrientation());
915916 } else {
@@ -1492,6 +1493,8 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 576 unmodified lines
14921493
14931494 void Application::focusOutEvent(QFocusEvent* event) {
14941495 _keyboardMouseDevice.focusOutEvent(event);
1496+ SixenseManager::getInstance().focusOutEvent();
1497+ SDL2Manager::getInstance()->focusOutEvent();
14951498
14961499 // synthesize events for keys currently pressed, since we may not get their release events
14971500 foreach (int key, _keysPressed) {
@@ -1927,11 +1930,15 @@ void Application::setEnableVRMode(bool enableVRMode) { · 429 unmodified lines
19271930 // attempt to reconnect the Oculus manager - it's possible this was a workaround
19281931 // for the sixense crash
19291932 OculusManager::disconnect();
1930− OculusManager::connect();
1933+ OculusManager::connect(_glWidget->context()->contextHandle());
1934+ _glWidget->setFocus();
1935+ _glWidget->makeCurrent();
1936+ glClear(GL_COLOR_BUFFER_BIT);
19311937 }
19321938 OculusManager::recalibrate();
19331939 } else {
19341940 OculusManager::abandonCalibration();
1941+ OculusManager::disconnect();
19351942
19361943 _mirrorCamera.setHmdPosition(glm::vec3());
19371944 _mirrorCamera.setHmdRotation(glm::quat());
@@ -2167,13 +2174,6 @@ void Application::init() { · 229 unmodified lines
21672174
21682175 _mirrorCamera.setMode(CAMERA_MODE_MIRROR);
21692176
2170− OculusManager::connect();
2171− if (OculusManager::isConnected()) {
2172− QMetaObject::invokeMethod(Menu::getInstance()->getActionForOption(MenuOption::Fullscreen),
2173− "trigger",
2174− Qt::QueuedConnection);
2175− }
2176−
21772177 TV3DManager::connect();
21782178 if (TV3DManager::isConnected()) {
21792179 QMetaObject::invokeMethod(Menu::getInstance()->getActionForOption(MenuOption::Fullscreen),
@@ -2406,10 +2406,14 @@ void Application::cameraMenuChanged() { · 226 unmodified lines
24062406 } else if (Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson)) {
24072407 if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) {
24082408 _myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
2409+ _myAvatar->setBoomLength(MyAvatar::ZOOM_MIN);
24092410 }
24102411 } else {
24112412 if (_myCamera.getMode() != CAMERA_MODE_THIRD_PERSON) {
24122413 _myCamera.setMode(CAMERA_MODE_THIRD_PERSON);
2414+ if (_myAvatar->getBoomLength() == MyAvatar::ZOOM_MIN) {
2415+ _myAvatar->setBoomLength(MyAvatar::ZOOM_DEFAULT);
2416+ }
24132417 }
24142418 }
24152419 }
@@ -2487,7 +2491,7 @@ void Application::update(float deltaTime) { · 71 unmodified lines
24872491 }
24882492
24892493 SixenseManager::getInstance().update(deltaTime);
2490− JoystickScriptingInterface::getInstance().update();
2494+ SDL2Manager::getInstance()->update();
24912495 }
24922496
24932497 _userInputMapper.update(deltaTime);
@@ -2508,7 +2512,8 @@ void Application::update(float deltaTime) { · 14 unmodified lines
25082512 _myAvatar->setDriveKeys(ROT_DOWN, _userInputMapper.getActionState(UserInputMapper::PITCH_DOWN));
25092513 _myAvatar->setDriveKeys(ROT_LEFT, _userInputMapper.getActionState(UserInputMapper::YAW_LEFT));
25102514 _myAvatar->setDriveKeys(ROT_RIGHT, _userInputMapper.getActionState(UserInputMapper::YAW_RIGHT));
2511−
2515+ _myAvatar->setDriveKeys(BOOM_IN, _userInputMapper.getActionState(UserInputMapper::BOOM_IN));
2516+ _myAvatar->setDriveKeys(BOOM_OUT, _userInputMapper.getActionState(UserInputMapper::BOOM_OUT));
25122517
25132518 updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process...
25142519
@@ -3260,6 +3265,9 @@ namespace render { · 745 unmodified lines
32603265 template <> const Item::Bound payloadGetBound(const BackgroundRenderData::Pointer& stuff) { return Item::Bound(); }
32613266 template <> void payloadRender(const BackgroundRenderData::Pointer& background, RenderArgs* args) {
32623267
3268+ Q_ASSERT(args->_batch);
3269+ gpu::Batch& batch = *args->_batch;
3270+
32633271 // Background rendering decision
32643272 auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
32653273 auto skybox = model::SkyboxPointer();
@@ -3327,7 +3335,8 @@ namespace render { · 61 unmodified lines
33273335 PerformanceTimer perfTimer("atmosphere");
33283336 PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
33293337 "Application::displaySide() ... atmosphere...");
3330− background->_environment->renderAtmospheres(*(args->_viewFrustum));
3338+
3339+ background->_environment->renderAtmospheres(batch, *(args->_viewFrustum));
33313340 }
33323341
33333342 }
@@ -3336,13 +3345,13 @@ namespace render { · 2 unmodified lines
33363345
33373346 skybox = skyStage->getSkybox();
33383347 if (skybox) {
3339− gpu::Batch batch;
33403348 model::Skybox::render(batch, *(Application::getInstance()->getDisplayViewFrustum()), *skybox);
3341−
3342− gpu::GLBackend::renderBatch(batch, true);
3343− glUseProgram(0);
33443349 }
33453350 }
3351+ // FIX ME - If I don't call this renderBatch() here, then the atmosphere and skybox don't render, but it
3352+ // seems like these payloadRender() methods shouldn't be doing this. We need to investigate why the engine
3353+ // isn't rendering our batch
3354+ gpu::GLBackend::renderBatch(batch, true);
33463355 }
33473356 }
33483357
@@ -4078,7 +4087,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 729 unmodified lines
40784087
40794088 scriptEngine->registerGlobalObject("AvatarManager", DependencyManager::get<AvatarManager>().data());
40804089
4081− scriptEngine->registerGlobalObject("Joysticks", &JoystickScriptingInterface::getInstance());
40824090 qScriptRegisterMetaType(scriptEngine, joystickToScriptValue, joystickFromScriptValue);
40834091
40844092 scriptEngine->registerGlobalObject("UndoStack", &_undoStackScriptingInterface);

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