History

Merge branch 'master' of https://github.com/highfidelity/hifi into graphicsMaster

samcake committed 10 years ago

Commit 83279482 parents c55c1e0 d12fdb9149 files · +2805 −1233Browse files

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

Unified · Split

interface/src/Application.cpp+20−22
@@ -45,7 +45,7 @@ · 44 unmodified lines
45#include <QtNetwork/QNetworkDiskCache>45#include <QtNetwork/QNetworkDiskCache>
46 46
47#include <gl/Config.h>47#include <gl/Config.h>
48#include <QtGui/QOpenGLContext>48#include <QOpenGLContextWrapper.h>
49 49
50#include <AccountManager.h>50#include <AccountManager.h>
51#include <AddressManager.h>51#include <AddressManager.h>
@@ -1077,6 +1077,11 @@ void Application::initializeUi() { · 1025 unmodified lines
1077}1077}
1078 1078
1079void Application::paintGL() {1079void Application::paintGL() {
1080 // paintGL uses a queued connection, so we can get messages from the queue even after we've quit
1081 // and the plugins have shutdown
1082 if (_aboutToQuit) {
1083 return;
1084 }
1080 _frameCount++;1085 _frameCount++;
1081 1086
1082 // update fps moving average1087 // update fps moving average
@@ -1398,13 +1403,13 @@ void Application::paintGL() { · 315 unmodified lines
1398 _lockedFramebufferMap[finalTexture] = scratchFramebuffer;1403 _lockedFramebufferMap[finalTexture] = scratchFramebuffer;
1399 1404
1400 uint64_t displayStart = usecTimestampNow();1405 uint64_t displayStart = usecTimestampNow();
1401 Q_ASSERT(QOpenGLContext::currentContext() == _offscreenContext->getContext());1406 Q_ASSERT(isCurrentContext(_offscreenContext->getContext()));
1402 {1407 {
1403 PROFILE_RANGE(__FUNCTION__ "/pluginSubmitScene");1408 PROFILE_RANGE(__FUNCTION__ "/pluginSubmitScene");
1404 PerformanceTimer perfTimer("pluginSubmitScene");1409 PerformanceTimer perfTimer("pluginSubmitScene");
1405 displayPlugin->submitSceneTexture(_frameCount, finalTexture, toGlm(size));1410 displayPlugin->submitSceneTexture(_frameCount, finalTexture, toGlm(size));
1406 }1411 }
1407 Q_ASSERT(QOpenGLContext::currentContext() == _offscreenContext->getContext());1412 Q_ASSERT(isCurrentContext(_offscreenContext->getContext()));
1408 1413
1409 uint64_t displayEnd = usecTimestampNow();1414 uint64_t displayEnd = usecTimestampNow();
1410 const float displayPeriodUsec = (float)(displayEnd - displayStart); // usecs1415 const float displayPeriodUsec = (float)(displayEnd - displayStart); // usecs
@@ -3074,11 +3079,6 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 1663 unmodified lines
3074 //qCDebug(interfaceapp) << ">>> inside... queryOctree()... _viewFrustum.getFieldOfView()=" << _viewFrustum.getFieldOfView();3079 //qCDebug(interfaceapp) << ">>> inside... queryOctree()... _viewFrustum.getFieldOfView()=" << _viewFrustum.getFieldOfView();
3075 bool wantExtraDebugging = getLogger()->extraDebugging();3080 bool wantExtraDebugging = getLogger()->extraDebugging();
3076 3081
3077 // These will be the same for all servers, so we can set them up once and then reuse for each server we send to.
3078 _octreeQuery.setWantLowResMoving(true);
3079 _octreeQuery.setWantDelta(true);
3080 _octreeQuery.setWantCompression(true);
3081
3082 _octreeQuery.setCameraPosition(_viewFrustum.getPosition());3082 _octreeQuery.setCameraPosition(_viewFrustum.getPosition());
3083 _octreeQuery.setCameraOrientation(_viewFrustum.getOrientation());3083 _octreeQuery.setCameraOrientation(_viewFrustum.getOrientation());
3084 _octreeQuery.setCameraFov(_viewFrustum.getFieldOfView());3084 _octreeQuery.setCameraFov(_viewFrustum.getFieldOfView());
@@ -3784,12 +3784,11 @@ void Application::domainChanged(const QString& domainHostname) { · 699 unmodified lines
3784 _domainConnectionRefusals.clear();3784 _domainConnectionRefusals.clear();
3785}3785}
3786 3786
3787void Application::handleDomainConnectionDeniedPacket(QSharedPointer<NLPacket> packet) {3787void Application::handleDomainConnectionDeniedPacket(QSharedPointer<ReceivedMessage> message) {
3788 // Read deny reason from packet3788 // Read deny reason from packet
3789 quint16 reasonSize;3789 quint16 reasonSize;
3790 packet->readPrimitive(&reasonSize);3790 message->readPrimitive(&reasonSize);
3791 QString reason = QString::fromUtf8(packet->getPayload() + packet->pos(), reasonSize);3791 QString reason = QString::fromUtf8(message->readWithoutCopy(reasonSize));
3792 packet->seek(packet->pos() + reasonSize);
3793 3792
3794 // output to the log so the user knows they got a denied connection request3793 // output to the log so the user knows they got a denied connection request
3795 // and check and signal for an access token so that we can make sure they are logged in3794 // and check and signal for an access token so that we can make sure they are logged in
@@ -3875,9 +3874,7 @@ void Application::nodeKilled(SharedNodePointer node) { · 79 unmodified lines
3875 Menu::getInstance()->getActionForOption(MenuOption::UploadAsset)->setEnabled(false);3874 Menu::getInstance()->getActionForOption(MenuOption::UploadAsset)->setEnabled(false);
3876 }3875 }
3877}3876}
3878 3877void Application::trackIncomingOctreePacket(ReceivedMessage& message, SharedNodePointer sendingNode, bool wasStatsPacket) {
3879void Application::trackIncomingOctreePacket(NLPacket& packet, SharedNodePointer sendingNode, bool wasStatsPacket) {
3880
3881 // Attempt to identify the sender from its address.3878 // Attempt to identify the sender from its address.
3882 if (sendingNode) {3879 if (sendingNode) {
3883 const QUuid& nodeUUID = sendingNode->getUUID();3880 const QUuid& nodeUUID = sendingNode->getUUID();
@@ -3886,13 +3883,13 @@ void Application::trackIncomingOctreePacket(NLPacket& packet, SharedNodePointer · 2 unmodified lines
3886 _octreeServerSceneStats.withWriteLock([&] {3883 _octreeServerSceneStats.withWriteLock([&] {
3887 if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) {3884 if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) {
3888 OctreeSceneStats& stats = _octreeServerSceneStats[nodeUUID];3885 OctreeSceneStats& stats = _octreeServerSceneStats[nodeUUID];
3889 stats.trackIncomingOctreePacket(packet, wasStatsPacket, sendingNode->getClockSkewUsec());3886 stats.trackIncomingOctreePacket(message, wasStatsPacket, sendingNode->getClockSkewUsec());
3890 }3887 }
3891 });3888 });
3892 }3889 }
3893}3890}
3894 3891
3895int Application::processOctreeStats(NLPacket& packet, SharedNodePointer sendingNode) {3892int Application::processOctreeStats(ReceivedMessage& message, SharedNodePointer sendingNode) {
3896 // But, also identify the sender, and keep track of the contained jurisdiction root for this server3893 // But, also identify the sender, and keep track of the contained jurisdiction root for this server
3897 3894
3898 // parse the incoming stats datas stick it in a temporary object for now, while we3895 // parse the incoming stats datas stick it in a temporary object for now, while we
@@ -3904,7 +3901,7 @@ int Application::processOctreeStats(NLPacket& packet, SharedNodePointer sendingN · 5 unmodified lines
3904 // now that we know the node ID, let's add these stats to the stats for that node...3901 // now that we know the node ID, let's add these stats to the stats for that node...
3905 _octreeServerSceneStats.withWriteLock([&] {3902 _octreeServerSceneStats.withWriteLock([&] {
3906 OctreeSceneStats& octreeStats = _octreeServerSceneStats[nodeUUID];3903 OctreeSceneStats& octreeStats = _octreeServerSceneStats[nodeUUID];
3907 statsMessageLength = octreeStats.unpackFromPacket(packet);3904 statsMessageLength = octreeStats.unpackFromPacket(message);
3908 3905
3909 // see if this is the first we've heard of this node...3906 // see if this is the first we've heard of this node...
3910 NodeToJurisdictionMap* jurisdiction = NULL;3907 NodeToJurisdictionMap* jurisdiction = NULL;
@@ -4083,7 +4080,7 @@ bool Application::canAcceptURL(const QString& urlString) { · 172 unmodified lines
4083 QString lowerPath = url.path().toLower();4080 QString lowerPath = url.path().toLower();
4084 while (i.hasNext()) {4081 while (i.hasNext()) {
4085 i.next();4082 i.next();
4086 if (lowerPath.endsWith(i.key())) {4083 if (lowerPath.endsWith(i.key(), Qt::CaseInsensitive)) {
4087 return true;4084 return true;
4088 }4085 }
4089 }4086 }
@@ -4103,7 +4100,7 @@ bool Application::acceptURL(const QString& urlString, bool defaultUpload) { · 13 unmodified lines
4103 QString lowerPath = url.path().toLower();4100 QString lowerPath = url.path().toLower();
4104 while (i.hasNext()) {4101 while (i.hasNext()) {
4105 i.next();4102 i.next();
4106 if (lowerPath.endsWith(i.key())) {4103 if (lowerPath.endsWith(i.key(), Qt::CaseInsensitive)) {
4107 AcceptURLMethod method = i.value();4104 AcceptURLMethod method = i.value();
4108 return (this->*method)(urlString);4105 return (this->*method)(urlString);
4109 }4106 }
@@ -4203,7 +4200,7 @@ bool Application::askToUploadAsset(const QString& filename) { · 93 unmodified lines
4203 messageBox.setDefaultButton(QMessageBox::Ok);4200 messageBox.setDefaultButton(QMessageBox::Ok);
4204 4201
4205 // Option to drop model in world for models4202 // Option to drop model in world for models
4206 if (filename.endsWith(FBX_EXTENSION) || filename.endsWith(OBJ_EXTENSION)) {4203 if (filename.endsWith(FBX_EXTENSION, Qt::CaseInsensitive) || filename.endsWith(OBJ_EXTENSION, Qt::CaseInsensitive)) {
4207 auto checkBox = new QCheckBox(&messageBox);4204 auto checkBox = new QCheckBox(&messageBox);
4208 checkBox->setText("Add to scene");4205 checkBox->setText("Add to scene");
4209 messageBox.setCheckBox(checkBox);4206 messageBox.setCheckBox(checkBox);
@@ -4238,7 +4235,8 @@ void Application::modelUploadFinished(AssetUpload* upload, const QString& hash) · 28 unmodified lines
4238 auto filename = QFileInfo(upload->getFilename()).fileName();4235 auto filename = QFileInfo(upload->getFilename()).fileName();
4239 4236
4240 if ((upload->getError() == AssetUpload::NoError) &&4237 if ((upload->getError() == AssetUpload::NoError) &&
4241 (filename.endsWith(FBX_EXTENSION) || filename.endsWith(OBJ_EXTENSION))) {4238 (upload->getExtension().endsWith(FBX_EXTENSION, Qt::CaseInsensitive) ||
4239 upload->getExtension().endsWith(OBJ_EXTENSION, Qt::CaseInsensitive))) {
4242 4240
4243 auto entities = DependencyManager::get<EntityScriptingInterface>();4241 auto entities = DependencyManager::get<EntityScriptingInterface>();
4244 4242