History

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

Atlante45 committed 12 years ago

Commit a2acdc02 parents 9402a58 e249b2985 files · +2101 −860Browse files

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

Unified · Split

interface/src/Application.cpp+65−92
@@ -154,7 +154,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 153 unmodified lines
154 _touchAvgY(0.0f),154 _touchAvgY(0.0f),
155 _isTouchPressed(false),155 _isTouchPressed(false),
156 _mousePressed(false),156 _mousePressed(false),
157 _chatEntryOn(false),
158 _audio(&_audioScope, STARTUP_JITTER_SAMPLES),157 _audio(&_audioScope, STARTUP_JITTER_SAMPLES),
159 _enableProcessVoxelsThread(true),158 _enableProcessVoxelsThread(true),
160 _voxelProcessor(),159 _voxelProcessor(),
@@ -508,7 +507,7 @@ void Application::paintGL() { · 347 unmodified lines
508 float headHeight = _myAvatar->getHead()->calculateAverageEyePosition().y - _myAvatar->getPosition().y;507 float headHeight = _myAvatar->getHead()->calculateAverageEyePosition().y - _myAvatar->getPosition().y;
509 _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _myAvatar->getScale());508 _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _myAvatar->getScale());
510 _myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight, 0));509 _myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight, 0));
511 _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PIf, 0.0f)));510 _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI, 0.0f)));
512 }511 }
513 512
514 // Update camera position513 // Update camera position
@@ -699,21 +698,6 @@ void Application::keyPressEvent(QKeyEvent* event) { · 184 unmodified lines
699 }698 }
700 699
701 if (activeWindow() == _window) {700 if (activeWindow() == _window) {
702 if (_chatEntryOn) {
703 if (_chatEntry.keyPressEvent(event)) {
704 _myAvatar->setKeyState(event->key() == Qt::Key_Backspace || event->key() == Qt::Key_Delete ?
705 DELETE_KEY_DOWN : INSERT_KEY_DOWN);
706 _myAvatar->setChatMessage(string(_chatEntry.getContents().size(), SOLID_BLOCK_CHAR));
707
708 } else {
709 _myAvatar->setChatMessage(_chatEntry.getContents());
710 _chatEntry.clear();
711 _chatEntryOn = false;
712 setMenuShortcutsEnabled(true);
713 }
714 return;
715 }
716
717 bool isShifted = event->modifiers().testFlag(Qt::ShiftModifier);701 bool isShifted = event->modifiers().testFlag(Qt::ShiftModifier);
718 bool isMeta = event->modifiers().testFlag(Qt::ControlModifier);702 bool isMeta = event->modifiers().testFlag(Qt::ControlModifier);
719 switch (event->key()) {703 switch (event->key()) {
@@ -745,7 +729,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 25 unmodified lines
745 if (!_myAvatar->getDriveKeys(UP)) {729 if (!_myAvatar->getDriveKeys(UP)) {
746 _myAvatar->jump();730 _myAvatar->jump();
747 }731 }
748 _myAvatar->setDriveKeys(UP, 1);732 _myAvatar->setDriveKeys(UP, 1.f);
749 break;733 break;
750 734
751 case Qt::Key_Asterisk:735 case Qt::Key_Asterisk:
@@ -753,11 +737,11 @@ void Application::keyPressEvent(QKeyEvent* event) { · 1 unmodified line
753 break;737 break;
754 738
755 case Qt::Key_C:739 case Qt::Key_C:
756 _myAvatar->setDriveKeys(DOWN, 1);740 _myAvatar->setDriveKeys(DOWN, 1.f);
757 break;741 break;
758 742
759 case Qt::Key_W:743 case Qt::Key_W:
760 _myAvatar->setDriveKeys(FWD, 1);744 _myAvatar->setDriveKeys(FWD, 1.f);
761 break;745 break;
762 746
763 case Qt::Key_S:747 case Qt::Key_S:
@@ -766,7 +750,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 2 unmodified lines
766 } else if (!isShifted && isMeta) {750 } else if (!isShifted && isMeta) {
767 takeSnapshot();751 takeSnapshot();
768 } else {752 } else {
769 _myAvatar->setDriveKeys(BACK, 1);753 _myAvatar->setDriveKeys(BACK, 1.f);
770 }754 }
771 break;755 break;
772 756
@@ -784,36 +768,33 @@ void Application::keyPressEvent(QKeyEvent* event) { · 11 unmodified lines
784 if (isShifted) {768 if (isShifted) {
785 Menu::getInstance()->triggerOption(MenuOption::Atmosphere);769 Menu::getInstance()->triggerOption(MenuOption::Atmosphere);
786 } else {770 } else {
787 _myAvatar->setDriveKeys(ROT_LEFT, 1);771 _myAvatar->setDriveKeys(ROT_LEFT, 1.f);
788 }772 }
789 break;773 break;
790 774
791 case Qt::Key_D:775 case Qt::Key_D:
792 _myAvatar->setDriveKeys(ROT_RIGHT, 1);776 _myAvatar->setDriveKeys(ROT_RIGHT, 1.f);
793 break;777 break;
794 778
795 case Qt::Key_Return:779 case Qt::Key_Return:
796 case Qt::Key_Enter:780 case Qt::Key_Enter:
797 _chatEntryOn = true;781 Menu::getInstance()->triggerOption(MenuOption::Chat);
798 _myAvatar->setKeyState(NO_KEY_DOWN);
799 _myAvatar->setChatMessage(string());
800 setMenuShortcutsEnabled(false);
801 break;782 break;
802 783
803 case Qt::Key_Up:784 case Qt::Key_Up:
804 _myAvatar->setDriveKeys(isShifted ? UP : FWD, 1);785 _myAvatar->setDriveKeys(isShifted ? UP : FWD, 1.f);
805 break;786 break;
806 787
807 case Qt::Key_Down:788 case Qt::Key_Down:
808 _myAvatar->setDriveKeys(isShifted ? DOWN : BACK, 1);789 _myAvatar->setDriveKeys(isShifted ? DOWN : BACK, 1.f);
809 break;790 break;
810 791
811 case Qt::Key_Left:792 case Qt::Key_Left:
812 _myAvatar->setDriveKeys(isShifted ? LEFT : ROT_LEFT, 1);793 _myAvatar->setDriveKeys(isShifted ? LEFT : ROT_LEFT, 1.f);
813 break;794 break;
814 795
815 case Qt::Key_Right:796 case Qt::Key_Right:
816 _myAvatar->setDriveKeys(isShifted ? RIGHT : ROT_RIGHT, 1);797 _myAvatar->setDriveKeys(isShifted ? RIGHT : ROT_RIGHT, 1.f);
817 break;798 break;
818 799
819 case Qt::Key_I:800 case Qt::Key_I:
@@ -940,54 +921,49 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 120 unmodified lines
940 921
941 922
942 if (activeWindow() == _window) {923 if (activeWindow() == _window) {
943 if (_chatEntryOn) {
944 _myAvatar->setKeyState(NO_KEY_DOWN);
945 return;
946 }
947
948 switch (event->key()) {924 switch (event->key()) {
949 case Qt::Key_E:925 case Qt::Key_E:
950 _myAvatar->setDriveKeys(UP, 0);926 _myAvatar->setDriveKeys(UP, 0.f);
951 break;927 break;
952 928
953 case Qt::Key_C:929 case Qt::Key_C:
954 _myAvatar->setDriveKeys(DOWN, 0);930 _myAvatar->setDriveKeys(DOWN, 0.f);
955 break;931 break;
956 932
957 case Qt::Key_W:933 case Qt::Key_W:
958 _myAvatar->setDriveKeys(FWD, 0);934 _myAvatar->setDriveKeys(FWD, 0.f);
959 break;935 break;
960 936
961 case Qt::Key_S:937 case Qt::Key_S:
962 _myAvatar->setDriveKeys(BACK, 0);938 _myAvatar->setDriveKeys(BACK, 0.f);
963 break;939 break;
964 940
965 case Qt::Key_A:941 case Qt::Key_A:
966 _myAvatar->setDriveKeys(ROT_LEFT, 0);942 _myAvatar->setDriveKeys(ROT_LEFT, 0.f);
967 break;943 break;
968 944
969 case Qt::Key_D:945 case Qt::Key_D:
970 _myAvatar->setDriveKeys(ROT_RIGHT, 0);946 _myAvatar->setDriveKeys(ROT_RIGHT, 0.f);
971 break;947 break;
972 948
973 case Qt::Key_Up:949 case Qt::Key_Up:
974 _myAvatar->setDriveKeys(FWD, 0);950 _myAvatar->setDriveKeys(FWD, 0.f);
975 _myAvatar->setDriveKeys(UP, 0);951 _myAvatar->setDriveKeys(UP, 0.f);
976 break;952 break;
977 953
978 case Qt::Key_Down:954 case Qt::Key_Down:
979 _myAvatar->setDriveKeys(BACK, 0);955 _myAvatar->setDriveKeys(BACK, 0.f);
980 _myAvatar->setDriveKeys(DOWN, 0);956 _myAvatar->setDriveKeys(DOWN, 0.f);
981 break;957 break;
982 958
983 case Qt::Key_Left:959 case Qt::Key_Left:
984 _myAvatar->setDriveKeys(LEFT, 0);960 _myAvatar->setDriveKeys(LEFT, 0.f);
985 _myAvatar->setDriveKeys(ROT_LEFT, 0);961 _myAvatar->setDriveKeys(ROT_LEFT, 0.f);
986 break;962 break;
987 963
988 case Qt::Key_Right:964 case Qt::Key_Right:
989 _myAvatar->setDriveKeys(RIGHT, 0);965 _myAvatar->setDriveKeys(RIGHT, 0.f);
990 _myAvatar->setDriveKeys(ROT_RIGHT, 0);966 _myAvatar->setDriveKeys(ROT_RIGHT, 0.f);
991 break;967 break;
992 968
993 default:969 default:
@@ -1242,8 +1218,10 @@ void Application::idle() { · 248 unmodified lines
1242 _idleLoopStdev.reset();1218 _idleLoopStdev.reset();
1243 }1219 }
1244 1220
1245 _buckyBalls.simulate(timeSinceLastUpdate / 1000.f, Application::getInstance()->getAvatar()->getHandData());1221 if (Menu::getInstance()->isOptionChecked(MenuOption::BuckyBalls)) {
1246 1222 _buckyBalls.simulate(timeSinceLastUpdate / 1000.f, Application::getInstance()->getAvatar()->getHandData());
1223 }
1224
1247 // After finishing all of the above work, restart the idle timer, allowing 2ms to process events.1225 // After finishing all of the above work, restart the idle timer, allowing 2ms to process events.
1248 idleTimer->start(2);1226 idleTimer->start(2);
1249 }1227 }
@@ -1492,7 +1470,7 @@ void Application::init() { · 242 unmodified lines
1492 3.0f * TREE_SCALE / 2.0f));1470 3.0f * TREE_SCALE / 2.0f));
1493 _sharedVoxelSystemViewFrustum.setNearClip(TREE_SCALE / 2.0f);1471 _sharedVoxelSystemViewFrustum.setNearClip(TREE_SCALE / 2.0f);
1494 _sharedVoxelSystemViewFrustum.setFarClip(3.0f * TREE_SCALE / 2.0f);1472 _sharedVoxelSystemViewFrustum.setFarClip(3.0f * TREE_SCALE / 2.0f);
1495 _sharedVoxelSystemViewFrustum.setFieldOfView(90);1473 _sharedVoxelSystemViewFrustum.setFieldOfView(90.f);
1496 _sharedVoxelSystemViewFrustum.setOrientation(glm::quat());1474 _sharedVoxelSystemViewFrustum.setOrientation(glm::quat());
1497 _sharedVoxelSystemViewFrustum.calculate();1475 _sharedVoxelSystemViewFrustum.calculate();
1498 _sharedVoxelSystem.setViewFrustum(&_sharedVoxelSystemViewFrustum);1476 _sharedVoxelSystem.setViewFrustum(&_sharedVoxelSystemViewFrustum);
@@ -2121,7 +2099,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 622 unmodified lines
2121void Application::loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum) {2099void Application::loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum) {
2122 // We will use these below, from either the camera or head vectors calculated above2100 // We will use these below, from either the camera or head vectors calculated above
2123 glm::vec3 position(camera.getPosition());2101 glm::vec3 position(camera.getPosition());
2124 float fov = camera.getFieldOfView();2102 float fov = camera.getFieldOfView(); // degrees
2125 float nearClip = camera.getNearClip();2103 float nearClip = camera.getNearClip();
2126 float farClip = camera.getFarClip();2104 float farClip = camera.getFarClip();
2127 float aspectRatio = camera.getAspectRatio();2105 float aspectRatio = camera.getAspectRatio();
@@ -2134,7 +2112,7 @@ void Application::loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum) { · 6 unmodified lines
2134 2112
2135 // Also make sure it's got the correct lens details from the camera2113 // Also make sure it's got the correct lens details from the camera
2136 viewFrustum.setAspectRatio(aspectRatio);2114 viewFrustum.setAspectRatio(aspectRatio);
2137 viewFrustum.setFieldOfView(fov);2115 viewFrustum.setFieldOfView(fov); // degrees
2138 viewFrustum.setNearClip(nearClip);2116 viewFrustum.setNearClip(nearClip);
2139 viewFrustum.setFarClip(farClip);2117 viewFrustum.setFarClip(farClip);
2140 viewFrustum.setEyeOffsetPosition(camera.getEyeOffsetPosition());2118 viewFrustum.setEyeOffsetPosition(camera.getEyeOffsetPosition());
@@ -2196,7 +2174,7 @@ void Application::updateShadowMap() { · 55 unmodified lines
2196 glPushMatrix();2174 glPushMatrix();
2197 glLoadIdentity();2175 glLoadIdentity();
2198 glm::vec3 axis = glm::axis(rotation);2176 glm::vec3 axis = glm::axis(rotation);
2199 glRotatef(glm::angle(rotation), axis.x, axis.y, axis.z);2177 glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
2200 2178
2201 // store view matrix without translation, which we'll use for precision-sensitive objects2179 // store view matrix without translation, which we'll use for precision-sensitive objects
2202 glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat*)&_untranslatedViewMatrix);2180 glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat*)&_untranslatedViewMatrix);
@@ -2275,7 +2253,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 72 unmodified lines
2275 glm::vec3 eyeOffsetPos = whichCamera.getEyeOffsetPosition();2253 glm::vec3 eyeOffsetPos = whichCamera.getEyeOffsetPosition();
2276 glm::quat eyeOffsetOrient = whichCamera.getEyeOffsetOrientation();2254 glm::quat eyeOffsetOrient = whichCamera.getEyeOffsetOrientation();
2277 glm::vec3 eyeOffsetAxis = glm::axis(eyeOffsetOrient);2255 glm::vec3 eyeOffsetAxis = glm::axis(eyeOffsetOrient);
2278 glRotatef(-glm::angle(eyeOffsetOrient), eyeOffsetAxis.x, eyeOffsetAxis.y, eyeOffsetAxis.z);2256 glRotatef(-glm::degrees(glm::angle(eyeOffsetOrient)), eyeOffsetAxis.x, eyeOffsetAxis.y, eyeOffsetAxis.z);
2279 glTranslatef(-eyeOffsetPos.x, -eyeOffsetPos.y, -eyeOffsetPos.z);2257 glTranslatef(-eyeOffsetPos.x, -eyeOffsetPos.y, -eyeOffsetPos.z);
2280 2258
2281 // transform view according to whichCamera2259 // transform view according to whichCamera
@@ -2284,7 +2262,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 2 unmodified lines
2284 2262
2285 glm::quat rotation = whichCamera.getRotation();2263 glm::quat rotation = whichCamera.getRotation();
2286 glm::vec3 axis = glm::axis(rotation);2264 glm::vec3 axis = glm::axis(rotation);
2287 glRotatef(-glm::angle(rotation), axis.x, axis.y, axis.z);2265 glRotatef(-glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
2288 2266
2289 // store view matrix without translation, which we'll use for precision-sensitive objects2267 // store view matrix without translation, which we'll use for precision-sensitive objects
2290 glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat*)&_untranslatedViewMatrix);2268 glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat*)&_untranslatedViewMatrix);
@@ -2488,11 +2466,6 @@ void Application::displayOverlay() { · 197 unmodified lines
2488 }2466 }
2489 }2467 }
2490 2468
2491 // Show chat entry field
2492 if (_chatEntryOn) {
2493 _chatEntry.render(_glWidget->width(), _glWidget->height());
2494 }
2495
2496 // Show on-screen msec timer2469 // Show on-screen msec timer
2497 if (Menu::getInstance()->isOptionChecked(MenuOption::FrameTimer)) {2470 if (Menu::getInstance()->isOptionChecked(MenuOption::FrameTimer)) {
2498 char frameTimer[10];2471 char frameTimer[10];
@@ -2502,7 +2475,7 @@ void Application::displayOverlay() { · 3 unmodified lines
2502 (Menu::getInstance()->isOptionChecked(MenuOption::Stats) && 2475 (Menu::getInstance()->isOptionChecked(MenuOption::Stats) &&
2503 Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth))2476 Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth))
2504 ? 80 : 20;2477 ? 80 : 20;
2505 drawText(_glWidget->width() - 100, _glWidget->height() - timerBottom, 0.30f, 1.0f, 0, frameTimer, WHITE_TEXT);2478 drawText(_glWidget->width() - 100, _glWidget->height() - timerBottom, 0.30f, 1.0f, 0.f, frameTimer, WHITE_TEXT);
2506 }2479 }
2507 2480
2508 _overlays.render2D();2481 _overlays.render2D();
@@ -2557,11 +2530,11 @@ void Application::displayStats() { · 48 unmodified lines
2557 sprintf(framesPerSecond, "Framerate: %3.0f FPS", _fps);2530 sprintf(framesPerSecond, "Framerate: %3.0f FPS", _fps);
2558 2531
2559 verticalOffset += STATS_PELS_PER_LINE;2532 verticalOffset += STATS_PELS_PER_LINE;
2560 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, serverNodes, WHITE_TEXT);2533 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, serverNodes, WHITE_TEXT);
2561 verticalOffset += STATS_PELS_PER_LINE;2534 verticalOffset += STATS_PELS_PER_LINE;
2562 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, avatarNodes, WHITE_TEXT);2535 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, avatarNodes, WHITE_TEXT);
2563 verticalOffset += STATS_PELS_PER_LINE;2536 verticalOffset += STATS_PELS_PER_LINE;
2564 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, framesPerSecond, WHITE_TEXT);2537 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, framesPerSecond, WHITE_TEXT);
2565 2538
2566 if (_statsExpanded) {2539 if (_statsExpanded) {
2567 char packetsPerSecond[30];2540 char packetsPerSecond[30];
@@ -2570,9 +2543,9 @@ void Application::displayStats() { · 2 unmodified lines
2570 sprintf(averageMegabitsPerSecond, "Mbps: %3.2f", (float)_bytesPerSecond * 8.f / 1000000.f);2543 sprintf(averageMegabitsPerSecond, "Mbps: %3.2f", (float)_bytesPerSecond * 8.f / 1000000.f);
2571 2544
2572 verticalOffset += STATS_PELS_PER_LINE;2545 verticalOffset += STATS_PELS_PER_LINE;
2573 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, packetsPerSecond, WHITE_TEXT);2546 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, packetsPerSecond, WHITE_TEXT);
2574 verticalOffset += STATS_PELS_PER_LINE;2547 verticalOffset += STATS_PELS_PER_LINE;
2575 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, averageMegabitsPerSecond, WHITE_TEXT);2548 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, averageMegabitsPerSecond, WHITE_TEXT);
2576 }2549 }
2577 2550
2578 verticalOffset = 0;2551 verticalOffset = 0;
@@ -2615,7 +2588,7 @@ void Application::displayStats() { · 36 unmodified lines
2615 "Buffer msecs %.1f",2588 "Buffer msecs %.1f",
2616 (float) (_audio.getNetworkBufferLengthSamplesPerChannel() + (float) _audio.getJitterBufferSamples()) /2589 (float) (_audio.getNetworkBufferLengthSamplesPerChannel() + (float) _audio.getJitterBufferSamples()) /
2617 (float)_audio.getNetworkSampleRate() * 1000.f);2590 (float)_audio.getNetworkSampleRate() * 1000.f);
2618 drawText(30, _glWidget->height() - 22, 0.10f, 0, 2, audioJitter, WHITE_TEXT);2591 drawText(30, _glWidget->height() - 22, 0.10f, 0.f, 2.f, audioJitter, WHITE_TEXT);
2619 2592
2620 2593
2621 char audioPing[30];2594 char audioPing[30];
@@ -2628,18 +2601,18 @@ void Application::displayStats() { · 6 unmodified lines
2628 sprintf(voxelAvgPing, "Voxel avg ping: %d", pingVoxel);2601 sprintf(voxelAvgPing, "Voxel avg ping: %d", pingVoxel);
2629 2602
2630 verticalOffset += STATS_PELS_PER_LINE;2603 verticalOffset += STATS_PELS_PER_LINE;
2631 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, audioPing, WHITE_TEXT);2604 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, audioPing, WHITE_TEXT);
2632 verticalOffset += STATS_PELS_PER_LINE;2605 verticalOffset += STATS_PELS_PER_LINE;
2633 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, avatarPing, WHITE_TEXT);2606 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, avatarPing, WHITE_TEXT);
2634 verticalOffset += STATS_PELS_PER_LINE;2607 verticalOffset += STATS_PELS_PER_LINE;
2635 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, voxelAvgPing, WHITE_TEXT);2608 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, voxelAvgPing, WHITE_TEXT);
2636 2609
2637 if (_statsExpanded) {2610 if (_statsExpanded) {
2638 char voxelMaxPing[30];2611 char voxelMaxPing[30];
2639 sprintf(voxelMaxPing, "Voxel max ping: %d", pingVoxelMax);2612 sprintf(voxelMaxPing, "Voxel max ping: %d", pingVoxelMax);
2640 2613
2641 verticalOffset += STATS_PELS_PER_LINE;2614 verticalOffset += STATS_PELS_PER_LINE;
2642 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, voxelMaxPing, WHITE_TEXT);2615 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, voxelMaxPing, WHITE_TEXT);
2643 }2616 }
2644 2617
2645 verticalOffset = 0;2618 verticalOffset = 0;
@@ -2667,11 +2640,11 @@ void Application::displayStats() { · 21 unmodified lines
2667 char avatarMixerStats[200];2640 char avatarMixerStats[200];
2668 2641
2669 verticalOffset += STATS_PELS_PER_LINE;2642 verticalOffset += STATS_PELS_PER_LINE;
2670 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, avatarPosition, WHITE_TEXT);2643 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, avatarPosition, WHITE_TEXT);
2671 verticalOffset += STATS_PELS_PER_LINE;2644 verticalOffset += STATS_PELS_PER_LINE;
2672 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, avatarVelocity, WHITE_TEXT);2645 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, avatarVelocity, WHITE_TEXT);
2673 verticalOffset += STATS_PELS_PER_LINE;2646 verticalOffset += STATS_PELS_PER_LINE;
2674 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, avatarBodyYaw, WHITE_TEXT);2647 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, avatarBodyYaw, WHITE_TEXT);
2675 2648
2676 if (_statsExpanded) {2649 if (_statsExpanded) {
2677 SharedNodePointer avatarMixer = NodeList::getInstance()->soloNodeOfType(NodeType::AvatarMixer);2650 SharedNodePointer avatarMixer = NodeList::getInstance()->soloNodeOfType(NodeType::AvatarMixer);
@@ -2684,7 +2657,7 @@ void Application::displayStats() { · 6 unmodified lines
2684 }2657 }
2685 2658
2686 verticalOffset += STATS_PELS_PER_LINE;2659 verticalOffset += STATS_PELS_PER_LINE;
2687 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, avatarMixerStats, WHITE_TEXT);2660 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, avatarMixerStats, WHITE_TEXT);
2688 }2661 }
2689 2662
2690 verticalOffset = 0;2663 verticalOffset = 0;
@@ -2699,7 +2672,7 @@ void Application::displayStats() { · 8 unmodified lines
2699 voxelStats.str("");2672 voxelStats.str("");
2700 voxelStats << "Voxels Memory Nodes: " << VoxelTreeElement::getTotalMemoryUsage() / 1000000.f << "MB";2673 voxelStats << "Voxels Memory Nodes: " << VoxelTreeElement::getTotalMemoryUsage() / 1000000.f << "MB";
2701 verticalOffset += STATS_PELS_PER_LINE;2674 verticalOffset += STATS_PELS_PER_LINE;
2702 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);2675 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT);
2703 2676
2704 voxelStats.str("");2677 voxelStats.str("");
2705 voxelStats << 2678 voxelStats <<
@@ -2709,14 +2682,14 @@ void Application::displayStats() { · 3 unmodified lines
2709 voxelStats << " / GPU: " << _voxels.getVoxelMemoryUsageGPU() / 1000000.f << "MB";2682 voxelStats << " / GPU: " << _voxels.getVoxelMemoryUsageGPU() / 1000000.f << "MB";
2710 }2683 }
2711 verticalOffset += STATS_PELS_PER_LINE;2684 verticalOffset += STATS_PELS_PER_LINE;
2712 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);2685 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT);
2713 2686
2714 // Voxel Rendering2687 // Voxel Rendering
2715 voxelStats.str("");2688 voxelStats.str("");
2716 voxelStats.precision(4);2689 voxelStats.precision(4);
2717 voxelStats << "Voxel Rendering Slots Max: " << _voxels.getMaxVoxels() / 1000.f << "K";2690 voxelStats << "Voxel Rendering Slots Max: " << _voxels.getMaxVoxels() / 1000.f << "K";
2718 verticalOffset += STATS_PELS_PER_LINE;2691 verticalOffset += STATS_PELS_PER_LINE;
2719 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);2692 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT);
2720 }2693 }
2721 2694
2722 voxelStats.str("");2695 voxelStats.str("");
@@ -2724,7 +2697,7 @@ void Application::displayStats() { · 1 unmodified line
2724 voxelStats << "Drawn: " << _voxels.getVoxelsWritten() / 1000.f << "K " <<2697 voxelStats << "Drawn: " << _voxels.getVoxelsWritten() / 1000.f << "K " <<
2725 "Abandoned: " << _voxels.getAbandonedVoxels() / 1000.f << "K ";2698 "Abandoned: " << _voxels.getAbandonedVoxels() / 1000.f << "K ";
2726 verticalOffset += STATS_PELS_PER_LINE;2699 verticalOffset += STATS_PELS_PER_LINE;
2727 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);2700 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT);
2728 2701
2729 // iterate all the current voxel stats, and list their sending modes, and total voxel counts2702 // iterate all the current voxel stats, and list their sending modes, and total voxel counts
2730 std::stringstream sendingMode("");2703 std::stringstream sendingMode("");
@@ -2768,7 +2741,7 @@ void Application::displayStats() { · 37 unmodified lines
2768 sendingMode << " <SCENE STABLE>";2741 sendingMode << " <SCENE STABLE>";
2769 }2742 }
2770 verticalOffset += STATS_PELS_PER_LINE;2743 verticalOffset += STATS_PELS_PER_LINE;
2771 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)sendingMode.str().c_str(), WHITE_TEXT);2744 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)sendingMode.str().c_str(), WHITE_TEXT);
2772 }2745 }
2773 2746
2774 // Incoming packets2747 // Incoming packets
@@ -2780,7 +2753,7 @@ void Application::displayStats() { · 5 unmodified lines
2780 voxelStats << "Voxel Packets to Process: " << packetsString.toLocal8Bit().constData()2753 voxelStats << "Voxel Packets to Process: " << packetsString.toLocal8Bit().constData()
2781 << " [Recent Max: " << maxString.toLocal8Bit().constData() << "]"; 2754 << " [Recent Max: " << maxString.toLocal8Bit().constData() << "]";
2782 verticalOffset += STATS_PELS_PER_LINE;2755 verticalOffset += STATS_PELS_PER_LINE;
2783 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);2756 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT);
2784 }2757 }
2785 2758
2786 if (_resetRecentMaxPacketsSoon && voxelPacketsToProcess > 0) {2759 if (_resetRecentMaxPacketsSoon && voxelPacketsToProcess > 0) {
@@ -2803,7 +2776,7 @@ void Application::displayStats() { · 16 unmodified lines
2803 voxelStats.str("");2776 voxelStats.str("");
2804 voxelStats << "Server voxels: " << serversTotalString.toLocal8Bit().constData();2777 voxelStats << "Server voxels: " << serversTotalString.toLocal8Bit().constData();
2805 verticalOffset += STATS_PELS_PER_LINE;2778 verticalOffset += STATS_PELS_PER_LINE;
2806 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);2779 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT);
2807 2780
2808 if (_statsExpanded) {2781 if (_statsExpanded) {
2809 QString serversInternalString = locale.toString((uint)totalInternal);2782 QString serversInternalString = locale.toString((uint)totalInternal);
@@ -2814,7 +2787,7 @@ void Application::displayStats() { · 4 unmodified lines
2814 "Internal: " << serversInternalString.toLocal8Bit().constData() << " " <<2787 "Internal: " << serversInternalString.toLocal8Bit().constData() << " " <<
2815 "Leaves: " << serversLeavesString.toLocal8Bit().constData() << "";2788 "Leaves: " << serversLeavesString.toLocal8Bit().constData() << "";
2816 verticalOffset += STATS_PELS_PER_LINE;2789 verticalOffset += STATS_PELS_PER_LINE;
2817 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);2790 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT);
2818 }2791 }
2819 2792
2820 unsigned long localTotal = VoxelTreeElement::getNodeCount();2793 unsigned long localTotal = VoxelTreeElement::getNodeCount();
@@ -2824,7 +2797,7 @@ void Application::displayStats() { · 3 unmodified lines
2824 voxelStats.str("");2797 voxelStats.str("");
2825 voxelStats << "Local voxels: " << localTotalString.toLocal8Bit().constData();2798 voxelStats << "Local voxels: " << localTotalString.toLocal8Bit().constData();
2826 verticalOffset += STATS_PELS_PER_LINE;2799 verticalOffset += STATS_PELS_PER_LINE;
2827 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);2800 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT);
2828 2801
2829 if (_statsExpanded) {2802 if (_statsExpanded) {
2830 unsigned long localInternal = VoxelTreeElement::getInternalNodeCount();2803 unsigned long localInternal = VoxelTreeElement::getInternalNodeCount();
@@ -2837,7 +2810,7 @@ void Application::displayStats() { · 6 unmodified lines
2837 "Internal: " << localInternalString.toLocal8Bit().constData() << " " <<2810 "Internal: " << localInternalString.toLocal8Bit().constData() << " " <<
2838 "Leaves: " << localLeavesString.toLocal8Bit().constData() << "";2811 "Leaves: " << localLeavesString.toLocal8Bit().constData() << "";
2839 verticalOffset += STATS_PELS_PER_LINE;2812 verticalOffset += STATS_PELS_PER_LINE;
2840 drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT);2813 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT);
2841 }2814 }
2842}2815}
2843 2816
@@ -2928,17 +2901,17 @@ glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) { · 84 unmodified lines
2928void Application::renderRearViewMirror(const QRect& region, bool billboard) {2901void Application::renderRearViewMirror(const QRect& region, bool billboard) {
2929 bool eyeRelativeCamera = false;2902 bool eyeRelativeCamera = false;
2930 if (billboard) {2903 if (billboard) {
2931 _mirrorCamera.setFieldOfView(BILLBOARD_FIELD_OF_VIEW);2904 _mirrorCamera.setFieldOfView(BILLBOARD_FIELD_OF_VIEW); // degees
2932 _mirrorCamera.setDistance(BILLBOARD_DISTANCE * _myAvatar->getScale());2905 _mirrorCamera.setDistance(BILLBOARD_DISTANCE * _myAvatar->getScale());
2933 _mirrorCamera.setTargetPosition(_myAvatar->getPosition());2906 _mirrorCamera.setTargetPosition(_myAvatar->getPosition());
2934 2907
2935 } else if (_rearMirrorTools->getZoomLevel() == BODY) {2908 } else if (_rearMirrorTools->getZoomLevel() == BODY) {
2936 _mirrorCamera.setFieldOfView(MIRROR_FIELD_OF_VIEW);2909 _mirrorCamera.setFieldOfView(MIRROR_FIELD_OF_VIEW); // degrees
2937 _mirrorCamera.setDistance(MIRROR_REARVIEW_BODY_DISTANCE * _myAvatar->getScale());2910 _mirrorCamera.setDistance(MIRROR_REARVIEW_BODY_DISTANCE * _myAvatar->getScale());
2938 _mirrorCamera.setTargetPosition(_myAvatar->getChestPosition());2911 _mirrorCamera.setTargetPosition(_myAvatar->getChestPosition());
2939 2912
2940 } else { // HEAD zoom level2913 } else { // HEAD zoom level
2941 _mirrorCamera.setFieldOfView(MIRROR_FIELD_OF_VIEW);2914 _mirrorCamera.setFieldOfView(MIRROR_FIELD_OF_VIEW); // degrees
2942 _mirrorCamera.setDistance(MIRROR_REARVIEW_DISTANCE * _myAvatar->getScale());2915 _mirrorCamera.setDistance(MIRROR_REARVIEW_DISTANCE * _myAvatar->getScale());
2943 if (_myAvatar->getSkeletonModel().isActive() && _myAvatar->getHead()->getFaceModel().isActive()) {2916 if (_myAvatar->getSkeletonModel().isActive() && _myAvatar->getHead()->getFaceModel().isActive()) {
2944 // as a hack until we have a better way of dealing with coordinate precision issues, reposition the2917 // as a hack until we have a better way of dealing with coordinate precision issues, reposition the
@@ -2952,7 +2925,7 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 7 unmodified lines
2952 }2925 }
2953 _mirrorCamera.setAspectRatio((float)region.width() / region.height());2926 _mirrorCamera.setAspectRatio((float)region.width() / region.height());
2954 2927
2955 _mirrorCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PIf, 0.0f)));2928 _mirrorCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI, 0.0f)));
2956 _mirrorCamera.update(1.0f/_fps);2929 _mirrorCamera.update(1.0f/_fps);
2957 2930
2958 // set the bounds of rear mirror view2931 // set the bounds of rear mirror view

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