History

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

Atlante45 committed 12 years ago

Commit fb106762 parents 4a9415f f6ed9c775 files · +26318 −484Browse files

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

Unified · Split

interface/src/Application.cpp+46−33
@@ -58,6 +58,7 @@ · 57 unmodified lines
5858 #include <PacketHeaders.h>
5959 #include <ParticlesScriptingInterface.h>
6060 #include <PerfStat.h>
61+#include <ResourceCache.h>
6162 #include <UUID.h>
6263 #include <VoxelSceneStats.h>
6364 #include <LocalVoxelsList.h>
@@ -276,6 +277,9 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 212 unmodified lines
276277 cache->setCacheDirectory(!cachePath.isEmpty() ? cachePath : "interfaceCache");
277278 _networkAccessManager->setCache(cache);
278279
280+ ResourceCache::setNetworkAccessManager(_networkAccessManager);
281+ ResourceCache::setRequestLimit(3);
282+
279283 _window->setCentralWidget(_glWidget);
280284
281285 restoreSizeAndPosition();
@@ -2469,6 +2473,8 @@ void Application::computeOffAxisFrustum(float& left, float& right, float& bottom · 2187 unmodified lines
24692473 _viewFrustum.computeOffAxisFrustum(left, right, bottom, top, nearVal, farVal, nearClipPlane, farClipPlane);
24702474 }
24712475
2476+const float WHITE_TEXT[] = { 0.93, 0.93, 0.93 };
2477+
24722478 void Application::displayOverlay() {
24732479 PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "Application::displayOverlay()");
24742480
@@ -2491,16 +2497,13 @@ void Application::displayOverlay() { · 16 unmodified lines
24912497 }
24922498
24932499 if (Menu::getInstance()->isOptionChecked(MenuOption::Stats)) {
2494− displayStatsBackground(0x33333399, 0, _glWidget->height() - 68, 296, 68);
2495− _audio.render(_glWidget->width(), _glWidget->height());
2500+ _audio.renderMuteIcon(1, _glWidget->height() - 50);
24962501 if (Menu::getInstance()->isOptionChecked(MenuOption::Oscilloscope)) {
2497− int oscilloscopeTop = Menu::getInstance()->isOptionChecked(MenuOption::Mirror) ? 130 : 25;
2502+ int oscilloscopeTop = _glWidget->height() - 135;
24982503 _audioScope.render(25, oscilloscopeTop);
24992504 }
25002505 }
25012506
2502− //noiseTest(_glWidget->width(), _glWidget->height());
2503−
25042507 if (Menu::getInstance()->isOptionChecked(MenuOption::HeadMouse)) {
25052508 _myAvatar->renderHeadMouse();
25062509 }
@@ -2542,8 +2545,7 @@ void Application::displayOverlay() { · 35 unmodified lines
25422545 (Menu::getInstance()->isOptionChecked(MenuOption::Stats) &&
25432546 Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth))
25442547 ? 80 : 20;
2545− drawtext(_glWidget->width() - 100, _glWidget->height() - timerBottom, 0.30f, 0, 1.0f, 0, frameTimer, 0, 0, 0);
2546− drawtext(_glWidget->width() - 102, _glWidget->height() - timerBottom - 2, 0.30f, 0, 1.0f, 0, frameTimer, 1, 1, 1);
2548+ drawText(_glWidget->width() - 100, _glWidget->height() - timerBottom, 0.30f, 1.0f, 0, frameTimer, WHITE_TEXT);
25472549 }
25482550
25492551 if (_pieMenu.isDisplayed()) {
@@ -2571,6 +2573,7 @@ void Application::displayStatsBackground(unsigned int rgba, int x, int y, int wi · 21 unmodified lines
25712573 }
25722574
25732575 // display expanded or contracted stats
2576+
25742577 void Application::displayStats() {
25752578 unsigned int backgroundColor = 0x33333399;
25762579 int verticalOffset = 0, horizontalOffset = 0, lines = 0;
@@ -2601,22 +2604,22 @@ void Application::displayStats() { · 24 unmodified lines
26012604 sprintf(framesPerSecond, "Framerate: %3.0f FPS", _fps);
26022605
26032606 verticalOffset += STATS_PELS_PER_LINE;
2604− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0f, 2, serverNodes, .93f, .93f, .93f);
2607+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, serverNodes, WHITE_TEXT);
26052608 verticalOffset += STATS_PELS_PER_LINE;
2606− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0f, 2, avatarNodes, .93f, .93f, .93f);
2609+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, avatarNodes, WHITE_TEXT);
26072610 verticalOffset += STATS_PELS_PER_LINE;
2608− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, framesPerSecond, .93f, .93f, .93f);
2611+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, framesPerSecond, WHITE_TEXT);
26092612
26102613 if (_statsExpanded) {
26112614 char packetsPerSecond[30];
26122615 sprintf(packetsPerSecond, "Pkts/sec: %d", _packetsPerSecond);
26132616 char averageMegabitsPerSecond[30];
2614− sprintf(averageMegabitsPerSecond, "Avg Mbps: %3.2f", (float)_bytesPerSecond * 8.f / 1000000.f);
2617+ sprintf(averageMegabitsPerSecond, "Mbps: %3.2f", (float)_bytesPerSecond * 8.f / 1000000.f);
26152618
26162619 verticalOffset += STATS_PELS_PER_LINE;
2617− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, packetsPerSecond, .93f, .93f, .93f);
2620+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, packetsPerSecond, WHITE_TEXT);
26182621 verticalOffset += STATS_PELS_PER_LINE;
2619− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, averageMegabitsPerSecond, .93f, .93f, .93f);
2622+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, averageMegabitsPerSecond, WHITE_TEXT);
26202623 }
26212624
26222625 verticalOffset = 0;
@@ -2654,26 +2657,36 @@ void Application::displayStats() { · 31 unmodified lines
26542657 displayStatsBackground(backgroundColor, horizontalOffset, 0, 175, lines * STATS_PELS_PER_LINE + 10);
26552658 horizontalOffset += 5;
26562659
2660+ char audioJitter[30];
2661+ sprintf(audioJitter,
2662+ "Buffer msecs %.1f",
2663+ (float) (_audio.getNetworkBufferLengthSamplesPerChannel() + (float) _audio.getJitterBufferSamples()) /
2664+ (float)_audio.getNetworkSampleRate() * 1000.f);
2665+ drawText(30, _glWidget->height() - 22, 0.10f, 0, 2, audioJitter, WHITE_TEXT);
2666+
2667+
26572668 char audioPing[30];
26582669 sprintf(audioPing, "Audio ping: %d", pingAudio);
2670+
2671+
26592672 char avatarPing[30];
26602673 sprintf(avatarPing, "Avatar ping: %d", pingAvatar);
26612674 char voxelAvgPing[30];
26622675 sprintf(voxelAvgPing, "Voxel avg ping: %d", pingVoxel);
26632676
26642677 verticalOffset += STATS_PELS_PER_LINE;
2665− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, audioPing, .93f, .93f, .93f);
2678+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, audioPing, WHITE_TEXT);
26662679 verticalOffset += STATS_PELS_PER_LINE;
2667− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, avatarPing, .93f, .93f, .93f);
2680+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, avatarPing, WHITE_TEXT);
26682681 verticalOffset += STATS_PELS_PER_LINE;
2669− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, voxelAvgPing, .93f, .93f, .93f);
2682+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, voxelAvgPing, WHITE_TEXT);
26702683
26712684 if (_statsExpanded) {
26722685 char voxelMaxPing[30];
26732686 sprintf(voxelMaxPing, "Voxel max ping: %d", pingVoxelMax);
26742687
26752688 verticalOffset += STATS_PELS_PER_LINE;
2676− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, voxelMaxPing, .93f, .93f, .93f);
2689+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, voxelMaxPing, WHITE_TEXT);
26772690 }
26782691
26792692 verticalOffset = 0;
@@ -2692,20 +2705,20 @@ void Application::displayStats() { · 12 unmodified lines
26922705 sprintf(avatarPosition, "Pos: %.0f,%.0f,%.0f", avatarPos.x, avatarPos.y, avatarPos.z);
26932706 } else {
26942707 // longhand way
2695− sprintf(avatarPosition, "Position: %.3f, %.3f, %.3f", avatarPos.x, avatarPos.y, avatarPos.z);
2708+ sprintf(avatarPosition, "Position: %.1f, %.1f, %.1f", avatarPos.x, avatarPos.y, avatarPos.z);
26962709 }
26972710 char avatarVelocity[30];
26982711 sprintf(avatarVelocity, "Velocity: %.1f", glm::length(_myAvatar->getVelocity()));
26992712 char avatarBodyYaw[30];
2700− sprintf(avatarBodyYaw, "Yaw: %.2f", _myAvatar->getBodyYaw());
2713+ sprintf(avatarBodyYaw, "Yaw: %.1f", _myAvatar->getBodyYaw());
27012714 char avatarMixerStats[200];
27022715
27032716 verticalOffset += STATS_PELS_PER_LINE;
2704− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, avatarPosition, .93f, .93f, .93f);
2717+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, avatarPosition, WHITE_TEXT);
27052718 verticalOffset += STATS_PELS_PER_LINE;
2706− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, avatarVelocity, .93f, .93f, .93f);
2719+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, avatarVelocity, WHITE_TEXT);
27072720 verticalOffset += STATS_PELS_PER_LINE;
2708− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, avatarBodyYaw, .93f, .93f, .93f);
2721+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, avatarBodyYaw, WHITE_TEXT);
27092722
27102723 if (_statsExpanded) {
27112724 SharedNodePointer avatarMixer = NodeList::getInstance()->soloNodeOfType(NodeType::AvatarMixer);
@@ -2718,7 +2731,7 @@ void Application::displayStats() { · 6 unmodified lines
27182731 }
27192732
27202733 verticalOffset += STATS_PELS_PER_LINE;
2721− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, avatarMixerStats, .93f, .93f, .93f);
2734+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, avatarMixerStats, WHITE_TEXT);
27222735 }
27232736
27242737 verticalOffset = 0;
@@ -2733,7 +2746,7 @@ void Application::displayStats() { · 8 unmodified lines
27332746 voxelStats.str("");
27342747 voxelStats << "Voxels Memory Nodes: " << VoxelTreeElement::getTotalMemoryUsage() / 1000000.f << "MB";
27352748 verticalOffset += STATS_PELS_PER_LINE;
2736− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, (char*)voxelStats.str().c_str(), .93f, .93f, .93f);
2749+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);
27372750
27382751 voxelStats.str("");
27392752 voxelStats <<
@@ -2743,14 +2756,14 @@ void Application::displayStats() { · 3 unmodified lines
27432756 voxelStats << " / GPU: " << _voxels.getVoxelMemoryUsageGPU() / 1000000.f << "MB";
27442757 }
27452758 verticalOffset += STATS_PELS_PER_LINE;
2746− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, (char*)voxelStats.str().c_str(), .93f, .93f, .93f);
2759+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);
27472760
27482761 // Voxel Rendering
27492762 voxelStats.str("");
27502763 voxelStats.precision(4);
27512764 voxelStats << "Voxel Rendering Slots Max: " << _voxels.getMaxVoxels() / 1000.f << "K";
27522765 verticalOffset += STATS_PELS_PER_LINE;
2753− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, (char*)voxelStats.str().c_str(), .93f, .93f, .93f);
2766+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);
27542767 }
27552768
27562769 voxelStats.str("");
@@ -2758,7 +2771,7 @@ void Application::displayStats() { · 1 unmodified line
27582771 voxelStats << "Drawn: " << _voxels.getVoxelsWritten() / 1000.f << "K " <<
27592772 "Abandoned: " << _voxels.getAbandonedVoxels() / 1000.f << "K ";
27602773 verticalOffset += STATS_PELS_PER_LINE;
2761− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, (char*)voxelStats.str().c_str(), .93f, .93f, .93f);
2774+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);
27622775
27632776 // iterate all the current voxel stats, and list their sending modes, and total voxel counts
27642777 std::stringstream sendingMode("");
@@ -2802,7 +2815,7 @@ void Application::displayStats() { · 37 unmodified lines
28022815 sendingMode << " <SCENE STABLE>";
28032816 }
28042817 verticalOffset += STATS_PELS_PER_LINE;
2805− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, (char*)sendingMode.str().c_str(), .93f, .93f, .93f);
2818+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)sendingMode.str().c_str(), WHITE_TEXT);
28062819 }
28072820
28082821 // Incoming packets
@@ -2814,7 +2827,7 @@ void Application::displayStats() { · 5 unmodified lines
28142827 voxelStats << "Voxel Packets to Process: " << packetsString.toLocal8Bit().constData()
28152828 << " [Recent Max: " << maxString.toLocal8Bit().constData() << "]";
28162829 verticalOffset += STATS_PELS_PER_LINE;
2817− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, (char*)voxelStats.str().c_str(), .93f, .93f, .93f);
2830+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);
28182831 }
28192832
28202833 if (_resetRecentMaxPacketsSoon && voxelPacketsToProcess > 0) {
@@ -2837,7 +2850,7 @@ void Application::displayStats() { · 16 unmodified lines
28372850 voxelStats.str("");
28382851 voxelStats << "Server voxels: " << serversTotalString.toLocal8Bit().constData();
28392852 verticalOffset += STATS_PELS_PER_LINE;
2840− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, (char*)voxelStats.str().c_str(), .93f, .93f, .93f);
2853+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);
28412854
28422855 if (_statsExpanded) {
28432856 QString serversInternalString = locale.toString((uint)totalInternal);
@@ -2848,7 +2861,7 @@ void Application::displayStats() { · 4 unmodified lines
28482861 "Internal: " << serversInternalString.toLocal8Bit().constData() << " " <<
28492862 "Leaves: " << serversLeavesString.toLocal8Bit().constData() << "";
28502863 verticalOffset += STATS_PELS_PER_LINE;
2851− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, (char*)voxelStats.str().c_str(), .93f, .93f, .93f);
2864+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);
28522865 }
28532866
28542867 unsigned long localTotal = VoxelTreeElement::getNodeCount();
@@ -2858,7 +2871,7 @@ void Application::displayStats() { · 3 unmodified lines
28582871 voxelStats.str("");
28592872 voxelStats << "Local voxels: " << localTotalString.toLocal8Bit().constData();
28602873 verticalOffset += STATS_PELS_PER_LINE;
2861− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, (char*)voxelStats.str().c_str(), .93f, .93f, .93f);
2874+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);
28622875
28632876 if (_statsExpanded) {
28642877 unsigned long localInternal = VoxelTreeElement::getInternalNodeCount();
@@ -2871,7 +2884,7 @@ void Application::displayStats() { · 6 unmodified lines
28712884 "Internal: " << localInternalString.toLocal8Bit().constData() << " " <<
28722885 "Leaves: " << localLeavesString.toLocal8Bit().constData() << "";
28732886 verticalOffset += STATS_PELS_PER_LINE;
2874− drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, (char*)voxelStats.str().c_str(), .93f, .93f, .93f);
2887+ drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);
28752888 }
28762889 }
28772890

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