Showing the changes to interface/src/Application.cpp (1 of 179 files). Show all
Unified · Split
| @@ -193,6 +193,9 @@ · 192 unmodified lines | ||
| 193 | 193 | #include <src/scripting/LimitlessVoiceRecognitionScriptingInterface.h> |
| 194 | 194 | #include <EntityScriptClient.h> |
| 195 | 195 | #include <ModelScriptingInterface.h> |
| 196 | +#include "commerce/Ledger.h" | |
| 197 | +#include "commerce/Wallet.h" | |
| 198 | +#include "commerce/QmlCommerce.h" | |
| 196 | 199 | |
| 197 | 200 | // On Windows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU |
| 198 | 201 | // FIXME seems to be broken. |
| @@ -602,6 +605,8 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 403 unmodified lines | ||
| 602 | 605 | DependencyManager::set<CloseEventSender>(); |
| 603 | 606 | DependencyManager::set<ResourceManager>(); |
| 604 | 607 | DependencyManager::set<ContextOverlayInterface>(); |
| 608 | + DependencyManager::set<Ledger>(); | |
| 609 | + DependencyManager::set<Wallet>(); | |
| 605 | 610 | |
| 606 | 611 | return previousSessionCrashed; |
| 607 | 612 | } |
| @@ -711,7 +716,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 103 unmodified lines | ||
| 711 | 716 | qInstallMessageHandler(messageHandler); |
| 712 | 717 | |
| 713 | 718 | QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "styles/Inconsolata.otf"); |
| 714 | − _window->setWindowTitle("Interface"); | |
| 719 | + _window->setWindowTitle("High Fidelity Interface"); | |
| 715 | 720 | |
| 716 | 721 | Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us |
| 717 | 722 | |
| @@ -959,6 +964,53 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 241 unmodified lines | ||
| 959 | 964 | // Make sure we don't time out during slow operations at startup |
| 960 | 965 | updateHeartbeat(); |
| 961 | 966 | |
| 967 | + // Now that OpenGL is initialized, we are sure we have a valid context and can create the various pipeline shaders with success. | |
| 968 | + DependencyManager::get<GeometryCache>()->initializeShapePipelines(); | |
| 969 | + | |
| 970 | + // sessionRunTime will be reset soon by loadSettings. Grab it now to get previous session value. | |
| 971 | + // The value will be 0 if the user blew away settings this session, which is both a feature and a bug. | |
| 972 | + static const QString TESTER = "HIFI_TESTER"; | |
| 973 | + auto gpuIdent = GPUIdent::getInstance(); | |
| 974 | + auto glContextData = getGLContextData(); | |
| 975 | + QJsonObject properties = { | |
| 976 | + { "version", applicationVersion() }, | |
| 977 | + { "tester", QProcessEnvironment::systemEnvironment().contains(TESTER) }, | |
| 978 | + { "previousSessionCrashed", _previousSessionCrashed }, | |
| 979 | + { "previousSessionRuntime", sessionRunTime.get() }, | |
| 980 | + { "cpu_architecture", QSysInfo::currentCpuArchitecture() }, | |
| 981 | + { "kernel_type", QSysInfo::kernelType() }, | |
| 982 | + { "kernel_version", QSysInfo::kernelVersion() }, | |
| 983 | + { "os_type", QSysInfo::productType() }, | |
| 984 | + { "os_version", QSysInfo::productVersion() }, | |
| 985 | + { "gpu_name", gpuIdent->getName() }, | |
| 986 | + { "gpu_driver", gpuIdent->getDriver() }, | |
| 987 | + { "gpu_memory", static_cast<qint64>(gpuIdent->getMemory()) }, | |
| 988 | + { "gl_version_int", glVersionToInteger(glContextData.value("version").toString()) }, | |
| 989 | + { "gl_version", glContextData["version"] }, | |
| 990 | + { "gl_vender", glContextData["vendor"] }, | |
| 991 | + { "gl_sl_version", glContextData["sl_version"] }, | |
| 992 | + { "gl_renderer", glContextData["renderer"] }, | |
| 993 | + { "ideal_thread_count", QThread::idealThreadCount() } | |
| 994 | + }; | |
| 995 | + auto macVersion = QSysInfo::macVersion(); | |
| 996 | + if (macVersion != QSysInfo::MV_None) { | |
| 997 | + properties["os_osx_version"] = QSysInfo::macVersion(); | |
| 998 | + } | |
| 999 | + auto windowsVersion = QSysInfo::windowsVersion(); | |
| 1000 | + if (windowsVersion != QSysInfo::WV_None) { | |
| 1001 | + properties["os_win_version"] = QSysInfo::windowsVersion(); | |
| 1002 | + } | |
| 1003 | + | |
| 1004 | + ProcessorInfo procInfo; | |
| 1005 | + if (getProcessorInfo(procInfo)) { | |
| 1006 | + properties["processor_core_count"] = procInfo.numProcessorCores; | |
| 1007 | + properties["logical_processor_count"] = procInfo.numLogicalProcessors; | |
| 1008 | + properties["processor_l1_cache_count"] = procInfo.numProcessorCachesL1; | |
| 1009 | + properties["processor_l2_cache_count"] = procInfo.numProcessorCachesL2; | |
| 1010 | + properties["processor_l3_cache_count"] = procInfo.numProcessorCachesL3; | |
| 1011 | + } | |
| 1012 | + | |
| 1013 | + // add firstRun flag from settings to launch event | |
| 962 | 1014 | Setting::Handle<bool> firstRun { Settings::firstRun, true }; |
| 963 | 1015 | |
| 964 | 1016 | // once the settings have been loaded, check if we need to flip the default for UserActivityLogger |
| @@ -2061,6 +2113,7 @@ void Application::initializeUi() { · 1096 unmodified lines | ||
| 2061 | 2113 | LoginDialog::registerType(); |
| 2062 | 2114 | Tooltip::registerType(); |
| 2063 | 2115 | UpdateDialog::registerType(); |
| 2116 | + QmlCommerce::registerType(); | |
| 2064 | 2117 | qmlRegisterType<ResourceImageItem>("Hifi", 1, 0, "ResourceImageItem"); |
| 2065 | 2118 | qmlRegisterType<Preference>("Hifi", 1, 0, "Preference"); |
| 2066 | 2119 | |
| @@ -4419,10 +4472,9 @@ void Application::updateMyAvatarLookAtPosition() { · 2352 unmodified lines | ||
| 4419 | 4472 | } |
| 4420 | 4473 | } else { |
| 4421 | 4474 | // I am not looking at anyone else, so just look forward |
| 4422 | − auto headPose = myAvatar->getHeadControllerPoseInSensorFrame(); | |
| 4475 | + auto headPose = myAvatar->getControllerPoseInWorldFrame(controller::Action::HEAD); | |
| 4423 | 4476 | if (headPose.isValid()) { |
| 4424 | − glm::mat4 worldHeadMat = myAvatar->getSensorToWorldMatrix() * headPose.getMatrix(); | |
| 4425 | − lookAtSpot = transformPoint(worldHeadMat, glm::vec3(0.0f, 0.0f, TREE_SCALE)); | |
| 4477 | + lookAtSpot = transformPoint(headPose.getMatrix(), glm::vec3(0.0f, 0.0f, TREE_SCALE)); | |
| 4426 | 4478 | } else { |
| 4427 | 4479 | lookAtSpot = myAvatar->getHead()->getEyePosition() + |
| 4428 | 4480 | (myAvatar->getHead()->getFinalOrientationInWorldFrame() * glm::vec3(0.0f, 0.0f, -TREE_SCALE)); |
| @@ -4836,52 +4888,76 @@ void Application::update(float deltaTime) { · 407 unmodified lines | ||
| 4836 | 4888 | myAvatar->setDriveKey(MyAvatar::ZOOM, userInputMapper->getActionState(controller::Action::TRANSLATE_CAMERA_Z)); |
| 4837 | 4889 | } |
| 4838 | 4890 | |
| 4839 | − controller::Pose leftHandPose = userInputMapper->getPoseState(controller::Action::LEFT_HAND); | |
| 4840 | − controller::Pose rightHandPose = userInputMapper->getPoseState(controller::Action::RIGHT_HAND); | |
| 4841 | − auto myAvatarMatrix = createMatFromQuatAndPos(myAvatar->getOrientation(), myAvatar->getPosition()); | |
| 4842 | − auto worldToSensorMatrix = glm::inverse(myAvatar->getSensorToWorldMatrix()); | |
| 4843 | − auto avatarToSensorMatrix = worldToSensorMatrix * myAvatarMatrix; | |
| 4844 | − myAvatar->setHandControllerPosesInSensorFrame(leftHandPose.transform(avatarToSensorMatrix), rightHandPose.transform(avatarToSensorMatrix)); | |
| 4845 | − | |
| 4846 | − // If have previously done finger poses or there are new valid finger poses, update finger pose values. This so that if | |
| 4847 | − // fingers are not being controlled, finger joints are not updated in MySkeletonModel. | |
| 4848 | − // Assumption: Finger poses are either all present and valid or not present at all; thus can test just one joint. | |
| 4849 | − MyAvatar::FingerPosesMap leftHandFingerPoses; | |
| 4850 | − if (myAvatar->getLeftHandFingerControllerPosesInSensorFrame().size() > 0 | |
| 4851 | − || userInputMapper->getPoseState(controller::Action::LEFT_HAND_THUMB1).isValid()) { | |
| 4852 | − for (int i = (int)controller::Action::LEFT_HAND_THUMB1; i <= (int)controller::Action::LEFT_HAND_PINKY4; i++) { | |
| 4853 | − leftHandFingerPoses[i] = { | |
| 4854 | − userInputMapper->getPoseState((controller::Action)i).transform(avatarToSensorMatrix), | |
| 4855 | − userInputMapper->getActionName((controller::Action)i) | |
| 4856 | − }; | |
| 4857 | − } | |
| 4858 | − } | |
| 4859 | − MyAvatar::FingerPosesMap rightHandFingerPoses; | |
| 4860 | − if (myAvatar->getRightHandFingerControllerPosesInSensorFrame().size() > 0 | |
| 4861 | − || userInputMapper->getPoseState(controller::Action::RIGHT_HAND_THUMB1).isValid()) { | |
| 4862 | − for (int i = (int)controller::Action::RIGHT_HAND_THUMB1; i <= (int)controller::Action::RIGHT_HAND_PINKY4; i++) { | |
| 4863 | − rightHandFingerPoses[i] = { | |
| 4864 | − userInputMapper->getPoseState((controller::Action)i).transform(avatarToSensorMatrix), | |
| 4865 | − userInputMapper->getActionName((controller::Action)i) | |
| 4866 | − }; | |
| 4867 | − } | |
| 4868 | − } | |
| 4869 | − myAvatar->setFingerControllerPosesInSensorFrame(leftHandFingerPoses, rightHandFingerPoses); | |
| 4870 | − | |
| 4871 | − controller::Pose leftFootPose = userInputMapper->getPoseState(controller::Action::LEFT_FOOT); | |
| 4872 | − controller::Pose rightFootPose = userInputMapper->getPoseState(controller::Action::RIGHT_FOOT); | |
| 4873 | − myAvatar->setFootControllerPosesInSensorFrame(leftFootPose.transform(avatarToSensorMatrix), rightFootPose.transform(avatarToSensorMatrix)); | |
| 4874 | − | |
| 4875 | − controller::Pose hipsPose = userInputMapper->getPoseState(controller::Action::HIPS); | |
| 4876 | − controller::Pose spine2Pose = userInputMapper->getPoseState(controller::Action::SPINE2); | |
| 4877 | − myAvatar->setSpineControllerPosesInSensorFrame(hipsPose.transform(avatarToSensorMatrix), spine2Pose.transform(avatarToSensorMatrix)); | |
| 4878 | − | |
| 4879 | − controller::Pose headPose = userInputMapper->getPoseState(controller::Action::HEAD); | |
| 4880 | − myAvatar->setHeadControllerPoseInSensorFrame(headPose.transform(avatarToSensorMatrix)); | |
| 4881 | − | |
| 4882 | − controller::Pose leftArmPose = userInputMapper->getPoseState(controller::Action::LEFT_ARM); | |
| 4883 | − controller::Pose rightArmPose = userInputMapper->getPoseState(controller::Action::RIGHT_ARM); | |
| 4884 | − myAvatar->setArmControllerPosesInSensorFrame(leftArmPose.transform(avatarToSensorMatrix), rightArmPose.transform(avatarToSensorMatrix)); | |
| 4891 | + static const std::vector<controller::Action> avatarControllerActions = { | |
| 4892 | + controller::Action::LEFT_HAND, | |
| 4893 | + controller::Action::RIGHT_HAND, | |
| 4894 | + controller::Action::LEFT_FOOT, | |
| 4895 | + controller::Action::RIGHT_FOOT, | |
| 4896 | + controller::Action::HIPS, | |
| 4897 | + controller::Action::SPINE2, | |
| 4898 | + controller::Action::HEAD, | |
| 4899 | + controller::Action::LEFT_HAND_THUMB1, | |
| 4900 | + controller::Action::LEFT_HAND_THUMB2, | |
| 4901 | + controller::Action::LEFT_HAND_THUMB3, | |
| 4902 | + controller::Action::LEFT_HAND_THUMB4, | |
| 4903 | + controller::Action::LEFT_HAND_INDEX1, | |
| 4904 | + controller::Action::LEFT_HAND_INDEX2, | |
| 4905 | + controller::Action::LEFT_HAND_INDEX3, | |
| 4906 | + controller::Action::LEFT_HAND_INDEX4, | |
| 4907 | + controller::Action::LEFT_HAND_MIDDLE1, | |
| 4908 | + controller::Action::LEFT_HAND_MIDDLE2, | |
| 4909 | + controller::Action::LEFT_HAND_MIDDLE3, | |
| 4910 | + controller::Action::LEFT_HAND_MIDDLE4, | |
| 4911 | + controller::Action::LEFT_HAND_RING1, | |
| 4912 | + controller::Action::LEFT_HAND_RING2, | |
| 4913 | + controller::Action::LEFT_HAND_RING3, | |
| 4914 | + controller::Action::LEFT_HAND_RING4, | |
| 4915 | + controller::Action::LEFT_HAND_PINKY1, | |
| 4916 | + controller::Action::LEFT_HAND_PINKY2, | |
| 4917 | + controller::Action::LEFT_HAND_PINKY3, | |
| 4918 | + controller::Action::LEFT_HAND_PINKY4, | |
| 4919 | + controller::Action::RIGHT_HAND_THUMB1, | |
| 4920 | + controller::Action::RIGHT_HAND_THUMB2, | |
| 4921 | + controller::Action::RIGHT_HAND_THUMB3, | |
| 4922 | + controller::Action::RIGHT_HAND_THUMB4, | |
| 4923 | + controller::Action::RIGHT_HAND_INDEX1, | |
| 4924 | + controller::Action::RIGHT_HAND_INDEX2, | |
| 4925 | + controller::Action::RIGHT_HAND_INDEX3, | |
| 4926 | + controller::Action::RIGHT_HAND_INDEX4, | |
| 4927 | + controller::Action::RIGHT_HAND_MIDDLE1, | |
| 4928 | + controller::Action::RIGHT_HAND_MIDDLE2, | |
| 4929 | + controller::Action::RIGHT_HAND_MIDDLE3, | |
| 4930 | + controller::Action::RIGHT_HAND_MIDDLE4, | |
| 4931 | + controller::Action::RIGHT_HAND_RING1, | |
| 4932 | + controller::Action::RIGHT_HAND_RING2, | |
| 4933 | + controller::Action::RIGHT_HAND_RING3, | |
| 4934 | + controller::Action::RIGHT_HAND_RING4, | |
| 4935 | + controller::Action::RIGHT_HAND_PINKY1, | |
| 4936 | + controller::Action::RIGHT_HAND_PINKY2, | |
| 4937 | + controller::Action::RIGHT_HAND_PINKY3, | |
| 4938 | + controller::Action::RIGHT_HAND_PINKY4, | |
| 4939 | + controller::Action::LEFT_ARM, | |
| 4940 | + controller::Action::RIGHT_ARM, | |
| 4941 | + controller::Action::LEFT_SHOULDER, | |
| 4942 | + controller::Action::RIGHT_SHOULDER, | |
| 4943 | + controller::Action::LEFT_FORE_ARM, | |
| 4944 | + controller::Action::RIGHT_FORE_ARM, | |
| 4945 | + controller::Action::LEFT_LEG, | |
| 4946 | + controller::Action::RIGHT_LEG, | |
| 4947 | + controller::Action::LEFT_UP_LEG, | |
| 4948 | + controller::Action::RIGHT_UP_LEG, | |
| 4949 | + controller::Action::LEFT_TOE_BASE, | |
| 4950 | + controller::Action::RIGHT_TOE_BASE | |
| 4951 | + }; | |
| 4952 | + | |
| 4953 | + // copy controller poses from userInputMapper to myAvatar. | |
| 4954 | + glm::mat4 myAvatarMatrix = createMatFromQuatAndPos(myAvatar->getOrientation(), myAvatar->getPosition()); | |
| 4955 | + glm::mat4 worldToSensorMatrix = glm::inverse(myAvatar->getSensorToWorldMatrix()); | |
| 4956 | + glm::mat4 avatarToSensorMatrix = worldToSensorMatrix * myAvatarMatrix; | |
| 4957 | + for (auto& action : avatarControllerActions) { | |
| 4958 | + controller::Pose pose = userInputMapper->getPoseState(action); | |
| 4959 | + myAvatar->setControllerPoseInSensorFrame(action, pose.transform(avatarToSensorMatrix)); | |
| 4960 | + } | |
| 4885 | 4961 | |
| 4886 | 4962 | updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process... |
| 4887 | 4963 | updateDialogs(deltaTime); // update various stats dialogs if present |