Showing the changes to interface/src/Application.cpp (1 of 158 files). Show all
Unified · Split
| @@ -167,6 +167,7 @@ · 166 unmodified lines | ||
| 167 | 167 | #include "scripting/ControllerScriptingInterface.h" |
| 168 | 168 | #include "scripting/RatesScriptingInterface.h" |
| 169 | 169 | #include "scripting/SelectionScriptingInterface.h" |
| 170 | +#include "scripting/WalletScriptingInterface.h" | |
| 170 | 171 | #if defined(Q_OS_MAC) || defined(Q_OS_WIN) |
| 171 | 172 | #include "SpeechRecognizer.h" |
| 172 | 173 | #endif |
| @@ -198,6 +199,8 @@ · 25 unmodified lines | ||
| 198 | 199 | #include <raypick/RayPickScriptingInterface.h> |
| 199 | 200 | #include <raypick/LaserPointerScriptingInterface.h> |
| 200 | 201 | |
| 202 | +#include <FadeEffect.h> | |
| 203 | + | |
| 201 | 204 | #include "commerce/Ledger.h" |
| 202 | 205 | #include "commerce/Wallet.h" |
| 203 | 206 | #include "commerce/QmlCommerce.h" |
| @@ -287,6 +290,10 @@ static QTimer locationUpdateTimer; · 83 unmodified lines | ||
| 287 | 290 | static QTimer identityPacketTimer; |
| 288 | 291 | static QTimer pingTimer; |
| 289 | 292 | |
| 293 | +static const QString DISABLE_WATCHDOG_FLAG("HIFI_DISABLE_WATCHDOG"); | |
| 294 | +static bool DISABLE_WATCHDOG = QProcessEnvironment::systemEnvironment().contains(DISABLE_WATCHDOG_FLAG); | |
| 295 | + | |
| 296 | + | |
| 290 | 297 | static const int MAX_CONCURRENT_RESOURCE_DOWNLOADS = 16; |
| 291 | 298 | |
| 292 | 299 | // For processing on QThreadPool, we target a number of threads after reserving some |
| @@ -681,6 +688,9 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 388 unmodified lines | ||
| 681 | 688 | DependencyManager::set<ContextOverlayInterface>(); |
| 682 | 689 | DependencyManager::set<Ledger>(); |
| 683 | 690 | DependencyManager::set<Wallet>(); |
| 691 | + DependencyManager::set<WalletScriptingInterface>(); | |
| 692 | + | |
| 693 | + DependencyManager::set<FadeEffect>(); | |
| 684 | 694 | |
| 685 | 695 | DependencyManager::set<LaserPointerScriptingInterface>(); |
| 686 | 696 | DependencyManager::set<RayPickScriptingInterface>(); |
| @@ -801,8 +811,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 114 unmodified lines | ||
| 801 | 811 | nodeList->startThread(); |
| 802 | 812 | |
| 803 | 813 | // Set up a watchdog thread to intentionally crash the application on deadlocks |
| 804 | − _deadlockWatchdogThread = new DeadlockWatchdogThread(); | |
| 805 | − _deadlockWatchdogThread->start(); | |
| 814 | + if (!DISABLE_WATCHDOG) { | |
| 815 | + (new DeadlockWatchdogThread())->start(); | |
| 816 | + } | |
| 806 | 817 | |
| 807 | 818 | if (steamClient) { |
| 808 | 819 | qCDebug(interfaceapp) << "[VERSION] SteamVR buildID:" << steamClient->getSteamVRBuildID(); |
| @@ -1536,15 +1547,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 727 unmodified lines | ||
| 1536 | 1547 | |
| 1537 | 1548 | auto displayPlugin = qApp->getActiveDisplayPlugin(); |
| 1538 | 1549 | |
| 1539 | − properties["fps"] = _frameCounter.rate(); | |
| 1540 | − properties["target_frame_rate"] = getTargetFrameRate(); | |
| 1541 | − properties["render_rate"] = displayPlugin->renderRate(); | |
| 1550 | + properties["render_rate"] = _renderLoopCounter.rate(); | |
| 1551 | + properties["target_render_rate"] = getTargetRenderFrameRate(); | |
| 1542 | 1552 | properties["present_rate"] = displayPlugin->presentRate(); |
| 1543 | 1553 | properties["new_frame_present_rate"] = displayPlugin->newFramePresentRate(); |
| 1544 | 1554 | properties["dropped_frame_rate"] = displayPlugin->droppedFrameRate(); |
| 1545 | 1555 | properties["stutter_rate"] = displayPlugin->stutterRate(); |
| 1546 | − properties["sim_rate"] = getAverageSimsPerSecond(); | |
| 1547 | − properties["avatar_sim_rate"] = getAvatarSimrate(); | |
| 1556 | + properties["game_rate"] = getGameLoopRate(); | |
| 1548 | 1557 | properties["has_async_reprojection"] = displayPlugin->hasAsyncReprojection(); |
| 1549 | 1558 | properties["hardware_stats"] = displayPlugin->getHardwareStats(); |
| 1550 | 1559 | |
| @@ -1929,7 +1938,7 @@ void Application::showCursor(const Cursor::Icon& cursor) { · 378 unmodified lines | ||
| 1929 | 1938 | } |
| 1930 | 1939 | |
| 1931 | 1940 | void Application::updateHeartbeat() const { |
| 1932 | − static_cast<DeadlockWatchdogThread*>(_deadlockWatchdogThread)->updateHeartbeat(); | |
| 1941 | + DeadlockWatchdogThread::updateHeartbeat(); | |
| 1933 | 1942 | } |
| 1934 | 1943 | |
| 1935 | 1944 | void Application::onAboutToQuit() { |
| @@ -2324,6 +2333,7 @@ void Application::initializeUi() { · 388 unmodified lines | ||
| 2324 | 2333 | surfaceContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance()); |
| 2325 | 2334 | surfaceContext->setContextProperty("Selection", DependencyManager::get<SelectionScriptingInterface>().data()); |
| 2326 | 2335 | surfaceContext->setContextProperty("ContextOverlay", DependencyManager::get<ContextOverlayInterface>().data()); |
| 2336 | + surfaceContext->setContextProperty("Wallet", DependencyManager::get<WalletScriptingInterface>().data()); | |
| 2327 | 2337 | |
| 2328 | 2338 | if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) { |
| 2329 | 2339 | surfaceContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get())); |
| @@ -2379,11 +2389,11 @@ void Application::paintGL() { · 49 unmodified lines | ||
| 2379 | 2389 | return; |
| 2380 | 2390 | } |
| 2381 | 2391 | |
| 2382 | − _frameCount++; | |
| 2392 | + _renderFrameCount++; | |
| 2383 | 2393 | _lastTimeRendered.start(); |
| 2384 | 2394 | |
| 2385 | 2395 | auto lastPaintBegin = usecTimestampNow(); |
| 2386 | − PROFILE_RANGE_EX(render, __FUNCTION__, 0xff0000ff, (uint64_t)_frameCount); | |
| 2396 | + PROFILE_RANGE_EX(render, __FUNCTION__, 0xff0000ff, (uint64_t)_renderFrameCount); | |
| 2387 | 2397 | PerformanceTimer perfTimer("paintGL"); |
| 2388 | 2398 | |
| 2389 | 2399 | if (nullptr == _displayPlugin) { |
| @@ -2400,7 +2410,7 @@ void Application::paintGL() { · 10 unmodified lines | ||
| 2400 | 2410 | PROFILE_RANGE(render, "/pluginBeginFrameRender"); |
| 2401 | 2411 | // If a display plugin loses it's underlying support, it |
| 2402 | 2412 | // needs to be able to signal us to not use it |
| 2403 | − if (!displayPlugin->beginFrameRender(_frameCount)) { | |
| 2413 | + if (!displayPlugin->beginFrameRender(_renderFrameCount)) { | |
| 2404 | 2414 | updateDisplayMode(); |
| 2405 | 2415 | return; |
| 2406 | 2416 | } |
| @@ -2555,14 +2565,14 @@ void Application::paintGL() { · 148 unmodified lines | ||
| 2555 | 2565 | } |
| 2556 | 2566 | // Update camera position |
| 2557 | 2567 | if (!isHMDMode()) { |
| 2558 | − _myCamera.update(1.0f / _frameCounter.rate()); | |
| 2568 | + _myCamera.update(); | |
| 2559 | 2569 | } |
| 2560 | 2570 | } |
| 2561 | 2571 | } |
| 2562 | 2572 | |
| 2563 | 2573 | { |
| 2564 | 2574 | PROFILE_RANGE(render, "/updateCompositor"); |
| 2565 | − getApplicationCompositor().setFrameInfo(_frameCount, _myCamera.getTransform(), getMyAvatar()->getSensorToWorldMatrix()); | |
| 2575 | + getApplicationCompositor().setFrameInfo(_renderFrameCount, _myCamera.getTransform(), getMyAvatar()->getSensorToWorldMatrix()); | |
| 2566 | 2576 | } |
| 2567 | 2577 | |
| 2568 | 2578 | gpu::FramebufferPointer finalFramebuffer; |
| @@ -2635,7 +2645,7 @@ void Application::paintGL() { · 66 unmodified lines | ||
| 2635 | 2645 | } |
| 2636 | 2646 | |
| 2637 | 2647 | auto frame = _gpuContext->endFrame(); |
| 2638 | − frame->frameIndex = _frameCount; | |
| 2648 | + frame->frameIndex = _renderFrameCount; | |
| 2639 | 2649 | frame->framebuffer = finalFramebuffer; |
| 2640 | 2650 | frame->framebufferRecycler = [](const gpu::FramebufferPointer& framebuffer){ |
| 2641 | 2651 | DependencyManager::get<FramebufferCache>()->releaseFramebuffer(framebuffer); |
| @@ -2644,7 +2654,7 @@ void Application::paintGL() { · 2 unmodified lines | ||
| 2644 | 2654 | { |
| 2645 | 2655 | PROFILE_RANGE(render, "/pluginOutput"); |
| 2646 | 2656 | PerformanceTimer perfTimer("pluginOutput"); |
| 2647 | − _frameCounter.increment(); | |
| 2657 | + _renderLoopCounter.increment(); | |
| 2648 | 2658 | displayPlugin->submitFrame(frame); |
| 2649 | 2659 | } |
| 2650 | 2660 | |
| @@ -4022,7 +4032,7 @@ void Application::idle() { · 1371 unmodified lines | ||
| 4022 | 4032 | if (displayPlugin) { |
| 4023 | 4033 | PROFILE_COUNTER_IF_CHANGED(app, "present", float, displayPlugin->presentRate()); |
| 4024 | 4034 | } |
| 4025 | − PROFILE_COUNTER_IF_CHANGED(app, "fps", float, _frameCounter.rate()); | |
| 4035 | + PROFILE_COUNTER_IF_CHANGED(app, "renderLoopRate", float, _renderLoopCounter.rate()); | |
| 4026 | 4036 | PROFILE_COUNTER_IF_CHANGED(app, "currentDownloads", int, ResourceCache::getLoadingRequests().length()); |
| 4027 | 4037 | PROFILE_COUNTER_IF_CHANGED(app, "pendingDownloads", int, ResourceCache::getPendingRequestCount()); |
| 4028 | 4038 | PROFILE_COUNTER_IF_CHANGED(app, "currentProcessing", int, DependencyManager::get<StatTracker>()->getStat("Processing").toInt()); |
| @@ -4058,8 +4068,6 @@ void Application::idle() { · 29 unmodified lines | ||
| 4058 | 4068 | |
| 4059 | 4069 | Stats::getInstance()->updateStats(); |
| 4060 | 4070 | |
| 4061 | − _simCounter.increment(); | |
| 4062 | − | |
| 4063 | 4071 | // Normally we check PipelineWarnings, but since idle will often take more than 10ms we only show these idle timing |
| 4064 | 4072 | // details if we're in ExtraDebugging mode. However, the ::update() and its subcomponents will show their timing |
| 4065 | 4073 | // details normally. |
| @@ -4139,6 +4147,7 @@ void Application::idle() { · 73 unmodified lines | ||
| 4139 | 4147 | Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, !(myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN)); |
| 4140 | 4148 | cameraMenuChanged(); |
| 4141 | 4149 | } |
| 4150 | + _gameLoopCounter.increment(); | |
| 4142 | 4151 | } |
| 4143 | 4152 | |
| 4144 | 4153 | ivec2 Application::getMouse() const { |
| @@ -4682,12 +4691,8 @@ void Application::resetPhysicsReadyInformation() { · 537 unmodified lines | ||
| 4682 | 4691 | |
| 4683 | 4692 | void Application::reloadResourceCaches() { |
| 4684 | 4693 | resetPhysicsReadyInformation(); |
| 4685 | − { | |
| 4686 | − QMutexLocker viewLocker(&_viewMutex); | |
| 4687 | − _viewFrustum.setPosition(glm::vec3(0.0f, 0.0f, TREE_SCALE)); | |
| 4688 | − _viewFrustum.setOrientation(glm::quat()); | |
| 4689 | − } | |
| 4690 | − // Clear entities out of view frustum | |
| 4694 | + // Query the octree to refresh everything in view | |
| 4695 | + _lastQueriedTime = 0; | |
| 4691 | 4696 | queryOctree(NodeType::EntityServer, PacketType::EntityQuery, _entityServerJurisdictions); |
| 4692 | 4697 | |
| 4693 | 4698 | DependencyManager::get<AssetClient>()->clearCache(); |
| @@ -4829,12 +4834,7 @@ static bool domainLoadingInProgress = false; · 135 unmodified lines | ||
| 4829 | 4834 | |
| 4830 | 4835 | void Application::update(float deltaTime) { |
| 4831 | 4836 | |
| 4832 | − PROFILE_RANGE_EX(app, __FUNCTION__, 0xffff0000, (uint64_t)_frameCount + 1); | |
| 4833 | − | |
| 4834 | − bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 4835 | − PerformanceWarning warn(showWarnings, "Application::update()"); | |
| 4836 | − | |
| 4837 | − updateLOD(deltaTime); | |
| 4837 | + PROFILE_RANGE_EX(app, __FUNCTION__, 0xffff0000, (uint64_t)_renderFrameCount + 1); | |
| 4838 | 4838 | |
| 4839 | 4839 | if (!_physicsEnabled) { |
| 4840 | 4840 | if (!domainLoadingInProgress) { |
| @@ -4845,13 +4845,9 @@ void Application::update(float deltaTime) { · 4 unmodified lines | ||
| 4845 | 4845 | // we haven't yet enabled physics. we wait until we think we have all the collision information |
| 4846 | 4846 | // for nearby entities before starting bullet up. |
| 4847 | 4847 | quint64 now = usecTimestampNow(); |
| 4848 | − bool timeout = false; | |
| 4849 | 4848 | const int PHYSICS_CHECK_TIMEOUT = 2 * USECS_PER_SECOND; |
| 4850 | − if (_lastPhysicsCheckTime > 0 && now - _lastPhysicsCheckTime > PHYSICS_CHECK_TIMEOUT) { | |
| 4851 | − timeout = true; | |
| 4852 | − } | |
| 4853 | 4849 | |
| 4854 | − if (timeout || _fullSceneReceivedCounter > _fullSceneCounterAtLastPhysicsCheck) { | |
| 4850 | + if (now - _lastPhysicsCheckTime > PHYSICS_CHECK_TIMEOUT || _fullSceneReceivedCounter > _fullSceneCounterAtLastPhysicsCheck) { | |
| 4855 | 4851 | // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway |
| 4856 | 4852 | _lastPhysicsCheckTime = now; |
| 4857 | 4853 | _fullSceneCounterAtLastPhysicsCheck = _fullSceneReceivedCounter; |
| @@ -4869,6 +4865,7 @@ void Application::update(float deltaTime) { · 11 unmodified lines | ||
| 4869 | 4865 | PROFILE_ASYNC_END(app, "Scene Loading", ""); |
| 4870 | 4866 | } |
| 4871 | 4867 | |
| 4868 | + auto myAvatar = getMyAvatar(); | |
| 4872 | 4869 | { |
| 4873 | 4870 | PerformanceTimer perfTimer("devices"); |
| 4874 | 4871 | |
| @@ -4902,129 +4899,127 @@ void Application::update(float deltaTime) { · 27 unmodified lines | ||
| 4902 | 4899 | _lastFaceTrackerUpdate = 0; |
| 4903 | 4900 | } |
| 4904 | 4901 | |
| 4905 | − } | |
| 4906 | − | |
| 4907 | − auto myAvatar = getMyAvatar(); | |
| 4908 | − auto userInputMapper = DependencyManager::get<UserInputMapper>(); | |
| 4909 | − | |
| 4910 | − controller::InputCalibrationData calibrationData = { | |
| 4911 | − myAvatar->getSensorToWorldMatrix(), | |
| 4912 | − createMatFromQuatAndPos(myAvatar->getOrientation(), myAvatar->getPosition()), | |
| 4913 | − myAvatar->getHMDSensorMatrix(), | |
| 4914 | − myAvatar->getCenterEyeCalibrationMat(), | |
| 4915 | − myAvatar->getHeadCalibrationMat(), | |
| 4916 | − myAvatar->getSpine2CalibrationMat(), | |
| 4917 | − myAvatar->getHipsCalibrationMat(), | |
| 4918 | − myAvatar->getLeftFootCalibrationMat(), | |
| 4919 | − myAvatar->getRightFootCalibrationMat(), | |
| 4920 | − myAvatar->getRightArmCalibrationMat(), | |
| 4921 | − myAvatar->getLeftArmCalibrationMat(), | |
| 4922 | − myAvatar->getRightHandCalibrationMat(), | |
| 4923 | − myAvatar->getLeftHandCalibrationMat() | |
| 4924 | − }; | |
| 4902 | + auto userInputMapper = DependencyManager::get<UserInputMapper>(); | |
| 4903 | + | |
| 4904 | + controller::InputCalibrationData calibrationData = { | |
| 4905 | + myAvatar->getSensorToWorldMatrix(), | |
| 4906 | + createMatFromQuatAndPos(myAvatar->getOrientation(), myAvatar->getPosition()), | |
| 4907 | + myAvatar->getHMDSensorMatrix(), | |
| 4908 | + myAvatar->getCenterEyeCalibrationMat(), | |
| 4909 | + myAvatar->getHeadCalibrationMat(), | |
| 4910 | + myAvatar->getSpine2CalibrationMat(), | |
| 4911 | + myAvatar->getHipsCalibrationMat(), | |
| 4912 | + myAvatar->getLeftFootCalibrationMat(), | |
| 4913 | + myAvatar->getRightFootCalibrationMat(), | |
| 4914 | + myAvatar->getRightArmCalibrationMat(), | |
| 4915 | + myAvatar->getLeftArmCalibrationMat(), | |
| 4916 | + myAvatar->getRightHandCalibrationMat(), | |
| 4917 | + myAvatar->getLeftHandCalibrationMat() | |
| 4918 | + }; | |
| 4925 | 4919 | |
| 4926 | − InputPluginPointer keyboardMousePlugin; | |
| 4927 | − for (auto inputPlugin : PluginManager::getInstance()->getInputPlugins()) { | |
| 4928 | − if (inputPlugin->getName() == KeyboardMouseDevice::NAME) { | |
| 4929 | − keyboardMousePlugin = inputPlugin; | |
| 4930 | − } else if (inputPlugin->isActive()) { | |
| 4931 | − inputPlugin->pluginUpdate(deltaTime, calibrationData); | |
| 4920 | + InputPluginPointer keyboardMousePlugin; | |
| 4921 | + for (auto inputPlugin : PluginManager::getInstance()->getInputPlugins()) { | |
| 4922 | + if (inputPlugin->getName() == KeyboardMouseDevice::NAME) { | |
| 4923 | + keyboardMousePlugin = inputPlugin; | |
| 4924 | + } else if (inputPlugin->isActive()) { | |
| 4925 | + inputPlugin->pluginUpdate(deltaTime, calibrationData); | |
| 4926 | + } | |
| 4932 | 4927 | } |
| 4933 | − } | |
| 4934 | 4928 | |
| 4935 | − userInputMapper->setInputCalibrationData(calibrationData); | |
| 4936 | − userInputMapper->update(deltaTime); | |
| 4929 | + userInputMapper->setInputCalibrationData(calibrationData); | |
| 4930 | + userInputMapper->update(deltaTime); | |
| 4937 | 4931 | |
| 4938 | − if (keyboardMousePlugin && keyboardMousePlugin->isActive()) { | |
| 4939 | − keyboardMousePlugin->pluginUpdate(deltaTime, calibrationData); | |
| 4940 | − } | |
| 4932 | + if (keyboardMousePlugin && keyboardMousePlugin->isActive()) { | |
| 4933 | + keyboardMousePlugin->pluginUpdate(deltaTime, calibrationData); | |
| 4934 | + } | |
| 4941 | 4935 | |
| 4942 | − // Transfer the user inputs to the driveKeys | |
| 4943 | − // FIXME can we drop drive keys and just have the avatar read the action states directly? | |
| 4944 | − myAvatar->clearDriveKeys(); | |
| 4945 | − if (_myCamera.getMode() != CAMERA_MODE_INDEPENDENT) { | |
| 4946 | − if (!_controllerScriptingInterface->areActionsCaptured()) { | |
| 4947 | − myAvatar->setDriveKey(MyAvatar::TRANSLATE_Z, -1.0f * userInputMapper->getActionState(controller::Action::TRANSLATE_Z)); | |
| 4948 | − myAvatar->setDriveKey(MyAvatar::TRANSLATE_Y, userInputMapper->getActionState(controller::Action::TRANSLATE_Y)); | |
| 4949 | − myAvatar->setDriveKey(MyAvatar::TRANSLATE_X, userInputMapper->getActionState(controller::Action::TRANSLATE_X)); | |
| 4950 | − if (deltaTime > FLT_EPSILON) { | |
| 4951 | − myAvatar->setDriveKey(MyAvatar::PITCH, -1.0f * userInputMapper->getActionState(controller::Action::PITCH)); | |
| 4952 | − myAvatar->setDriveKey(MyAvatar::YAW, -1.0f * userInputMapper->getActionState(controller::Action::YAW)); | |
| 4953 | − myAvatar->setDriveKey(MyAvatar::STEP_YAW, -1.0f * userInputMapper->getActionState(controller::Action::STEP_YAW)); | |
| 4936 | + // Transfer the user inputs to the driveKeys | |
| 4937 | + // FIXME can we drop drive keys and just have the avatar read the action states directly? | |
| 4938 | + myAvatar->clearDriveKeys(); | |
| 4939 | + if (_myCamera.getMode() != CAMERA_MODE_INDEPENDENT) { | |
| 4940 | + if (!_controllerScriptingInterface->areActionsCaptured()) { | |
| 4941 | + myAvatar->setDriveKey(MyAvatar::TRANSLATE_Z, -1.0f * userInputMapper->getActionState(controller::Action::TRANSLATE_Z)); | |
| 4942 | + myAvatar->setDriveKey(MyAvatar::TRANSLATE_Y, userInputMapper->getActionState(controller::Action::TRANSLATE_Y)); | |
| 4943 | + myAvatar->setDriveKey(MyAvatar::TRANSLATE_X, userInputMapper->getActionState(controller::Action::TRANSLATE_X)); | |
| 4944 | + if (deltaTime > FLT_EPSILON) { | |
| 4945 | + myAvatar->setDriveKey(MyAvatar::PITCH, -1.0f * userInputMapper->getActionState(controller::Action::PITCH)); | |
| 4946 | + myAvatar->setDriveKey(MyAvatar::YAW, -1.0f * userInputMapper->getActionState(controller::Action::YAW)); | |
| 4947 | + myAvatar->setDriveKey(MyAvatar::STEP_YAW, -1.0f * userInputMapper->getActionState(controller::Action::STEP_YAW)); | |
| 4948 | + } | |
| 4954 | 4949 | } |
| 4955 | − } | |
| 4956 | − myAvatar->setDriveKey(MyAvatar::ZOOM, userInputMapper->getActionState(controller::Action::TRANSLATE_CAMERA_Z)); | |
| 4957 | − } | |
| 4958 | − | |
| 4959 | − static const std::vector<controller::Action> avatarControllerActions = { | |
| 4960 | − controller::Action::LEFT_HAND, | |
| 4961 | − controller::Action::RIGHT_HAND, | |
| 4962 | − controller::Action::LEFT_FOOT, | |
| 4963 | − controller::Action::RIGHT_FOOT, | |
| 4964 | − controller::Action::HIPS, | |
| 4965 | − controller::Action::SPINE2, | |
| 4966 | − controller::Action::HEAD, | |
| 4967 | − controller::Action::LEFT_HAND_THUMB1, | |
| 4968 | − controller::Action::LEFT_HAND_THUMB2, | |
| 4969 | − controller::Action::LEFT_HAND_THUMB3, | |
| 4970 | − controller::Action::LEFT_HAND_THUMB4, | |
| 4971 | − controller::Action::LEFT_HAND_INDEX1, | |
| 4972 | − controller::Action::LEFT_HAND_INDEX2, | |
| 4973 | − controller::Action::LEFT_HAND_INDEX3, | |
| 4974 | − controller::Action::LEFT_HAND_INDEX4, | |
| 4975 | − controller::Action::LEFT_HAND_MIDDLE1, | |
| 4976 | − controller::Action::LEFT_HAND_MIDDLE2, | |
| 4977 | − controller::Action::LEFT_HAND_MIDDLE3, | |
| 4978 | − controller::Action::LEFT_HAND_MIDDLE4, | |
| 4979 | − controller::Action::LEFT_HAND_RING1, | |
| 4980 | − controller::Action::LEFT_HAND_RING2, | |
| 4981 | − controller::Action::LEFT_HAND_RING3, | |
| 4982 | − controller::Action::LEFT_HAND_RING4, | |
| 4983 | − controller::Action::LEFT_HAND_PINKY1, | |
| 4984 | − controller::Action::LEFT_HAND_PINKY2, | |
| 4985 | − controller::Action::LEFT_HAND_PINKY3, | |
| 4986 | − controller::Action::LEFT_HAND_PINKY4, | |
| 4987 | − controller::Action::RIGHT_HAND_THUMB1, | |
| 4988 | − controller::Action::RIGHT_HAND_THUMB2, | |
| 4989 | − controller::Action::RIGHT_HAND_THUMB3, | |
| 4990 | − controller::Action::RIGHT_HAND_THUMB4, | |
| 4991 | − controller::Action::RIGHT_HAND_INDEX1, | |
| 4992 | − controller::Action::RIGHT_HAND_INDEX2, | |
| 4993 | − controller::Action::RIGHT_HAND_INDEX3, | |
| 4994 | − controller::Action::RIGHT_HAND_INDEX4, | |
| 4995 | − controller::Action::RIGHT_HAND_MIDDLE1, | |
| 4996 | − controller::Action::RIGHT_HAND_MIDDLE2, | |
| 4997 | − controller::Action::RIGHT_HAND_MIDDLE3, | |
| 4998 | − controller::Action::RIGHT_HAND_MIDDLE4, | |
| 4999 | − controller::Action::RIGHT_HAND_RING1, | |
| 5000 | − controller::Action::RIGHT_HAND_RING2, | |
| 5001 | − controller::Action::RIGHT_HAND_RING3, | |
| 5002 | − controller::Action::RIGHT_HAND_RING4, | |
| 5003 | − controller::Action::RIGHT_HAND_PINKY1, | |
| 5004 | − controller::Action::RIGHT_HAND_PINKY2, | |
| 5005 | − controller::Action::RIGHT_HAND_PINKY3, | |
| 5006 | − controller::Action::RIGHT_HAND_PINKY4, | |
| 5007 | − controller::Action::LEFT_ARM, | |
| 5008 | − controller::Action::RIGHT_ARM, | |
| 5009 | − controller::Action::LEFT_SHOULDER, | |
| 5010 | − controller::Action::RIGHT_SHOULDER, | |
| 5011 | − controller::Action::LEFT_FORE_ARM, | |
| 5012 | − controller::Action::RIGHT_FORE_ARM, | |
| 5013 | − controller::Action::LEFT_LEG, | |
| 5014 | − controller::Action::RIGHT_LEG, | |
| 5015 | − controller::Action::LEFT_UP_LEG, | |
| 5016 | − controller::Action::RIGHT_UP_LEG, | |
| 5017 | − controller::Action::LEFT_TOE_BASE, | |
| 5018 | − controller::Action::RIGHT_TOE_BASE | |
| 5019 | − }; | |
| 4950 | + myAvatar->setDriveKey(MyAvatar::ZOOM, userInputMapper->getActionState(controller::Action::TRANSLATE_CAMERA_Z)); | |
| 4951 | + } | |
| 4952 | + | |
| 4953 | + static const std::vector<controller::Action> avatarControllerActions = { | |
| 4954 | + controller::Action::LEFT_HAND, | |
| 4955 | + controller::Action::RIGHT_HAND, | |
| 4956 | + controller::Action::LEFT_FOOT, | |
| 4957 | + controller::Action::RIGHT_FOOT, | |
| 4958 | + controller::Action::HIPS, | |
| 4959 | + controller::Action::SPINE2, | |
| 4960 | + controller::Action::HEAD, | |
| 4961 | + controller::Action::LEFT_HAND_THUMB1, | |
| 4962 | + controller::Action::LEFT_HAND_THUMB2, | |
| 4963 | + controller::Action::LEFT_HAND_THUMB3, | |
| 4964 | + controller::Action::LEFT_HAND_THUMB4, | |
| 4965 | + controller::Action::LEFT_HAND_INDEX1, | |
| 4966 | + controller::Action::LEFT_HAND_INDEX2, | |
| 4967 | + controller::Action::LEFT_HAND_INDEX3, | |
| 4968 | + controller::Action::LEFT_HAND_INDEX4, | |
| 4969 | + controller::Action::LEFT_HAND_MIDDLE1, | |
| 4970 | + controller::Action::LEFT_HAND_MIDDLE2, | |
| 4971 | + controller::Action::LEFT_HAND_MIDDLE3, | |
| 4972 | + controller::Action::LEFT_HAND_MIDDLE4, | |
| 4973 | + controller::Action::LEFT_HAND_RING1, | |
| 4974 | + controller::Action::LEFT_HAND_RING2, | |
| 4975 | + controller::Action::LEFT_HAND_RING3, | |
| 4976 | + controller::Action::LEFT_HAND_RING4, | |
| 4977 | + controller::Action::LEFT_HAND_PINKY1, | |
| 4978 | + controller::Action::LEFT_HAND_PINKY2, | |
| 4979 | + controller::Action::LEFT_HAND_PINKY3, | |
| 4980 | + controller::Action::LEFT_HAND_PINKY4, | |
| 4981 | + controller::Action::RIGHT_HAND_THUMB1, | |
| 4982 | + controller::Action::RIGHT_HAND_THUMB2, | |
| 4983 | + controller::Action::RIGHT_HAND_THUMB3, | |
| 4984 | + controller::Action::RIGHT_HAND_THUMB4, | |
| 4985 | + controller::Action::RIGHT_HAND_INDEX1, | |
| 4986 | + controller::Action::RIGHT_HAND_INDEX2, | |
| 4987 | + controller::Action::RIGHT_HAND_INDEX3, | |
| 4988 | + controller::Action::RIGHT_HAND_INDEX4, | |
| 4989 | + controller::Action::RIGHT_HAND_MIDDLE1, | |
| 4990 | + controller::Action::RIGHT_HAND_MIDDLE2, | |
| 4991 | + controller::Action::RIGHT_HAND_MIDDLE3, | |
| 4992 | + controller::Action::RIGHT_HAND_MIDDLE4, | |
| 4993 | + controller::Action::RIGHT_HAND_RING1, | |
| 4994 | + controller::Action::RIGHT_HAND_RING2, | |
| 4995 | + controller::Action::RIGHT_HAND_RING3, | |
| 4996 | + controller::Action::RIGHT_HAND_RING4, | |
| 4997 | + controller::Action::RIGHT_HAND_PINKY1, | |
| 4998 | + controller::Action::RIGHT_HAND_PINKY2, | |
| 4999 | + controller::Action::RIGHT_HAND_PINKY3, | |
| 5000 | + controller::Action::RIGHT_HAND_PINKY4, | |
| 5001 | + controller::Action::LEFT_ARM, | |
| 5002 | + controller::Action::RIGHT_ARM, | |
| 5003 | + controller::Action::LEFT_SHOULDER, | |
| 5004 | + controller::Action::RIGHT_SHOULDER, | |
| 5005 | + controller::Action::LEFT_FORE_ARM, | |
| 5006 | + controller::Action::RIGHT_FORE_ARM, | |
| 5007 | + controller::Action::LEFT_LEG, | |
| 5008 | + controller::Action::RIGHT_LEG, | |
| 5009 | + controller::Action::LEFT_UP_LEG, | |
| 5010 | + controller::Action::RIGHT_UP_LEG, | |
| 5011 | + controller::Action::LEFT_TOE_BASE, | |
| 5012 | + controller::Action::RIGHT_TOE_BASE | |
| 5013 | + }; | |
| 5020 | 5014 | |
| 5021 | − // copy controller poses from userInputMapper to myAvatar. | |
| 5022 | − glm::mat4 myAvatarMatrix = createMatFromQuatAndPos(myAvatar->getOrientation(), myAvatar->getPosition()); | |
| 5023 | − glm::mat4 worldToSensorMatrix = glm::inverse(myAvatar->getSensorToWorldMatrix()); | |
| 5024 | − glm::mat4 avatarToSensorMatrix = worldToSensorMatrix * myAvatarMatrix; | |
| 5025 | − for (auto& action : avatarControllerActions) { | |
| 5026 | − controller::Pose pose = userInputMapper->getPoseState(action); | |
| 5027 | − myAvatar->setControllerPoseInSensorFrame(action, pose.transform(avatarToSensorMatrix)); | |
| 5015 | + // copy controller poses from userInputMapper to myAvatar. | |
| 5016 | + glm::mat4 myAvatarMatrix = createMatFromQuatAndPos(myAvatar->getOrientation(), myAvatar->getPosition()); | |
| 5017 | + glm::mat4 worldToSensorMatrix = glm::inverse(myAvatar->getSensorToWorldMatrix()); | |
| 5018 | + glm::mat4 avatarToSensorMatrix = worldToSensorMatrix * myAvatarMatrix; | |
| 5019 | + for (auto& action : avatarControllerActions) { | |
| 5020 | + controller::Pose pose = userInputMapper->getPoseState(action); | |
| 5021 | + myAvatar->setControllerPoseInSensorFrame(action, pose.transform(avatarToSensorMatrix)); | |
| 5022 | + } | |
| 5028 | 5023 | } |
| 5029 | 5024 | |
| 5030 | 5025 | updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process... |
| @@ -5032,117 +5027,123 @@ void Application::update(float deltaTime) { · 1 unmodified line | ||
| 5032 | 5027 | |
| 5033 | 5028 | QSharedPointer<AvatarManager> avatarManager = DependencyManager::get<AvatarManager>(); |
| 5034 | 5029 | |
| 5035 | − if (_physicsEnabled) { | |
| 5030 | + { | |
| 5036 | 5031 | PROFILE_RANGE_EX(simulation_physics, "Physics", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount()); |
| 5037 | − | |
| 5038 | 5032 | PerformanceTimer perfTimer("physics"); |
| 5033 | + if (_physicsEnabled) { | |
| 5034 | + { | |
| 5035 | + PROFILE_RANGE_EX(simulation_physics, "UpdateStates", 0xffffff00, (uint64_t)getActiveDisplayPlugin()->presentCount()); | |
| 5039 | 5036 | |
| 5040 | − { | |
| 5041 | − PROFILE_RANGE_EX(simulation_physics, "UpdateStates", 0xffffff00, (uint64_t)getActiveDisplayPlugin()->presentCount()); | |
| 5042 | − | |
| 5043 | − PerformanceTimer perfTimer("updateStates)"); | |
| 5044 | − static VectorOfMotionStates motionStates; | |
| 5045 | − _entitySimulation->getObjectsToRemoveFromPhysics(motionStates); | |
| 5046 | − _physicsEngine->removeObjects(motionStates); | |
| 5047 | − _entitySimulation->deleteObjectsRemovedFromPhysics(); | |
| 5037 | + PerformanceTimer perfTimer("updateStates)"); | |
| 5038 | + static VectorOfMotionStates motionStates; | |
| 5039 | + _entitySimulation->getObjectsToRemoveFromPhysics(motionStates); | |
| 5040 | + _physicsEngine->removeObjects(motionStates); | |
| 5041 | + _entitySimulation->deleteObjectsRemovedFromPhysics(); | |
| 5048 | 5042 | |
| 5049 | − getEntities()->getTree()->withReadLock([&] { | |
| 5050 | − _entitySimulation->getObjectsToAddToPhysics(motionStates); | |
| 5051 | − _physicsEngine->addObjects(motionStates); | |
| 5043 | + getEntities()->getTree()->withReadLock([&] { | |
| 5044 | + _entitySimulation->getObjectsToAddToPhysics(motionStates); | |
| 5045 | + _physicsEngine->addObjects(motionStates); | |
| 5052 | 5046 | |
| 5053 | − }); | |
| 5054 | − getEntities()->getTree()->withReadLock([&] { | |
| 5055 | − _entitySimulation->getObjectsToChange(motionStates); | |
| 5056 | − VectorOfMotionStates stillNeedChange = _physicsEngine->changeObjects(motionStates); | |
| 5057 | − _entitySimulation->setObjectsToChange(stillNeedChange); | |
| 5058 | − }); | |
| 5059 | − | |
| 5060 | − _entitySimulation->applyDynamicChanges(); | |
| 5047 | + }); | |
| 5048 | + getEntities()->getTree()->withReadLock([&] { | |
| 5049 | + _entitySimulation->getObjectsToChange(motionStates); | |
| 5050 | + VectorOfMotionStates stillNeedChange = _physicsEngine->changeObjects(motionStates); | |
| 5051 | + _entitySimulation->setObjectsToChange(stillNeedChange); | |
| 5052 | + }); | |
| 5061 | 5053 | |
| 5062 | − avatarManager->getObjectsToRemoveFromPhysics(motionStates); | |
| 5063 | − _physicsEngine->removeObjects(motionStates); | |
| 5064 | − avatarManager->getObjectsToAddToPhysics(motionStates); | |
| 5065 | − _physicsEngine->addObjects(motionStates); | |
| 5066 | − avatarManager->getObjectsToChange(motionStates); | |
| 5067 | − _physicsEngine->changeObjects(motionStates); | |
| 5054 | + _entitySimulation->applyDynamicChanges(); | |
| 5068 | 5055 | |
| 5069 | − myAvatar->prepareForPhysicsSimulation(); | |
| 5070 | − _physicsEngine->forEachDynamic([&](EntityDynamicPointer dynamic) { | |
| 5071 | − dynamic->prepareForPhysicsSimulation(); | |
| 5072 | − }); | |
| 5073 | − } | |
| 5074 | − { | |
| 5075 | − PROFILE_RANGE_EX(simulation_physics, "StepSimulation", 0xffff8000, (uint64_t)getActiveDisplayPlugin()->presentCount()); | |
| 5076 | − PerformanceTimer perfTimer("stepSimulation"); | |
| 5077 | − getEntities()->getTree()->withWriteLock([&] { | |
| 5078 | − _physicsEngine->stepSimulation(); | |
| 5079 | − }); | |
| 5080 | − } | |
| 5081 | − { | |
| 5082 | − PROFILE_RANGE_EX(simulation_physics, "HarvestChanges", 0xffffff00, (uint64_t)getActiveDisplayPlugin()->presentCount()); | |
| 5083 | − PerformanceTimer perfTimer("harvestChanges"); | |
| 5084 | − if (_physicsEngine->hasOutgoingChanges()) { | |
| 5085 | − // grab the collision events BEFORE handleOutgoingChanges() because at this point | |
| 5086 | − // we have a better idea of which objects we own or should own. | |
| 5087 | − auto& collisionEvents = _physicsEngine->getCollisionEvents(); | |
| 5056 | + avatarManager->getObjectsToRemoveFromPhysics(motionStates); | |
| 5057 | + _physicsEngine->removeObjects(motionStates); | |
| 5058 | + avatarManager->getObjectsToAddToPhysics(motionStates); | |
| 5059 | + _physicsEngine->addObjects(motionStates); | |
| 5060 | + avatarManager->getObjectsToChange(motionStates); | |
| 5061 | + _physicsEngine->changeObjects(motionStates); | |
| 5088 | 5062 | |
| 5063 | + myAvatar->prepareForPhysicsSimulation(); | |
| 5064 | + _physicsEngine->forEachDynamic([&](EntityDynamicPointer dynamic) { | |
| 5065 | + dynamic->prepareForPhysicsSimulation(); | |
| 5066 | + }); | |
| 5067 | + } | |
| 5068 | + { | |
| 5069 | + PROFILE_RANGE_EX(simulation_physics, "StepSimulation", 0xffff8000, (uint64_t)getActiveDisplayPlugin()->presentCount()); | |
| 5070 | + PerformanceTimer perfTimer("stepSimulation"); | |
| 5089 | 5071 | getEntities()->getTree()->withWriteLock([&] { |
| 5090 | − PerformanceTimer perfTimer("handleOutgoingChanges"); | |
| 5091 | − | |
| 5092 | − const VectorOfMotionStates& outgoingChanges = _physicsEngine->getChangedMotionStates(); | |
| 5093 | − _entitySimulation->handleChangedMotionStates(outgoingChanges); | |
| 5094 | − avatarManager->handleChangedMotionStates(outgoingChanges); | |
| 5095 | − | |
| 5096 | − const VectorOfMotionStates& deactivations = _physicsEngine->getDeactivatedMotionStates(); | |
| 5097 | − _entitySimulation->handleDeactivatedMotionStates(deactivations); | |
| 5072 | + _physicsEngine->stepSimulation(); | |
| 5098 | 5073 | }); |
| 5074 | + } | |
| 5075 | + { | |
| 5076 | + PROFILE_RANGE_EX(simulation_physics, "HarvestChanges", 0xffffff00, (uint64_t)getActiveDisplayPlugin()->presentCount()); | |
| 5077 | + PerformanceTimer perfTimer("harvestChanges"); | |
| 5078 | + if (_physicsEngine->hasOutgoingChanges()) { | |
| 5079 | + // grab the collision events BEFORE handleOutgoingChanges() because at this point | |
| 5080 | + // we have a better idea of which objects we own or should own. | |
| 5081 | + auto& collisionEvents = _physicsEngine->getCollisionEvents(); | |
| 5082 | + | |
| 5083 | + getEntities()->getTree()->withWriteLock([&] { | |
| 5084 | + PerformanceTimer perfTimer("handleOutgoingChanges"); | |
| 5085 | + | |
| 5086 | + const VectorOfMotionStates& outgoingChanges = _physicsEngine->getChangedMotionStates(); | |
| 5087 | + _entitySimulation->handleChangedMotionStates(outgoingChanges); | |
| 5088 | + avatarManager->handleChangedMotionStates(outgoingChanges); | |
| 5089 | + | |
| 5090 | + const VectorOfMotionStates& deactivations = _physicsEngine->getDeactivatedMotionStates(); | |
| 5091 | + _entitySimulation->handleDeactivatedMotionStates(deactivations); | |
| 5092 | + }); | |
| 5093 | + | |
| 5094 | + if (!_aboutToQuit) { | |
| 5095 | + // handleCollisionEvents() AFTER handleOutgoinChanges() | |
| 5096 | + PerformanceTimer perfTimer("entities"); | |
| 5097 | + avatarManager->handleCollisionEvents(collisionEvents); | |
| 5098 | + // Collision events (and their scripts) must not be handled when we're locked, above. (That would risk | |
| 5099 | + // deadlock.) | |
| 5100 | + _entitySimulation->handleCollisionEvents(collisionEvents); | |
| 5101 | + | |
| 5102 | + // NOTE: the getEntities()->update() call below will wait for lock | |
| 5103 | + // and will simulate entity motion (the EntityTree has been given an EntitySimulation). | |
| 5104 | + getEntities()->update(true); // update the models... | |
| 5105 | + } | |
| 5099 | 5106 | |
| 5100 | − if (!_aboutToQuit) { | |
| 5101 | − // handleCollisionEvents() AFTER handleOutgoinChanges() | |
| 5102 | − PerformanceTimer perfTimer("entities"); | |
| 5103 | − avatarManager->handleCollisionEvents(collisionEvents); | |
| 5104 | − // Collision events (and their scripts) must not be handled when we're locked, above. (That would risk | |
| 5105 | − // deadlock.) | |
| 5106 | − _entitySimulation->handleCollisionEvents(collisionEvents); | |
| 5107 | − | |
| 5108 | − // NOTE: the getEntities()->update() call below will wait for lock | |
| 5109 | − // and will simulate entity motion (the EntityTree has been given an EntitySimulation). | |
| 5110 | − getEntities()->update(true); // update the models... | |
| 5111 | − } | |
| 5112 | − | |
| 5113 | − myAvatar->harvestResultsFromPhysicsSimulation(deltaTime); | |
| 5107 | + myAvatar->harvestResultsFromPhysicsSimulation(deltaTime); | |
| 5114 | 5108 | |
| 5115 | − if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails) && | |
| 5116 | − Menu::getInstance()->isOptionChecked(MenuOption::ExpandPhysicsSimulationTiming)) { | |
| 5117 | − _physicsEngine->harvestPerformanceStats(); | |
| 5109 | + if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails) && | |
| 5110 | + Menu::getInstance()->isOptionChecked(MenuOption::ExpandPhysicsSimulationTiming)) { | |
| 5111 | + _physicsEngine->harvestPerformanceStats(); | |
| 5112 | + } | |
| 5113 | + // NOTE: the PhysicsEngine stats are written to stdout NOT to Qt log framework | |
| 5114 | + _physicsEngine->dumpStatsIfNecessary(); | |
| 5118 | 5115 | } |
| 5119 | − // NOTE: the PhysicsEngine stats are written to stdout NOT to Qt log framework | |
| 5120 | − _physicsEngine->dumpStatsIfNecessary(); | |
| 5121 | 5116 | } |
| 5117 | + } else { | |
| 5118 | + // update the rendering without any simulation | |
| 5119 | + getEntities()->update(false); | |
| 5122 | 5120 | } |
| 5123 | − } else { | |
| 5124 | − // update the rendering without any simulation | |
| 5125 | − getEntities()->update(false); | |
| 5126 | 5121 | } |
| 5127 | 5122 | |
| 5128 | 5123 | // AvatarManager update |
| 5129 | 5124 | { |
| 5130 | − PerformanceTimer perfTimer("AvatarManager"); | |
| 5131 | − _avatarSimCounter.increment(); | |
| 5132 | − | |
| 5133 | 5125 | { |
| 5126 | + PerformanceTimer perfTimer("otherAvatars"); | |
| 5134 | 5127 | PROFILE_RANGE_EX(simulation, "OtherAvatars", 0xffff00ff, (uint64_t)getActiveDisplayPlugin()->presentCount()); |
| 5135 | 5128 | avatarManager->updateOtherAvatars(deltaTime); |
| 5136 | 5129 | } |
| 5137 | 5130 | |
| 5138 | − qApp->updateMyAvatarLookAtPosition(); | |
| 5139 | − | |
| 5140 | 5131 | { |
| 5141 | 5132 | PROFILE_RANGE_EX(simulation, "MyAvatar", 0xffff00ff, (uint64_t)getActiveDisplayPlugin()->presentCount()); |
| 5133 | + PerformanceTimer perfTimer("MyAvatar"); | |
| 5134 | + qApp->updateMyAvatarLookAtPosition(); | |
| 5142 | 5135 | avatarManager->updateMyAvatar(deltaTime); |
| 5143 | 5136 | } |
| 5144 | 5137 | } |
| 5145 | 5138 | |
| 5139 | + PerformanceTimer perfTimer("misc"); | |
| 5140 | + | |
| 5141 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 5142 | + PerformanceWarning warn(showWarnings, "Application::update()"); | |
| 5143 | + | |
| 5144 | + updateLOD(deltaTime); | |
| 5145 | + | |
| 5146 | + // TODO: break these out into distinct perfTimers when they prove interesting | |
| 5146 | 5147 | { |
| 5147 | 5148 | PROFILE_RANGE(app, "RayPickManager"); |
| 5148 | 5149 | _rayPickManager.update(); |
| @@ -5289,7 +5290,7 @@ int Application::sendNackPackets() { · 140 unmodified lines | ||
| 5289 | 5290 | return packetsSent; |
| 5290 | 5291 | } |
| 5291 | 5292 | |
| 5292 | −void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions, bool forceResend) { | |
| 5293 | +void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) { | |
| 5293 | 5294 | |
| 5294 | 5295 | if (!_settingsLoaded) { |
| 5295 | 5296 | return; // bail early if settings are not loaded |
| @@ -5445,16 +5446,6 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 149 unmodified lines | ||
| 5445 | 5446 | _octreeQuery.setMaxQueryPacketsPerSecond(0); |
| 5446 | 5447 | } |
| 5447 | 5448 | |
| 5448 | − // if asked to forceResend, then set the query's position/orientation to be degenerate in a manner | |
| 5449 | − // that will cause our next query to be guarenteed to be different and the server will resend to us | |
| 5450 | − if (forceResend) { | |
| 5451 | − _octreeQuery.setCameraPosition(glm::vec3(-0.1, -0.1, -0.1)); | |
| 5452 | − const glm::quat OFF_IN_NEGATIVE_SPACE = glm::quat(-0.5, 0, -0.5, 1.0); | |
| 5453 | − _octreeQuery.setCameraOrientation(OFF_IN_NEGATIVE_SPACE); | |
| 5454 | − _octreeQuery.setCameraNearClip(0.1f); | |
| 5455 | − _octreeQuery.setCameraFarClip(0.1f); | |
| 5456 | − } | |
| 5457 | − | |
| 5458 | 5449 | // encode the query data |
| 5459 | 5450 | int packetSize = _octreeQuery.getBroadcastData(reinterpret_cast<unsigned char*>(queryPacket->getPayload())); |
| 5460 | 5451 | queryPacket->setPayloadSize(packetSize); |
| @@ -5470,7 +5461,7 @@ bool Application::isHMDMode() const { · 9 unmodified lines | ||
| 5470 | 5461 | return getActiveDisplayPlugin()->isHmd(); |
| 5471 | 5462 | } |
| 5472 | 5463 | |
| 5473 | −float Application::getTargetFrameRate() const { return getActiveDisplayPlugin()->getTargetFrameRate(); } | |
| 5464 | +float Application::getTargetRenderFrameRate() const { return getActiveDisplayPlugin()->getTargetFrameRate(); } | |
| 5474 | 5465 | |
| 5475 | 5466 | QRect Application::getDesirableApplicationGeometry() const { |
| 5476 | 5467 | QRect applicationGeometry = getWindow()->geometry(); |
| @@ -5703,8 +5694,6 @@ void Application::clearDomainOctreeDetails() { · 226 unmodified lines | ||
| 5703 | 5694 | |
| 5704 | 5695 | skyStage->setBackgroundMode(model::SunSkyStage::SKY_DEFAULT); |
| 5705 | 5696 | |
| 5706 | − _recentlyClearedDomain = true; | |
| 5707 | − | |
| 5708 | 5697 | DependencyManager::get<AnimationCache>()->clearUnusedResources(); |
| 5709 | 5698 | DependencyManager::get<ModelCache>()->clearUnusedResources(); |
| 5710 | 5699 | DependencyManager::get<SoundCache>()->clearUnusedResources(); |
| @@ -5751,14 +5740,10 @@ void Application::nodeActivated(SharedNodePointer node) { · 40 unmodified lines | ||
| 5751 | 5740 | } |
| 5752 | 5741 | } |
| 5753 | 5742 | |
| 5754 | − // If we get a new EntityServer activated, do a "forceRedraw" query. This will send a degenerate | |
| 5755 | − // query so that the server will think our next non-degenerate query is "different enough" to send | |
| 5756 | − // us a full scene | |
| 5757 | − if (_recentlyClearedDomain && node->getType() == NodeType::EntityServer) { | |
| 5758 | − _recentlyClearedDomain = false; | |
| 5759 | − if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) { | |
| 5760 | − queryOctree(NodeType::EntityServer, PacketType::EntityQuery, _entityServerJurisdictions, true); | |
| 5761 | − } | |
| 5743 | + // If we get a new EntityServer activated, reset lastQueried time | |
| 5744 | + // so we will do a proper query during update | |
| 5745 | + if (node->getType() == NodeType::EntityServer) { | |
| 5746 | + _lastQueriedTime = 0; | |
| 5762 | 5747 | } |
| 5763 | 5748 | |
| 5764 | 5749 | if (node->getType() == NodeType::AudioMixer) { |
| @@ -6066,6 +6051,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 301 unmodified lines | ||
| 6066 | 6051 | scriptEngine->registerGlobalObject("AvatarInputs", AvatarInputs::getInstance()); |
| 6067 | 6052 | scriptEngine->registerGlobalObject("Selection", DependencyManager::get<SelectionScriptingInterface>().data()); |
| 6068 | 6053 | scriptEngine->registerGlobalObject("ContextOverlay", DependencyManager::get<ContextOverlayInterface>().data()); |
| 6054 | + scriptEngine->registerGlobalObject("Wallet", DependencyManager::get<WalletScriptingInterface>().data()); | |
| 6069 | 6055 | |
| 6070 | 6056 | qScriptRegisterMetaType(scriptEngine.data(), OverlayIDtoScriptValue, OverlayIDfromScriptValue); |
| 6071 | 6057 | |
| @@ -6389,7 +6375,7 @@ void Application::showAssetServerWidget(QString filePath) { · 317 unmodified lines | ||
| 6389 | 6375 | if (!DependencyManager::get<NodeList>()->getThisNodeCanWriteAssets()) { |
| 6390 | 6376 | return; |
| 6391 | 6377 | } |
| 6392 | − static const QUrl url { "AssetServer.qml" }; | |
| 6378 | + static const QUrl url { "hifi/AssetServer.qml" }; | |
| 6393 | 6379 | |
| 6394 | 6380 | auto startUpload = [=](QQmlContext* context, QObject* newObject){ |
| 6395 | 6381 | if (!filePath.isEmpty()) { |