History

merge from master

SamGondelman committed 9 years ago

Commit fa838e42 parents b59ec07 2dc0804158 files · +8296 −3544Browse files

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

Unified · Split

interface/src/Application.cpp+241−255
@@ -167,6 +167,7 @@ · 166 unmodified lines
167167 #include "scripting/ControllerScriptingInterface.h"
168168 #include "scripting/RatesScriptingInterface.h"
169169 #include "scripting/SelectionScriptingInterface.h"
170+#include "scripting/WalletScriptingInterface.h"
170171 #if defined(Q_OS_MAC) || defined(Q_OS_WIN)
171172 #include "SpeechRecognizer.h"
172173 #endif
@@ -198,6 +199,8 @@ · 25 unmodified lines
198199 #include <raypick/RayPickScriptingInterface.h>
199200 #include <raypick/LaserPointerScriptingInterface.h>
200201
202+#include <FadeEffect.h>
203+
201204 #include "commerce/Ledger.h"
202205 #include "commerce/Wallet.h"
203206 #include "commerce/QmlCommerce.h"
@@ -287,6 +290,10 @@ static QTimer locationUpdateTimer; · 83 unmodified lines
287290 static QTimer identityPacketTimer;
288291 static QTimer pingTimer;
289292
293+static const QString DISABLE_WATCHDOG_FLAG("HIFI_DISABLE_WATCHDOG");
294+static bool DISABLE_WATCHDOG = QProcessEnvironment::systemEnvironment().contains(DISABLE_WATCHDOG_FLAG);
295+
296+
290297 static const int MAX_CONCURRENT_RESOURCE_DOWNLOADS = 16;
291298
292299 // 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
681688 DependencyManager::set<ContextOverlayInterface>();
682689 DependencyManager::set<Ledger>();
683690 DependencyManager::set<Wallet>();
691+ DependencyManager::set<WalletScriptingInterface>();
692+
693+ DependencyManager::set<FadeEffect>();
684694
685695 DependencyManager::set<LaserPointerScriptingInterface>();
686696 DependencyManager::set<RayPickScriptingInterface>();
@@ -801,8 +811,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 114 unmodified lines
801811 nodeList->startThread();
802812
803813 // 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+ }
806817
807818 if (steamClient) {
808819 qCDebug(interfaceapp) << "[VERSION] SteamVR buildID:" << steamClient->getSteamVRBuildID();
@@ -1536,15 +1547,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 727 unmodified lines
15361547
15371548 auto displayPlugin = qApp->getActiveDisplayPlugin();
15381549
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();
15421552 properties["present_rate"] = displayPlugin->presentRate();
15431553 properties["new_frame_present_rate"] = displayPlugin->newFramePresentRate();
15441554 properties["dropped_frame_rate"] = displayPlugin->droppedFrameRate();
15451555 properties["stutter_rate"] = displayPlugin->stutterRate();
1546− properties["sim_rate"] = getAverageSimsPerSecond();
1547− properties["avatar_sim_rate"] = getAvatarSimrate();
1556+ properties["game_rate"] = getGameLoopRate();
15481557 properties["has_async_reprojection"] = displayPlugin->hasAsyncReprojection();
15491558 properties["hardware_stats"] = displayPlugin->getHardwareStats();
15501559
@@ -1929,7 +1938,7 @@ void Application::showCursor(const Cursor::Icon& cursor) { · 378 unmodified lines
19291938 }
19301939
19311940 void Application::updateHeartbeat() const {
1932− static_cast<DeadlockWatchdogThread*>(_deadlockWatchdogThread)->updateHeartbeat();
1941+ DeadlockWatchdogThread::updateHeartbeat();
19331942 }
19341943
19351944 void Application::onAboutToQuit() {
@@ -2324,6 +2333,7 @@ void Application::initializeUi() { · 388 unmodified lines
23242333 surfaceContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
23252334 surfaceContext->setContextProperty("Selection", DependencyManager::get<SelectionScriptingInterface>().data());
23262335 surfaceContext->setContextProperty("ContextOverlay", DependencyManager::get<ContextOverlayInterface>().data());
2336+ surfaceContext->setContextProperty("Wallet", DependencyManager::get<WalletScriptingInterface>().data());
23272337
23282338 if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
23292339 surfaceContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get()));
@@ -2379,11 +2389,11 @@ void Application::paintGL() { · 49 unmodified lines
23792389 return;
23802390 }
23812391
2382− _frameCount++;
2392+ _renderFrameCount++;
23832393 _lastTimeRendered.start();
23842394
23852395 auto lastPaintBegin = usecTimestampNow();
2386− PROFILE_RANGE_EX(render, __FUNCTION__, 0xff0000ff, (uint64_t)_frameCount);
2396+ PROFILE_RANGE_EX(render, __FUNCTION__, 0xff0000ff, (uint64_t)_renderFrameCount);
23872397 PerformanceTimer perfTimer("paintGL");
23882398
23892399 if (nullptr == _displayPlugin) {
@@ -2400,7 +2410,7 @@ void Application::paintGL() { · 10 unmodified lines
24002410 PROFILE_RANGE(render, "/pluginBeginFrameRender");
24012411 // If a display plugin loses it's underlying support, it
24022412 // needs to be able to signal us to not use it
2403− if (!displayPlugin->beginFrameRender(_frameCount)) {
2413+ if (!displayPlugin->beginFrameRender(_renderFrameCount)) {
24042414 updateDisplayMode();
24052415 return;
24062416 }
@@ -2555,14 +2565,14 @@ void Application::paintGL() { · 148 unmodified lines
25552565 }
25562566 // Update camera position
25572567 if (!isHMDMode()) {
2558− _myCamera.update(1.0f / _frameCounter.rate());
2568+ _myCamera.update();
25592569 }
25602570 }
25612571 }
25622572
25632573 {
25642574 PROFILE_RANGE(render, "/updateCompositor");
2565− getApplicationCompositor().setFrameInfo(_frameCount, _myCamera.getTransform(), getMyAvatar()->getSensorToWorldMatrix());
2575+ getApplicationCompositor().setFrameInfo(_renderFrameCount, _myCamera.getTransform(), getMyAvatar()->getSensorToWorldMatrix());
25662576 }
25672577
25682578 gpu::FramebufferPointer finalFramebuffer;
@@ -2635,7 +2645,7 @@ void Application::paintGL() { · 66 unmodified lines
26352645 }
26362646
26372647 auto frame = _gpuContext->endFrame();
2638− frame->frameIndex = _frameCount;
2648+ frame->frameIndex = _renderFrameCount;
26392649 frame->framebuffer = finalFramebuffer;
26402650 frame->framebufferRecycler = [](const gpu::FramebufferPointer& framebuffer){
26412651 DependencyManager::get<FramebufferCache>()->releaseFramebuffer(framebuffer);
@@ -2644,7 +2654,7 @@ void Application::paintGL() { · 2 unmodified lines
26442654 {
26452655 PROFILE_RANGE(render, "/pluginOutput");
26462656 PerformanceTimer perfTimer("pluginOutput");
2647− _frameCounter.increment();
2657+ _renderLoopCounter.increment();
26482658 displayPlugin->submitFrame(frame);
26492659 }
26502660
@@ -4022,7 +4032,7 @@ void Application::idle() { · 1371 unmodified lines
40224032 if (displayPlugin) {
40234033 PROFILE_COUNTER_IF_CHANGED(app, "present", float, displayPlugin->presentRate());
40244034 }
4025− PROFILE_COUNTER_IF_CHANGED(app, "fps", float, _frameCounter.rate());
4035+ PROFILE_COUNTER_IF_CHANGED(app, "renderLoopRate", float, _renderLoopCounter.rate());
40264036 PROFILE_COUNTER_IF_CHANGED(app, "currentDownloads", int, ResourceCache::getLoadingRequests().length());
40274037 PROFILE_COUNTER_IF_CHANGED(app, "pendingDownloads", int, ResourceCache::getPendingRequestCount());
40284038 PROFILE_COUNTER_IF_CHANGED(app, "currentProcessing", int, DependencyManager::get<StatTracker>()->getStat("Processing").toInt());
@@ -4058,8 +4068,6 @@ void Application::idle() { · 29 unmodified lines
40584068
40594069 Stats::getInstance()->updateStats();
40604070
4061− _simCounter.increment();
4062−
40634071 // Normally we check PipelineWarnings, but since idle will often take more than 10ms we only show these idle timing
40644072 // details if we're in ExtraDebugging mode. However, the ::update() and its subcomponents will show their timing
40654073 // details normally.
@@ -4139,6 +4147,7 @@ void Application::idle() { · 73 unmodified lines
41394147 Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, !(myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN));
41404148 cameraMenuChanged();
41414149 }
4150+ _gameLoopCounter.increment();
41424151 }
41434152
41444153 ivec2 Application::getMouse() const {
@@ -4682,12 +4691,8 @@ void Application::resetPhysicsReadyInformation() { · 537 unmodified lines
46824691
46834692 void Application::reloadResourceCaches() {
46844693 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;
46914696 queryOctree(NodeType::EntityServer, PacketType::EntityQuery, _entityServerJurisdictions);
46924697
46934698 DependencyManager::get<AssetClient>()->clearCache();
@@ -4829,12 +4834,7 @@ static bool domainLoadingInProgress = false; · 135 unmodified lines
48294834
48304835 void Application::update(float deltaTime) {
48314836
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);
48384838
48394839 if (!_physicsEnabled) {
48404840 if (!domainLoadingInProgress) {
@@ -4845,13 +4845,9 @@ void Application::update(float deltaTime) { · 4 unmodified lines
48454845 // we haven't yet enabled physics. we wait until we think we have all the collision information
48464846 // for nearby entities before starting bullet up.
48474847 quint64 now = usecTimestampNow();
4848− bool timeout = false;
48494848 const int PHYSICS_CHECK_TIMEOUT = 2 * USECS_PER_SECOND;
4850− if (_lastPhysicsCheckTime > 0 && now - _lastPhysicsCheckTime > PHYSICS_CHECK_TIMEOUT) {
4851− timeout = true;
4852− }
48534849
4854− if (timeout || _fullSceneReceivedCounter > _fullSceneCounterAtLastPhysicsCheck) {
4850+ if (now - _lastPhysicsCheckTime > PHYSICS_CHECK_TIMEOUT || _fullSceneReceivedCounter > _fullSceneCounterAtLastPhysicsCheck) {
48554851 // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway
48564852 _lastPhysicsCheckTime = now;
48574853 _fullSceneCounterAtLastPhysicsCheck = _fullSceneReceivedCounter;
@@ -4869,6 +4865,7 @@ void Application::update(float deltaTime) { · 11 unmodified lines
48694865 PROFILE_ASYNC_END(app, "Scene Loading", "");
48704866 }
48714867
4868+ auto myAvatar = getMyAvatar();
48724869 {
48734870 PerformanceTimer perfTimer("devices");
48744871
@@ -4902,129 +4899,127 @@ void Application::update(float deltaTime) { · 27 unmodified lines
49024899 _lastFaceTrackerUpdate = 0;
49034900 }
49044901
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+ };
49254919
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+ }
49324927 }
4933− }
49344928
4935− userInputMapper->setInputCalibrationData(calibrationData);
4936− userInputMapper->update(deltaTime);
4929+ userInputMapper->setInputCalibrationData(calibrationData);
4930+ userInputMapper->update(deltaTime);
49374931
4938− if (keyboardMousePlugin && keyboardMousePlugin->isActive()) {
4939− keyboardMousePlugin->pluginUpdate(deltaTime, calibrationData);
4940− }
4932+ if (keyboardMousePlugin && keyboardMousePlugin->isActive()) {
4933+ keyboardMousePlugin->pluginUpdate(deltaTime, calibrationData);
4934+ }
49414935
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+ }
49544949 }
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+ };
50205014
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+ }
50285023 }
50295024
50305025 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
50325027
50335028 QSharedPointer<AvatarManager> avatarManager = DependencyManager::get<AvatarManager>();
50345029
5035− if (_physicsEnabled) {
5030+ {
50365031 PROFILE_RANGE_EX(simulation_physics, "Physics", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());
5037−
50385032 PerformanceTimer perfTimer("physics");
5033+ if (_physicsEnabled) {
5034+ {
5035+ PROFILE_RANGE_EX(simulation_physics, "UpdateStates", 0xffffff00, (uint64_t)getActiveDisplayPlugin()->presentCount());
50395036
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();
50485042
5049− getEntities()->getTree()->withReadLock([&] {
5050− _entitySimulation->getObjectsToAddToPhysics(motionStates);
5051− _physicsEngine->addObjects(motionStates);
5043+ getEntities()->getTree()->withReadLock([&] {
5044+ _entitySimulation->getObjectsToAddToPhysics(motionStates);
5045+ _physicsEngine->addObjects(motionStates);
50525046
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+ });
50615053
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();
50685055
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);
50885062
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");
50895071 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();
50985073 });
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+ }
50995106
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);
51145108
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();
51185115 }
5119− // NOTE: the PhysicsEngine stats are written to stdout NOT to Qt log framework
5120− _physicsEngine->dumpStatsIfNecessary();
51215116 }
5117+ } else {
5118+ // update the rendering without any simulation
5119+ getEntities()->update(false);
51225120 }
5123− } else {
5124− // update the rendering without any simulation
5125− getEntities()->update(false);
51265121 }
51275122
51285123 // AvatarManager update
51295124 {
5130− PerformanceTimer perfTimer("AvatarManager");
5131− _avatarSimCounter.increment();
5132−
51335125 {
5126+ PerformanceTimer perfTimer("otherAvatars");
51345127 PROFILE_RANGE_EX(simulation, "OtherAvatars", 0xffff00ff, (uint64_t)getActiveDisplayPlugin()->presentCount());
51355128 avatarManager->updateOtherAvatars(deltaTime);
51365129 }
51375130
5138− qApp->updateMyAvatarLookAtPosition();
5139−
51405131 {
51415132 PROFILE_RANGE_EX(simulation, "MyAvatar", 0xffff00ff, (uint64_t)getActiveDisplayPlugin()->presentCount());
5133+ PerformanceTimer perfTimer("MyAvatar");
5134+ qApp->updateMyAvatarLookAtPosition();
51425135 avatarManager->updateMyAvatar(deltaTime);
51435136 }
51445137 }
51455138
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
51465147 {
51475148 PROFILE_RANGE(app, "RayPickManager");
51485149 _rayPickManager.update();
@@ -5289,7 +5290,7 @@ int Application::sendNackPackets() { · 140 unmodified lines
52895290 return packetsSent;
52905291 }
52915292
5292−void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions, bool forceResend) {
5293+void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) {
52935294
52945295 if (!_settingsLoaded) {
52955296 return; // bail early if settings are not loaded
@@ -5445,16 +5446,6 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 149 unmodified lines
54455446 _octreeQuery.setMaxQueryPacketsPerSecond(0);
54465447 }
54475448
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−
54585449 // encode the query data
54595450 int packetSize = _octreeQuery.getBroadcastData(reinterpret_cast<unsigned char*>(queryPacket->getPayload()));
54605451 queryPacket->setPayloadSize(packetSize);
@@ -5470,7 +5461,7 @@ bool Application::isHMDMode() const { · 9 unmodified lines
54705461 return getActiveDisplayPlugin()->isHmd();
54715462 }
54725463
5473−float Application::getTargetFrameRate() const { return getActiveDisplayPlugin()->getTargetFrameRate(); }
5464+float Application::getTargetRenderFrameRate() const { return getActiveDisplayPlugin()->getTargetFrameRate(); }
54745465
54755466 QRect Application::getDesirableApplicationGeometry() const {
54765467 QRect applicationGeometry = getWindow()->geometry();
@@ -5703,8 +5694,6 @@ void Application::clearDomainOctreeDetails() { · 226 unmodified lines
57035694
57045695 skyStage->setBackgroundMode(model::SunSkyStage::SKY_DEFAULT);
57055696
5706− _recentlyClearedDomain = true;
5707−
57085697 DependencyManager::get<AnimationCache>()->clearUnusedResources();
57095698 DependencyManager::get<ModelCache>()->clearUnusedResources();
57105699 DependencyManager::get<SoundCache>()->clearUnusedResources();
@@ -5751,14 +5740,10 @@ void Application::nodeActivated(SharedNodePointer node) { · 40 unmodified lines
57515740 }
57525741 }
57535742
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;
57625747 }
57635748
57645749 if (node->getType() == NodeType::AudioMixer) {
@@ -6066,6 +6051,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 301 unmodified lines
60666051 scriptEngine->registerGlobalObject("AvatarInputs", AvatarInputs::getInstance());
60676052 scriptEngine->registerGlobalObject("Selection", DependencyManager::get<SelectionScriptingInterface>().data());
60686053 scriptEngine->registerGlobalObject("ContextOverlay", DependencyManager::get<ContextOverlayInterface>().data());
6054+ scriptEngine->registerGlobalObject("Wallet", DependencyManager::get<WalletScriptingInterface>().data());
60696055
60706056 qScriptRegisterMetaType(scriptEngine.data(), OverlayIDtoScriptValue, OverlayIDfromScriptValue);
60716057
@@ -6389,7 +6375,7 @@ void Application::showAssetServerWidget(QString filePath) { · 317 unmodified lines
63896375 if (!DependencyManager::get<NodeList>()->getThisNodeCanWriteAssets()) {
63906376 return;
63916377 }
6392− static const QUrl url { "AssetServer.qml" };
6378+ static const QUrl url { "hifi/AssetServer.qml" };
63936379
63946380 auto startUpload = [=](QQmlContext* context, QObject* newObject){
63956381 if (!filePath.isEmpty()) {

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