History

Merge branch 'master' of https://github.com/highfidelity/hifi into feat/domain-setup

Liv committed 9 years ago

Commit aea5f172 parents 49eab84 342f8ac179 files · +9927 −1712Browse files

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

Unified · Split

interface/src/Application.cpp+126−50
@@ -193,6 +193,9 @@ · 192 unmodified lines
193193 #include <src/scripting/LimitlessVoiceRecognitionScriptingInterface.h>
194194 #include <EntityScriptClient.h>
195195 #include <ModelScriptingInterface.h>
196+#include "commerce/Ledger.h"
197+#include "commerce/Wallet.h"
198+#include "commerce/QmlCommerce.h"
196199
197200 // On Windows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU
198201 // FIXME seems to be broken.
@@ -602,6 +605,8 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 403 unmodified lines
602605 DependencyManager::set<CloseEventSender>();
603606 DependencyManager::set<ResourceManager>();
604607 DependencyManager::set<ContextOverlayInterface>();
608+ DependencyManager::set<Ledger>();
609+ DependencyManager::set<Wallet>();
605610
606611 return previousSessionCrashed;
607612 }
@@ -711,7 +716,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 103 unmodified lines
711716 qInstallMessageHandler(messageHandler);
712717
713718 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "styles/Inconsolata.otf");
714− _window->setWindowTitle("Interface");
719+ _window->setWindowTitle("High Fidelity Interface");
715720
716721 Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us
717722
@@ -959,6 +964,53 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 241 unmodified lines
959964 // Make sure we don't time out during slow operations at startup
960965 updateHeartbeat();
961966
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
9621014 Setting::Handle<bool> firstRun { Settings::firstRun, true };
9631015
9641016 // 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
20612113 LoginDialog::registerType();
20622114 Tooltip::registerType();
20632115 UpdateDialog::registerType();
2116+ QmlCommerce::registerType();
20642117 qmlRegisterType<ResourceImageItem>("Hifi", 1, 0, "ResourceImageItem");
20652118 qmlRegisterType<Preference>("Hifi", 1, 0, "Preference");
20662119
@@ -4419,10 +4472,9 @@ void Application::updateMyAvatarLookAtPosition() { · 2352 unmodified lines
44194472 }
44204473 } else {
44214474 // I am not looking at anyone else, so just look forward
4422− auto headPose = myAvatar->getHeadControllerPoseInSensorFrame();
4475+ auto headPose = myAvatar->getControllerPoseInWorldFrame(controller::Action::HEAD);
44234476 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));
44264478 } else {
44274479 lookAtSpot = myAvatar->getHead()->getEyePosition() +
44284480 (myAvatar->getHead()->getFinalOrientationInWorldFrame() * glm::vec3(0.0f, 0.0f, -TREE_SCALE));
@@ -4836,52 +4888,76 @@ void Application::update(float deltaTime) { · 407 unmodified lines
48364888 myAvatar->setDriveKey(MyAvatar::ZOOM, userInputMapper->getActionState(controller::Action::TRANSLATE_CAMERA_Z));
48374889 }
48384890
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+ }
48854961
48864962 updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process...
48874963 updateDialogs(deltaTime); // update various stats dialogs if present