History

Merge branch 'master' of https://github.com/highfidelity/hifi into proto-received-message

Ryan Huffman committed 10 years ago

Commit 89c412c2 parents ce882a9 d076294320 files · +41473 −8534Browse files

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

Unified · Split

interface/src/Application.cpp+22−43
@@ -50,6 +50,7 @@ · 49 unmodified lines
5050 #include <AssetClient.h>
5151 #include <AssetUpload.h>
5252 #include <AutoUpdater.h>
53+#include <AudioInjectorManager.h>
5354 #include <CursorManager.h>
5455 #include <DeferredLightingEffect.h>
5556 #include <display-plugins/DisplayPlugin.h>
@@ -77,7 +78,7 @@ · 21 unmodified lines
7778 #include <ObjectMotionState.h>
7879 #include <OctalCode.h>
7980 #include <OctreeSceneStats.h>
80−#include <gl/OffscreenGlCanvas.h>
81+#include <gl/OffscreenGLCanvas.h>
8182 #include <PathUtils.h>
8283 #include <PerfStat.h>
8384 #include <PhysicsEngine.h>
@@ -109,8 +110,6 @@ · 25 unmodified lines
109110 #include "devices/EyeTracker.h"
110111 #include "devices/Faceshift.h"
111112 #include "devices/Leapmotion.h"
112−#include "devices/MIDIManager.h"
113−#include "devices/RealSense.h"
114113 #include "DiscoverabilityManager.h"
115114 #include "GLCanvas.h"
116115 #include "InterfaceActionFactory.h"
@@ -148,6 +147,8 @@ · 31 unmodified lines
148147 #include "ui/Stats.h"
149148 #include "ui/UpdateDialog.h"
150149 #include "Util.h"
150+#include "InterfaceParentFinder.h"
151+
151152
152153
153154 // ON WIndows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU
@@ -296,6 +297,7 @@ bool setupEssentials(int& argc, char** argv) { · 142 unmodified lines
296297 DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
297298 DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>();
298299 DependencyManager::registerInheritance<EntityActionFactoryInterface, InterfaceActionFactory>();
300+ DependencyManager::registerInheritance<SpatialParentFinder, InterfaceParentFinder>();
299301
300302 Setting::init();
301303
@@ -340,9 +342,11 @@ bool setupEssentials(int& argc, char** argv) { · 38 unmodified lines
340342 DependencyManager::set<PathUtils>();
341343 DependencyManager::set<InterfaceActionFactory>();
342344 DependencyManager::set<AssetClient>();
345+ DependencyManager::set<AudioInjectorManager>();
343346 DependencyManager::set<MessagesClient>();
344347 DependencyManager::set<UserInputMapper>();
345348 DependencyManager::set<controller::ScriptingInterface, ControllerScriptingInterface>();
349+ DependencyManager::set<InterfaceParentFinder>();
346350 return true;
347351 }
348352
@@ -614,7 +618,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 265 unmodified lines
614618 // enable mouse tracking; otherwise, we only get drag events
615619 _glWidget->setMouseTracking(true);
616620
617− _offscreenContext = new OffscreenGlCanvas();
621+ _offscreenContext = new OffscreenGLCanvas();
618622 _offscreenContext->create(_glWidget->context()->contextHandle());
619623 _offscreenContext->makeCurrent();
620624 initializeGL();
@@ -717,12 +721,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 96 unmodified lines
717721 // set the local loopback interface for local sounds from audio scripts
718722 AudioScriptingInterface::getInstance().setLocalAudioInterface(audioIO.data());
719723
720−#ifdef HAVE_RTMIDI
721− // setup the MIDIManager
722− MIDIManager& midiManagerInstance = MIDIManager::getInstance();
723− midiManagerInstance.openDefaultPort();
724−#endif
725−
726724 this->installEventFilter(this);
727725
728726 // initialize our face trackers after loading the menu settings
@@ -894,6 +892,10 @@ void Application::cleanupBeforeQuit() { · 165 unmodified lines
894892
895893 // destroy the AudioClient so it and its thread have a chance to go down safely
896894 DependencyManager::destroy<AudioClient>();
895+
896+ // destroy the AudioInjectorManager so it and its thread have a chance to go down safely
897+ // this will also stop any ongoing network injectors
898+ DependencyManager::destroy<AudioInjectorManager>();
897899
898900 // Destroy third party processes after scripts have finished using them.
899901 #ifdef HAVE_DDE
@@ -964,7 +966,6 @@ Application::~Application() { · 64 unmodified lines
964966 nodeThread->wait();
965967
966968 Leapmotion::destroy();
967− RealSense::destroy();
968969
969970 #if 0
970971 ConnexionClient::getInstance().destroy();
@@ -1244,7 +1245,7 @@ void Application::paintGL() { · 273 unmodified lines
12441245 * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)) * hmdRotation);
12451246 glm::vec3 hmdOffset = extractTranslation(myAvatar->getHMDSensorMatrix());
12461247 _myCamera.setPosition(myAvatar->getDefaultEyePosition()
1247− + glm::vec3(0, _raiseMirror * myAvatar->getScale(), 0)
1248+ + glm::vec3(0, _raiseMirror * myAvatar->getAvatarScale(), 0)
12481249 + (myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) *
12491250 glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror
12501251 + (myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))) * hmdOffset);
@@ -1252,7 +1253,7 @@ void Application::paintGL() { · 1 unmodified line
12521253 _myCamera.setRotation(myAvatar->getWorldAlignedOrientation()
12531254 * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
12541255 _myCamera.setPosition(myAvatar->getDefaultEyePosition()
1255− + glm::vec3(0, _raiseMirror * myAvatar->getScale(), 0)
1256+ + glm::vec3(0, _raiseMirror * myAvatar->getAvatarScale(), 0)
12561257 + (myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) *
12571258 glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror);
12581259 }
@@ -2513,7 +2514,6 @@ void Application::init() { · 1254 unmodified lines
25132514 qCDebug(interfaceapp) << "Loaded settings";
25142515
25152516 Leapmotion::init();
2516− RealSense::init();
25172517
25182518 // fire off an immediate domain-server check in now that settings are loaded
25192519 DependencyManager::get<NodeList>()->sendDomainServerCheckIn();
@@ -2549,11 +2549,12 @@ void Application::init() { · 29 unmodified lines
25492549 setAvatarUpdateThreading();
25502550 }
25512551
2552+const bool ENABLE_AVATAR_UPDATE_THREADING = false;
25522553 void Application::setAvatarUpdateThreading() {
2553− setAvatarUpdateThreading(Menu::getInstance()->isOptionChecked(MenuOption::EnableAvatarUpdateThreading));
2554+ setAvatarUpdateThreading(ENABLE_AVATAR_UPDATE_THREADING);
25542555 }
25552556 void Application::setRawAvatarUpdateThreading() {
2556− setRawAvatarUpdateThreading(Menu::getInstance()->isOptionChecked(MenuOption::EnableAvatarUpdateThreading));
2557+ setRawAvatarUpdateThreading(ENABLE_AVATAR_UPDATE_THREADING);
25572558 }
25582559 void Application::setRawAvatarUpdateThreading(bool isThreaded) {
25592560 if (_avatarUpdate) {
@@ -2570,18 +2571,11 @@ void Application::setAvatarUpdateThreading(bool isThreaded) { · 10 unmodified lines
25702571 return;
25712572 }
25722573
2573− auto myAvatar = getMyAvatar();
2574− bool isRigEnabled = myAvatar->getEnableRigAnimations();
2575− bool isGraphEnabled = myAvatar->getEnableAnimGraph();
25762574 if (_avatarUpdate) {
25772575 _avatarUpdate->terminate(); // Must be before we shutdown anim graph.
25782576 }
2579− myAvatar->setEnableRigAnimations(false);
2580− myAvatar->setEnableAnimGraph(false);
25812577 _avatarUpdate = new AvatarUpdate();
25822578 _avatarUpdate->initialize(isThreaded);
2583− myAvatar->setEnableRigAnimations(isRigEnabled);
2584− myAvatar->setEnableAnimGraph(isGraphEnabled);
25852579 }
25862580
25872581 void Application::updateLOD() {
@@ -2855,6 +2849,8 @@ void Application::update(float deltaTime) { · 267 unmodified lines
28552849 }
28562850 }
28572851
2852+ _controllerScriptingInterface->updateInputControllers();
2853+
28582854 // Transfer the user inputs to the driveKeys
28592855 // FIXME can we drop drive keys and just have the avatar read the action states directly?
28602856 myAvatar->clearDriveKeys();
@@ -2964,11 +2960,6 @@ void Application::update(float deltaTime) { · 103 unmodified lines
29642960 loadViewFrustum(_myCamera, _viewFrustum);
29652961 }
29662962
2967− // Update animation debug draw renderer
2968− {
2969− AnimDebugDraw::getInstance().update();
2970− }
2971−
29722963 quint64 now = usecTimestampNow();
29732964
29742965 // Update my voxel servers with my current voxel query...
@@ -3077,9 +3068,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 102 unmodified lines
30773068
30783069 // These will be the same for all servers, so we can set them up once and then reuse for each server we send to.
30793070 _octreeQuery.setWantLowResMoving(true);
3080− _octreeQuery.setWantColor(true);
30813071 _octreeQuery.setWantDelta(true);
3082− _octreeQuery.setWantOcclusionCulling(false);
30833072 _octreeQuery.setWantCompression(true);
30843073
30853074 _octreeQuery.setCameraPosition(_viewFrustum.getPosition());
@@ -3325,7 +3314,7 @@ MyAvatar* Application::getMyAvatar() const { · 239 unmodified lines
33253314 return DependencyManager::get<AvatarManager>()->getMyAvatar();
33263315 }
33273316
3328−const glm::vec3& Application::getAvatarPosition() const {
3317+glm::vec3 Application::getAvatarPosition() const {
33293318 return getMyAvatar()->getPosition();
33303319 }
33313320
@@ -3528,6 +3517,8 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 196 unmodified lines
35283517 myAvatar->preRender(renderArgs);
35293518 myAvatar->endRender();
35303519
3520+ // Update animation debug draw renderer
3521+ AnimDebugDraw::getInstance().update();
35313522
35323523 activeRenderingThread = QThread::currentThread();
35333524 PROFILE_RANGE(__FUNCTION__);
@@ -4067,10 +4058,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 533 unmodified lines
40674058 scriptEngine->registerGlobalObject("Scene", DependencyManager::get<SceneScriptingInterface>().data());
40684059
40694060 scriptEngine->registerGlobalObject("ScriptDiscoveryService", this->getRunningScriptsWidget());
4070−
4071−#ifdef HAVE_RTMIDI
4072− scriptEngine->registerGlobalObject("MIDI", &MIDIManager::getInstance());
4073−#endif
40744061 }
40754062
40764063 bool Application::canAcceptURL(const QString& urlString) {
@@ -4356,10 +4343,6 @@ void Application::stopAllScripts(bool restart) { · 279 unmodified lines
43564343 it.value()->stop();
43574344 qCDebug(interfaceapp) << "stopping script..." << it.key();
43584345 }
4359− // HACK: ATM scripts cannot set/get their animation priorities, so we clear priorities
4360− // whenever a script stops in case it happened to have been setting joint rotations.
4361− // TODO: expose animation priorities and provide a layered animation control system.
4362− getMyAvatar()->clearJointAnimationPriorities();
43634346 getMyAvatar()->clearScriptableSettings();
43644347 }
43654348
@@ -4375,10 +4358,6 @@ bool Application::stopScript(const QString& scriptHash, bool restart) { · 9 unmodified lines
43754358 scriptEngine->stop();
43764359 stoppedScript = true;
43774360 qCDebug(interfaceapp) << "stopping script..." << scriptHash;
4378− // HACK: ATM scripts cannot set/get their animation priorities, so we clear priorities
4379− // whenever a script stops in case it happened to have been setting joint rotations.
4380− // TODO: expose animation priorities and provide a layered animation control system.
4381− getMyAvatar()->clearJointAnimationPriorities();
43824361 }
43834362 if (_scriptEnginesHash.empty()) {
43844363 getMyAvatar()->clearScriptableSettings();