Showing the changes to interface/src/Application.cpp (1 of 320 files). Show all
Unified · Split
| @@ -50,6 +50,7 @@ · 49 unmodified lines | ||
| 50 | 50 | #include <AssetClient.h> |
| 51 | 51 | #include <AssetUpload.h> |
| 52 | 52 | #include <AutoUpdater.h> |
| 53 | +#include <AudioInjectorManager.h> | |
| 53 | 54 | #include <CursorManager.h> |
| 54 | 55 | #include <DeferredLightingEffect.h> |
| 55 | 56 | #include <display-plugins/DisplayPlugin.h> |
| @@ -77,7 +78,7 @@ · 21 unmodified lines | ||
| 77 | 78 | #include <ObjectMotionState.h> |
| 78 | 79 | #include <OctalCode.h> |
| 79 | 80 | #include <OctreeSceneStats.h> |
| 80 | −#include <gl/OffscreenGlCanvas.h> | |
| 81 | +#include <gl/OffscreenGLCanvas.h> | |
| 81 | 82 | #include <PathUtils.h> |
| 82 | 83 | #include <PerfStat.h> |
| 83 | 84 | #include <PhysicsEngine.h> |
| @@ -109,8 +110,6 @@ · 25 unmodified lines | ||
| 109 | 110 | #include "devices/EyeTracker.h" |
| 110 | 111 | #include "devices/Faceshift.h" |
| 111 | 112 | #include "devices/Leapmotion.h" |
| 112 | −#include "devices/MIDIManager.h" | |
| 113 | −#include "devices/RealSense.h" | |
| 114 | 113 | #include "DiscoverabilityManager.h" |
| 115 | 114 | #include "GLCanvas.h" |
| 116 | 115 | #include "InterfaceActionFactory.h" |
| @@ -148,6 +147,8 @@ · 31 unmodified lines | ||
| 148 | 147 | #include "ui/Stats.h" |
| 149 | 148 | #include "ui/UpdateDialog.h" |
| 150 | 149 | #include "Util.h" |
| 150 | +#include "InterfaceParentFinder.h" | |
| 151 | + | |
| 151 | 152 | |
| 152 | 153 | |
| 153 | 154 | // 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 | ||
| 296 | 297 | DependencyManager::registerInheritance<LimitedNodeList, NodeList>(); |
| 297 | 298 | DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>(); |
| 298 | 299 | DependencyManager::registerInheritance<EntityActionFactoryInterface, InterfaceActionFactory>(); |
| 300 | + DependencyManager::registerInheritance<SpatialParentFinder, InterfaceParentFinder>(); | |
| 299 | 301 | |
| 300 | 302 | Setting::init(); |
| 301 | 303 | |
| @@ -340,9 +342,11 @@ bool setupEssentials(int& argc, char** argv) { · 38 unmodified lines | ||
| 340 | 342 | DependencyManager::set<PathUtils>(); |
| 341 | 343 | DependencyManager::set<InterfaceActionFactory>(); |
| 342 | 344 | DependencyManager::set<AssetClient>(); |
| 345 | + DependencyManager::set<AudioInjectorManager>(); | |
| 343 | 346 | DependencyManager::set<MessagesClient>(); |
| 344 | 347 | DependencyManager::set<UserInputMapper>(); |
| 345 | 348 | DependencyManager::set<controller::ScriptingInterface, ControllerScriptingInterface>(); |
| 349 | + DependencyManager::set<InterfaceParentFinder>(); | |
| 346 | 350 | return true; |
| 347 | 351 | } |
| 348 | 352 | |
| @@ -614,7 +618,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 265 unmodified lines | ||
| 614 | 618 | // enable mouse tracking; otherwise, we only get drag events |
| 615 | 619 | _glWidget->setMouseTracking(true); |
| 616 | 620 | |
| 617 | − _offscreenContext = new OffscreenGlCanvas(); | |
| 621 | + _offscreenContext = new OffscreenGLCanvas(); | |
| 618 | 622 | _offscreenContext->create(_glWidget->context()->contextHandle()); |
| 619 | 623 | _offscreenContext->makeCurrent(); |
| 620 | 624 | initializeGL(); |
| @@ -717,12 +721,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 96 unmodified lines | ||
| 717 | 721 | // set the local loopback interface for local sounds from audio scripts |
| 718 | 722 | AudioScriptingInterface::getInstance().setLocalAudioInterface(audioIO.data()); |
| 719 | 723 | |
| 720 | −#ifdef HAVE_RTMIDI | |
| 721 | − // setup the MIDIManager | |
| 722 | − MIDIManager& midiManagerInstance = MIDIManager::getInstance(); | |
| 723 | − midiManagerInstance.openDefaultPort(); | |
| 724 | −#endif | |
| 725 | − | |
| 726 | 724 | this->installEventFilter(this); |
| 727 | 725 | |
| 728 | 726 | // initialize our face trackers after loading the menu settings |
| @@ -894,6 +892,10 @@ void Application::cleanupBeforeQuit() { · 165 unmodified lines | ||
| 894 | 892 | |
| 895 | 893 | // destroy the AudioClient so it and its thread have a chance to go down safely |
| 896 | 894 | 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>(); | |
| 897 | 899 | |
| 898 | 900 | // Destroy third party processes after scripts have finished using them. |
| 899 | 901 | #ifdef HAVE_DDE |
| @@ -964,7 +966,6 @@ Application::~Application() { · 64 unmodified lines | ||
| 964 | 966 | nodeThread->wait(); |
| 965 | 967 | |
| 966 | 968 | Leapmotion::destroy(); |
| 967 | − RealSense::destroy(); | |
| 968 | 969 | |
| 969 | 970 | #if 0 |
| 970 | 971 | ConnexionClient::getInstance().destroy(); |
| @@ -1244,7 +1245,7 @@ void Application::paintGL() { · 273 unmodified lines | ||
| 1244 | 1245 | * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)) * hmdRotation); |
| 1245 | 1246 | glm::vec3 hmdOffset = extractTranslation(myAvatar->getHMDSensorMatrix()); |
| 1246 | 1247 | _myCamera.setPosition(myAvatar->getDefaultEyePosition() |
| 1247 | − + glm::vec3(0, _raiseMirror * myAvatar->getScale(), 0) | |
| 1248 | + + glm::vec3(0, _raiseMirror * myAvatar->getAvatarScale(), 0) | |
| 1248 | 1249 | + (myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) * |
| 1249 | 1250 | glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror |
| 1250 | 1251 | + (myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))) * hmdOffset); |
| @@ -1252,7 +1253,7 @@ void Application::paintGL() { · 1 unmodified line | ||
| 1252 | 1253 | _myCamera.setRotation(myAvatar->getWorldAlignedOrientation() |
| 1253 | 1254 | * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); |
| 1254 | 1255 | _myCamera.setPosition(myAvatar->getDefaultEyePosition() |
| 1255 | − + glm::vec3(0, _raiseMirror * myAvatar->getScale(), 0) | |
| 1256 | + + glm::vec3(0, _raiseMirror * myAvatar->getAvatarScale(), 0) | |
| 1256 | 1257 | + (myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) * |
| 1257 | 1258 | glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); |
| 1258 | 1259 | } |
| @@ -2513,7 +2514,6 @@ void Application::init() { · 1254 unmodified lines | ||
| 2513 | 2514 | qCDebug(interfaceapp) << "Loaded settings"; |
| 2514 | 2515 | |
| 2515 | 2516 | Leapmotion::init(); |
| 2516 | − RealSense::init(); | |
| 2517 | 2517 | |
| 2518 | 2518 | // fire off an immediate domain-server check in now that settings are loaded |
| 2519 | 2519 | DependencyManager::get<NodeList>()->sendDomainServerCheckIn(); |
| @@ -2549,11 +2549,12 @@ void Application::init() { · 29 unmodified lines | ||
| 2549 | 2549 | setAvatarUpdateThreading(); |
| 2550 | 2550 | } |
| 2551 | 2551 | |
| 2552 | +const bool ENABLE_AVATAR_UPDATE_THREADING = false; | |
| 2552 | 2553 | void Application::setAvatarUpdateThreading() { |
| 2553 | − setAvatarUpdateThreading(Menu::getInstance()->isOptionChecked(MenuOption::EnableAvatarUpdateThreading)); | |
| 2554 | + setAvatarUpdateThreading(ENABLE_AVATAR_UPDATE_THREADING); | |
| 2554 | 2555 | } |
| 2555 | 2556 | void Application::setRawAvatarUpdateThreading() { |
| 2556 | − setRawAvatarUpdateThreading(Menu::getInstance()->isOptionChecked(MenuOption::EnableAvatarUpdateThreading)); | |
| 2557 | + setRawAvatarUpdateThreading(ENABLE_AVATAR_UPDATE_THREADING); | |
| 2557 | 2558 | } |
| 2558 | 2559 | void Application::setRawAvatarUpdateThreading(bool isThreaded) { |
| 2559 | 2560 | if (_avatarUpdate) { |
| @@ -2570,18 +2571,11 @@ void Application::setAvatarUpdateThreading(bool isThreaded) { · 10 unmodified lines | ||
| 2570 | 2571 | return; |
| 2571 | 2572 | } |
| 2572 | 2573 | |
| 2573 | − auto myAvatar = getMyAvatar(); | |
| 2574 | − bool isRigEnabled = myAvatar->getEnableRigAnimations(); | |
| 2575 | − bool isGraphEnabled = myAvatar->getEnableAnimGraph(); | |
| 2576 | 2574 | if (_avatarUpdate) { |
| 2577 | 2575 | _avatarUpdate->terminate(); // Must be before we shutdown anim graph. |
| 2578 | 2576 | } |
| 2579 | − myAvatar->setEnableRigAnimations(false); | |
| 2580 | − myAvatar->setEnableAnimGraph(false); | |
| 2581 | 2577 | _avatarUpdate = new AvatarUpdate(); |
| 2582 | 2578 | _avatarUpdate->initialize(isThreaded); |
| 2583 | − myAvatar->setEnableRigAnimations(isRigEnabled); | |
| 2584 | − myAvatar->setEnableAnimGraph(isGraphEnabled); | |
| 2585 | 2579 | } |
| 2586 | 2580 | |
| 2587 | 2581 | void Application::updateLOD() { |
| @@ -2855,6 +2849,8 @@ void Application::update(float deltaTime) { · 267 unmodified lines | ||
| 2855 | 2849 | } |
| 2856 | 2850 | } |
| 2857 | 2851 | |
| 2852 | + _controllerScriptingInterface->updateInputControllers(); | |
| 2853 | + | |
| 2858 | 2854 | // Transfer the user inputs to the driveKeys |
| 2859 | 2855 | // FIXME can we drop drive keys and just have the avatar read the action states directly? |
| 2860 | 2856 | myAvatar->clearDriveKeys(); |
| @@ -2964,11 +2960,6 @@ void Application::update(float deltaTime) { · 103 unmodified lines | ||
| 2964 | 2960 | loadViewFrustum(_myCamera, _viewFrustum); |
| 2965 | 2961 | } |
| 2966 | 2962 | |
| 2967 | − // Update animation debug draw renderer | |
| 2968 | − { | |
| 2969 | − AnimDebugDraw::getInstance().update(); | |
| 2970 | − } | |
| 2971 | − | |
| 2972 | 2963 | quint64 now = usecTimestampNow(); |
| 2973 | 2964 | |
| 2974 | 2965 | // 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 | ||
| 3077 | 3068 | |
| 3078 | 3069 | // These will be the same for all servers, so we can set them up once and then reuse for each server we send to. |
| 3079 | 3070 | _octreeQuery.setWantLowResMoving(true); |
| 3080 | − _octreeQuery.setWantColor(true); | |
| 3081 | 3071 | _octreeQuery.setWantDelta(true); |
| 3082 | − _octreeQuery.setWantOcclusionCulling(false); | |
| 3083 | 3072 | _octreeQuery.setWantCompression(true); |
| 3084 | 3073 | |
| 3085 | 3074 | _octreeQuery.setCameraPosition(_viewFrustum.getPosition()); |
| @@ -3325,7 +3314,7 @@ MyAvatar* Application::getMyAvatar() const { · 239 unmodified lines | ||
| 3325 | 3314 | return DependencyManager::get<AvatarManager>()->getMyAvatar(); |
| 3326 | 3315 | } |
| 3327 | 3316 | |
| 3328 | −const glm::vec3& Application::getAvatarPosition() const { | |
| 3317 | +glm::vec3 Application::getAvatarPosition() const { | |
| 3329 | 3318 | return getMyAvatar()->getPosition(); |
| 3330 | 3319 | } |
| 3331 | 3320 | |
| @@ -3528,6 +3517,8 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 196 unmodified lines | ||
| 3528 | 3517 | myAvatar->preRender(renderArgs); |
| 3529 | 3518 | myAvatar->endRender(); |
| 3530 | 3519 | |
| 3520 | + // Update animation debug draw renderer | |
| 3521 | + AnimDebugDraw::getInstance().update(); | |
| 3531 | 3522 | |
| 3532 | 3523 | activeRenderingThread = QThread::currentThread(); |
| 3533 | 3524 | PROFILE_RANGE(__FUNCTION__); |
| @@ -4067,10 +4058,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 533 unmodified lines | ||
| 4067 | 4058 | scriptEngine->registerGlobalObject("Scene", DependencyManager::get<SceneScriptingInterface>().data()); |
| 4068 | 4059 | |
| 4069 | 4060 | scriptEngine->registerGlobalObject("ScriptDiscoveryService", this->getRunningScriptsWidget()); |
| 4070 | − | |
| 4071 | −#ifdef HAVE_RTMIDI | |
| 4072 | − scriptEngine->registerGlobalObject("MIDI", &MIDIManager::getInstance()); | |
| 4073 | −#endif | |
| 4074 | 4061 | } |
| 4075 | 4062 | |
| 4076 | 4063 | bool Application::canAcceptURL(const QString& urlString) { |
| @@ -4356,10 +4343,6 @@ void Application::stopAllScripts(bool restart) { · 279 unmodified lines | ||
| 4356 | 4343 | it.value()->stop(); |
| 4357 | 4344 | qCDebug(interfaceapp) << "stopping script..." << it.key(); |
| 4358 | 4345 | } |
| 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(); | |
| 4363 | 4346 | getMyAvatar()->clearScriptableSettings(); |
| 4364 | 4347 | } |
| 4365 | 4348 | |
| @@ -4375,10 +4358,6 @@ bool Application::stopScript(const QString& scriptHash, bool restart) { · 9 unmodified lines | ||
| 4375 | 4358 | scriptEngine->stop(); |
| 4376 | 4359 | stoppedScript = true; |
| 4377 | 4360 | 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(); | |
| 4382 | 4361 | } |
| 4383 | 4362 | if (_scriptEnginesHash.empty()) { |
| 4384 | 4363 | getMyAvatar()->clearScriptableSettings(); |