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
4545 #include <QtNetwork/QNetworkDiskCache>
4646
4747 #include <gl/Config.h>
48−#include <QtGui/QOpenGLContext>
48+#include <QOpenGLContextWrapper.h>
4949
5050 #include <AccountManager.h>
5151 #include <AddressManager.h>
@@ -1077,6 +1077,11 @@ void Application::initializeUi() { · 1025 unmodified lines
10771077 }
10781078
10791079 void 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+ }
10801085 _frameCount++;
10811086
10821087 // update fps moving average
@@ -1398,13 +1403,13 @@ void Application::paintGL() { · 315 unmodified lines
13981403 _lockedFramebufferMap[finalTexture] = scratchFramebuffer;
13991404
14001405 uint64_t displayStart = usecTimestampNow();
1401− Q_ASSERT(QOpenGLContext::currentContext() == _offscreenContext->getContext());
1406+ Q_ASSERT(isCurrentContext(_offscreenContext->getContext()));
14021407 {
14031408 PROFILE_RANGE(__FUNCTION__ "/pluginSubmitScene");
14041409 PerformanceTimer perfTimer("pluginSubmitScene");
14051410 displayPlugin->submitSceneTexture(_frameCount, finalTexture, toGlm(size));
14061411 }
1407− Q_ASSERT(QOpenGLContext::currentContext() == _offscreenContext->getContext());
1412+ Q_ASSERT(isCurrentContext(_offscreenContext->getContext()));
14081413
14091414 uint64_t displayEnd = usecTimestampNow();
14101415 const float displayPeriodUsec = (float)(displayEnd - displayStart); // usecs
@@ -3074,11 +3079,6 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 1663 unmodified lines
30743079 //qCDebug(interfaceapp) << ">>> inside... queryOctree()... _viewFrustum.getFieldOfView()=" << _viewFrustum.getFieldOfView();
30753080 bool wantExtraDebugging = getLogger()->extraDebugging();
30763081
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−
30823082 _octreeQuery.setCameraPosition(_viewFrustum.getPosition());
30833083 _octreeQuery.setCameraOrientation(_viewFrustum.getOrientation());
30843084 _octreeQuery.setCameraFov(_viewFrustum.getFieldOfView());
@@ -3784,12 +3784,11 @@ void Application::domainChanged(const QString& domainHostname) { · 699 unmodified lines
37843784 _domainConnectionRefusals.clear();
37853785 }
37863786
3787−void Application::handleDomainConnectionDeniedPacket(QSharedPointer<NLPacket> packet) {
3787+void Application::handleDomainConnectionDeniedPacket(QSharedPointer<ReceivedMessage> message) {
37883788 // Read deny reason from packet
37893789 quint16 reasonSize;
3790− packet->readPrimitive(&reasonSize);
3791− QString reason = QString::fromUtf8(packet->getPayload() + packet->pos(), reasonSize);
3792− packet->seek(packet->pos() + reasonSize);
3790+ message->readPrimitive(&reasonSize);
3791+ QString reason = QString::fromUtf8(message->readWithoutCopy(reasonSize));
37933792
37943793 // output to the log so the user knows they got a denied connection request
37953794 // 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
38753874 Menu::getInstance()->getActionForOption(MenuOption::UploadAsset)->setEnabled(false);
38763875 }
38773876 }
3878−
3879−void Application::trackIncomingOctreePacket(NLPacket& packet, SharedNodePointer sendingNode, bool wasStatsPacket) {
3880−
3877+void Application::trackIncomingOctreePacket(ReceivedMessage& message, SharedNodePointer sendingNode, bool wasStatsPacket) {
38813878 // Attempt to identify the sender from its address.
38823879 if (sendingNode) {
38833880 const QUuid& nodeUUID = sendingNode->getUUID();
@@ -3886,13 +3883,13 @@ void Application::trackIncomingOctreePacket(NLPacket& packet, SharedNodePointer · 2 unmodified lines
38863883 _octreeServerSceneStats.withWriteLock([&] {
38873884 if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) {
38883885 OctreeSceneStats& stats = _octreeServerSceneStats[nodeUUID];
3889− stats.trackIncomingOctreePacket(packet, wasStatsPacket, sendingNode->getClockSkewUsec());
3886+ stats.trackIncomingOctreePacket(message, wasStatsPacket, sendingNode->getClockSkewUsec());
38903887 }
38913888 });
38923889 }
38933890 }
38943891
3895−int Application::processOctreeStats(NLPacket& packet, SharedNodePointer sendingNode) {
3892+int Application::processOctreeStats(ReceivedMessage& message, SharedNodePointer sendingNode) {
38963893 // But, also identify the sender, and keep track of the contained jurisdiction root for this server
38973894
38983895 // 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
39043901 // now that we know the node ID, let's add these stats to the stats for that node...
39053902 _octreeServerSceneStats.withWriteLock([&] {
39063903 OctreeSceneStats& octreeStats = _octreeServerSceneStats[nodeUUID];
3907− statsMessageLength = octreeStats.unpackFromPacket(packet);
3904+ statsMessageLength = octreeStats.unpackFromPacket(message);
39083905
39093906 // see if this is the first we've heard of this node...
39103907 NodeToJurisdictionMap* jurisdiction = NULL;
@@ -4083,7 +4080,7 @@ bool Application::canAcceptURL(const QString& urlString) { · 172 unmodified lines
40834080 QString lowerPath = url.path().toLower();
40844081 while (i.hasNext()) {
40854082 i.next();
4086− if (lowerPath.endsWith(i.key())) {
4083+ if (lowerPath.endsWith(i.key(), Qt::CaseInsensitive)) {
40874084 return true;
40884085 }
40894086 }
@@ -4103,7 +4100,7 @@ bool Application::acceptURL(const QString& urlString, bool defaultUpload) { · 13 unmodified lines
41034100 QString lowerPath = url.path().toLower();
41044101 while (i.hasNext()) {
41054102 i.next();
4106− if (lowerPath.endsWith(i.key())) {
4103+ if (lowerPath.endsWith(i.key(), Qt::CaseInsensitive)) {
41074104 AcceptURLMethod method = i.value();
41084105 return (this->*method)(urlString);
41094106 }
@@ -4203,7 +4200,7 @@ bool Application::askToUploadAsset(const QString& filename) { · 93 unmodified lines
42034200 messageBox.setDefaultButton(QMessageBox::Ok);
42044201
42054202 // 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)) {
42074204 auto checkBox = new QCheckBox(&messageBox);
42084205 checkBox->setText("Add to scene");
42094206 messageBox.setCheckBox(checkBox);
@@ -4238,7 +4235,8 @@ void Application::modelUploadFinished(AssetUpload* upload, const QString& hash) · 28 unmodified lines
42384235 auto filename = QFileInfo(upload->getFilename()).fileName();
42394236
42404237 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))) {
42424240
42434241 auto entities = DependencyManager::get<EntityScriptingInterface>();
42444242