History

Merge branch 'master' of github.com:highfidelity/hifi into overlay-front-draw

Ryan Huffman committed 11 years ago

Commit 9020fee2 parents 649ae4a c5e923f136 files · +6641 −7080Browse files

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

Unified · Split

interface/src/Application.cpp+43−43
@@ -604,7 +604,7 @@ void Application::initializeGL() { · 603 unmodified lines
604 }604 }
605 605
606 // update before the first render606 // update before the first render
607 update(1.f / _fps);607 update(1.0f / _fps);
608 608
609 InfoView::showFirstTime(INFO_HELP_PATH);609 InfoView::showFirstTime(INFO_HELP_PATH);
610}610}
@@ -668,7 +668,7 @@ void Application::paintGL() { · 57 unmodified lines
668 668
669 // Update camera position669 // Update camera position
670 if (!OculusManager::isConnected()) {670 if (!OculusManager::isConnected()) {
671 _myCamera.update(1.f / _fps);671 _myCamera.update(1.0f / _fps);
672 }672 }
673 673
674 // Note: whichCamera is used to pick between the normal camera myCamera for our674 // Note: whichCamera is used to pick between the normal camera myCamera for our
@@ -693,7 +693,7 @@ void Application::paintGL() { · 18 unmodified lines
693 693
694 _viewFrustumOffsetCamera.setRotation(_myCamera.getRotation() * frustumRotation);694 _viewFrustumOffsetCamera.setRotation(_myCamera.getRotation() * frustumRotation);
695 695
696 _viewFrustumOffsetCamera.update(1.f/_fps);696 _viewFrustumOffsetCamera.update(1.0f/_fps);
697 whichCamera = &_viewFrustumOffsetCamera;697 whichCamera = &_viewFrustumOffsetCamera;
698 }698 }
699 699
@@ -712,7 +712,7 @@ void Application::paintGL() { · 12 unmodified lines
712 } else {712 } else {
713 OculusManager::display(_myAvatar->getWorldAlignedOrientation(), _myAvatar->getDefaultEyePosition(), *whichCamera);713 OculusManager::display(_myAvatar->getWorldAlignedOrientation(), _myAvatar->getDefaultEyePosition(), *whichCamera);
714 }714 }
715 _myCamera.update(1.f / _fps);715 _myCamera.update(1.0f / _fps);
716 716
717 } else if (TV3DManager::isConnected()) {717 } else if (TV3DManager::isConnected()) {
718 718
@@ -918,7 +918,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 199 unmodified lines
918 if (!_myAvatar->getDriveKeys(UP)) {918 if (!_myAvatar->getDriveKeys(UP)) {
919 _myAvatar->jump();919 _myAvatar->jump();
920 }920 }
921 _myAvatar->setDriveKeys(UP, 1.f);921 _myAvatar->setDriveKeys(UP, 1.0f);
922 break;922 break;
923 923
924 case Qt::Key_Asterisk:924 case Qt::Key_Asterisk:
@@ -927,14 +927,14 @@ void Application::keyPressEvent(QKeyEvent* event) { · 2 unmodified lines
927 927
928 case Qt::Key_C:928 case Qt::Key_C:
929 case Qt::Key_PageDown:929 case Qt::Key_PageDown:
930 _myAvatar->setDriveKeys(DOWN, 1.f);930 _myAvatar->setDriveKeys(DOWN, 1.0f);
931 break;931 break;
932 932
933 case Qt::Key_W:933 case Qt::Key_W:
934 if (isOption && !isShifted && !isMeta) {934 if (isOption && !isShifted && !isMeta) {
935 Menu::getInstance()->triggerOption(MenuOption::Wireframe);935 Menu::getInstance()->triggerOption(MenuOption::Wireframe);
936 } else {936 } else {
937 _myAvatar->setDriveKeys(FWD, 1.f);937 _myAvatar->setDriveKeys(FWD, 1.0f);
938 }938 }
939 break;939 break;
940 940
@@ -946,7 +946,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 5 unmodified lines
946 } else if (!isOption && !isShifted && isMeta) {946 } else if (!isOption && !isShifted && isMeta) {
947 takeSnapshot();947 takeSnapshot();
948 } else {948 } else {
949 _myAvatar->setDriveKeys(BACK, 1.f);949 _myAvatar->setDriveKeys(BACK, 1.0f);
950 }950 }
951 break;951 break;
952 952
@@ -964,13 +964,13 @@ void Application::keyPressEvent(QKeyEvent* event) { · 11 unmodified lines
964 if (isShifted) {964 if (isShifted) {
965 Menu::getInstance()->triggerOption(MenuOption::Atmosphere);965 Menu::getInstance()->triggerOption(MenuOption::Atmosphere);
966 } else {966 } else {
967 _myAvatar->setDriveKeys(ROT_LEFT, 1.f);967 _myAvatar->setDriveKeys(ROT_LEFT, 1.0f);
968 }968 }
969 break;969 break;
970 970
971 case Qt::Key_D:971 case Qt::Key_D:
972 if (!isMeta) {972 if (!isMeta) {
973 _myAvatar->setDriveKeys(ROT_RIGHT, 1.f);973 _myAvatar->setDriveKeys(ROT_RIGHT, 1.0f);
974 }974 }
975 break;975 break;
976 976
@@ -998,7 +998,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 21 unmodified lines
998 _raiseMirror += 0.05f;998 _raiseMirror += 0.05f;
999 }999 }
1000 } else {1000 } else {
1001 _myAvatar->setDriveKeys(isShifted ? UP : FWD, 1.f);1001 _myAvatar->setDriveKeys(isShifted ? UP : FWD, 1.0f);
1002 }1002 }
1003 break;1003 break;
1004 1004
@@ -1010,23 +1010,23 @@ void Application::keyPressEvent(QKeyEvent* event) { · 5 unmodified lines
1010 _raiseMirror -= 0.05f;1010 _raiseMirror -= 0.05f;
1011 }1011 }
1012 } else {1012 } else {
1013 _myAvatar->setDriveKeys(isShifted ? DOWN : BACK, 1.f);1013 _myAvatar->setDriveKeys(isShifted ? DOWN : BACK, 1.0f);
1014 }1014 }
1015 break;1015 break;
1016 1016
1017 case Qt::Key_Left:1017 case Qt::Key_Left:
1018 if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {1018 if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
1019 _rotateMirror += PI / 20.f;1019 _rotateMirror += PI / 20.0f;
1020 } else {1020 } else {
1021 _myAvatar->setDriveKeys(isShifted ? LEFT : ROT_LEFT, 1.f);1021 _myAvatar->setDriveKeys(isShifted ? LEFT : ROT_LEFT, 1.0f);
1022 }1022 }
1023 break;1023 break;
1024 1024
1025 case Qt::Key_Right:1025 case Qt::Key_Right:
1026 if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {1026 if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
1027 _rotateMirror -= PI / 20.f;1027 _rotateMirror -= PI / 20.0f;
1028 } else {1028 } else {
1029 _myAvatar->setDriveKeys(isShifted ? RIGHT : ROT_RIGHT, 1.f);1029 _myAvatar->setDriveKeys(isShifted ? RIGHT : ROT_RIGHT, 1.0f);
1030 }1030 }
1031 break;1031 break;
1032 1032
@@ -1177,48 +1177,48 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 144 unmodified lines
1177 switch (event->key()) {1177 switch (event->key()) {
1178 case Qt::Key_E:1178 case Qt::Key_E:
1179 case Qt::Key_PageUp:1179 case Qt::Key_PageUp:
1180 _myAvatar->setDriveKeys(UP, 0.f);1180 _myAvatar->setDriveKeys(UP, 0.0f);
1181 break;1181 break;
1182 1182
1183 case Qt::Key_C:1183 case Qt::Key_C:
1184 case Qt::Key_PageDown:1184 case Qt::Key_PageDown:
1185 _myAvatar->setDriveKeys(DOWN, 0.f);1185 _myAvatar->setDriveKeys(DOWN, 0.0f);
1186 break;1186 break;
1187 1187
1188 case Qt::Key_W:1188 case Qt::Key_W:
1189 _myAvatar->setDriveKeys(FWD, 0.f);1189 _myAvatar->setDriveKeys(FWD, 0.0f);
1190 break;1190 break;
1191 1191
1192 case Qt::Key_S:1192 case Qt::Key_S:
1193 _myAvatar->setDriveKeys(BACK, 0.f);1193 _myAvatar->setDriveKeys(BACK, 0.0f);
1194 break;1194 break;
1195 1195
1196 case Qt::Key_A:1196 case Qt::Key_A:
1197 _myAvatar->setDriveKeys(ROT_LEFT, 0.f);1197 _myAvatar->setDriveKeys(ROT_LEFT, 0.0f);
1198 break;1198 break;
1199 1199
1200 case Qt::Key_D:1200 case Qt::Key_D:
1201 _myAvatar->setDriveKeys(ROT_RIGHT, 0.f);1201 _myAvatar->setDriveKeys(ROT_RIGHT, 0.0f);
1202 break;1202 break;
1203 1203
1204 case Qt::Key_Up:1204 case Qt::Key_Up:
1205 _myAvatar->setDriveKeys(FWD, 0.f);1205 _myAvatar->setDriveKeys(FWD, 0.0f);
1206 _myAvatar->setDriveKeys(UP, 0.f);1206 _myAvatar->setDriveKeys(UP, 0.0f);
1207 break;1207 break;
1208 1208
1209 case Qt::Key_Down:1209 case Qt::Key_Down:
1210 _myAvatar->setDriveKeys(BACK, 0.f);1210 _myAvatar->setDriveKeys(BACK, 0.0f);
1211 _myAvatar->setDriveKeys(DOWN, 0.f);1211 _myAvatar->setDriveKeys(DOWN, 0.0f);
1212 break;1212 break;
1213 1213
1214 case Qt::Key_Left:1214 case Qt::Key_Left:
1215 _myAvatar->setDriveKeys(LEFT, 0.f);1215 _myAvatar->setDriveKeys(LEFT, 0.0f);
1216 _myAvatar->setDriveKeys(ROT_LEFT, 0.f);1216 _myAvatar->setDriveKeys(ROT_LEFT, 0.0f);
1217 break;1217 break;
1218 1218
1219 case Qt::Key_Right:1219 case Qt::Key_Right:
1220 _myAvatar->setDriveKeys(RIGHT, 0.f);1220 _myAvatar->setDriveKeys(RIGHT, 0.0f);
1221 _myAvatar->setDriveKeys(ROT_RIGHT, 0.f);1221 _myAvatar->setDriveKeys(ROT_RIGHT, 0.0f);
1222 break;1222 break;
1223 case Qt::Key_Control:1223 case Qt::Key_Control:
1224 case Qt::Key_Shift:1224 case Qt::Key_Shift:
@@ -1522,7 +1522,7 @@ void Application::idle() { · 297 unmodified lines
1522 PerformanceTimer perfTimer("update");1522 PerformanceTimer perfTimer("update");
1523 PerformanceWarning warn(showWarnings, "Application::idle()... update()");1523 PerformanceWarning warn(showWarnings, "Application::idle()... update()");
1524 const float BIGGEST_DELTA_TIME_SECS = 0.25f;1524 const float BIGGEST_DELTA_TIME_SECS = 0.25f;
1525 update(glm::clamp((float)timeSinceLastUpdate / 1000.f, 0.f, BIGGEST_DELTA_TIME_SECS));1525 update(glm::clamp((float)timeSinceLastUpdate / 1000.0f, 0.0f, BIGGEST_DELTA_TIME_SECS));
1526 }1526 }
1527 {1527 {
1528 PerformanceTimer perfTimer("updateGL");1528 PerformanceTimer perfTimer("updateGL");
@@ -1653,8 +1653,8 @@ void Application::makeVoxel(glm::vec3 position, · 124 unmodified lines
1653 }1653 }
1654 1654
1655glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVoxel) {1655glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVoxel) {
1656 return glm::vec3((mouseVoxel.x + mouseVoxel.s / 2.f) * TREE_SCALE, (mouseVoxel.y + mouseVoxel.s / 2.f) * TREE_SCALE,1656 return glm::vec3((mouseVoxel.x + mouseVoxel.s / 2.0f) * TREE_SCALE, (mouseVoxel.y + mouseVoxel.s / 2.0f) * TREE_SCALE,
1657 (mouseVoxel.z + mouseVoxel.s / 2.f) * TREE_SCALE);1657 (mouseVoxel.z + mouseVoxel.s / 2.0f) * TREE_SCALE);
1658}1658}
1659 1659
1660FaceTracker* Application::getActiveFaceTracker() {1660FaceTracker* Application::getActiveFaceTracker() {
@@ -1867,7 +1867,7 @@ void Application::init() { · 206 unmodified lines
1867 3.0f * TREE_SCALE / 2.0f));1867 3.0f * TREE_SCALE / 2.0f));
1868 _sharedVoxelSystemViewFrustum.setNearClip(TREE_SCALE / 2.0f);1868 _sharedVoxelSystemViewFrustum.setNearClip(TREE_SCALE / 2.0f);
1869 _sharedVoxelSystemViewFrustum.setFarClip(3.0f * TREE_SCALE / 2.0f);1869 _sharedVoxelSystemViewFrustum.setFarClip(3.0f * TREE_SCALE / 2.0f);
1870 _sharedVoxelSystemViewFrustum.setFieldOfView(90.f);1870 _sharedVoxelSystemViewFrustum.setFieldOfView(90.0f);
1871 _sharedVoxelSystemViewFrustum.setOrientation(glm::quat());1871 _sharedVoxelSystemViewFrustum.setOrientation(glm::quat());
1872 _sharedVoxelSystemViewFrustum.calculate();1872 _sharedVoxelSystemViewFrustum.calculate();
1873 _sharedVoxelSystem.setViewFrustum(&_sharedVoxelSystemViewFrustum);1873 _sharedVoxelSystem.setViewFrustum(&_sharedVoxelSystemViewFrustum);
@@ -2163,7 +2163,7 @@ void Application::updateMyAvatarLookAtPosition() { · 289 unmodified lines
2163 } else {2163 } else {
2164 // I am not looking at anyone else, so just look forward2164 // I am not looking at anyone else, so just look forward
2165 lookAtSpot = _myAvatar->getHead()->getEyePosition() +2165 lookAtSpot = _myAvatar->getHead()->getEyePosition() +
2166 (_myAvatar->getHead()->getFinalOrientationInWorldFrame() * glm::vec3(0.f, 0.f, -TREE_SCALE));2166 (_myAvatar->getHead()->getFinalOrientationInWorldFrame() * glm::vec3(0.0f, 0.0f, -TREE_SCALE));
2167 }2167 }
2168 }2168 }
2169 //2169 //
@@ -2317,7 +2317,7 @@ void Application::update(float deltaTime) { · 147 unmodified lines
2317 updateDialogs(deltaTime); // update various stats dialogs if present2317 updateDialogs(deltaTime); // update various stats dialogs if present
2318 updateCursor(deltaTime); // Handle cursor updates2318 updateCursor(deltaTime); // Handle cursor updates
2319 2319
2320 {2320 if (!_aboutToQuit) {
2321 PerformanceTimer perfTimer("entities");2321 PerformanceTimer perfTimer("entities");
2322 _entities.update(); // update the models...2322 _entities.update(); // update the models...
2323 {2323 {
@@ -3221,12 +3221,12 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 897 unmodified lines
3221 if (billboard) {3221 if (billboard) {
3222 _mirrorCamera.setFieldOfView(BILLBOARD_FIELD_OF_VIEW); // degees3222 _mirrorCamera.setFieldOfView(BILLBOARD_FIELD_OF_VIEW); // degees
3223 _mirrorCamera.setPosition(_myAvatar->getPosition() +3223 _mirrorCamera.setPosition(_myAvatar->getPosition() +
3224 _myAvatar->getOrientation() * glm::vec3(0.f, 0.f, -1.0f) * BILLBOARD_DISTANCE * _myAvatar->getScale());3224 _myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * BILLBOARD_DISTANCE * _myAvatar->getScale());
3225 3225
3226 } else if (_rearMirrorTools->getZoomLevel() == BODY) {3226 } else if (_rearMirrorTools->getZoomLevel() == BODY) {
3227 _mirrorCamera.setFieldOfView(MIRROR_FIELD_OF_VIEW); // degrees3227 _mirrorCamera.setFieldOfView(MIRROR_FIELD_OF_VIEW); // degrees
3228 _mirrorCamera.setPosition(_myAvatar->getChestPosition() +3228 _mirrorCamera.setPosition(_myAvatar->getChestPosition() +
3229 _myAvatar->getOrientation() * glm::vec3(0.f, 0.f, -1.0f) * MIRROR_REARVIEW_BODY_DISTANCE * _myAvatar->getScale());3229 _myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_BODY_DISTANCE * _myAvatar->getScale());
3230 3230
3231 } else { // HEAD zoom level3231 } else { // HEAD zoom level
3232 _mirrorCamera.setFieldOfView(MIRROR_FIELD_OF_VIEW); // degrees3232 _mirrorCamera.setFieldOfView(MIRROR_FIELD_OF_VIEW); // degrees
@@ -3234,11 +3234,11 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 1 unmodified line
3234 // as a hack until we have a better way of dealing with coordinate precision issues, reposition the3234 // as a hack until we have a better way of dealing with coordinate precision issues, reposition the
3235 // face/body so that the average eye position lies at the origin3235 // face/body so that the average eye position lies at the origin
3236 eyeRelativeCamera = true;3236 eyeRelativeCamera = true;
3237 _mirrorCamera.setPosition(_myAvatar->getOrientation() * glm::vec3(0.f, 0.f, -1.0f) * MIRROR_REARVIEW_DISTANCE * _myAvatar->getScale());3237 _mirrorCamera.setPosition(_myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_DISTANCE * _myAvatar->getScale());
3238 3238
3239 } else {3239 } else {
3240 _mirrorCamera.setPosition(_myAvatar->getHead()->getEyePosition() +3240 _mirrorCamera.setPosition(_myAvatar->getHead()->getEyePosition() +
3241 _myAvatar->getOrientation() * glm::vec3(0.f, 0.f, -1.0f) * MIRROR_REARVIEW_DISTANCE * _myAvatar->getScale());3241 _myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_DISTANCE * _myAvatar->getScale());
3242 }3242 }
3243 }3243 }
3244 _mirrorCamera.setAspectRatio((float)region.width() / region.height());3244 _mirrorCamera.setAspectRatio((float)region.width() / region.height());
@@ -4234,7 +4234,7 @@ void Application::toggleLogDialog() { · 989 unmodified lines
4234}4234}
4235 4235
4236void Application::initAvatarAndViewFrustum() {4236void Application::initAvatarAndViewFrustum() {
4237 updateMyAvatar(0.f);4237 updateMyAvatar(0.0f);
4238}4238}
4239 4239
4240void Application::checkVersion() {4240void Application::checkVersion() {
@@ -4408,7 +4408,7 @@ unsigned int Application::getRenderTargetFramerate() const { · 167 unmodified lines
4408 4408
4409float Application::getRenderResolutionScale() const {4409float Application::getRenderResolutionScale() const {
4410 if (Menu::getInstance()->isOptionChecked(MenuOption::RenderResolutionOne)) {4410 if (Menu::getInstance()->isOptionChecked(MenuOption::RenderResolutionOne)) {
4411 return 1.f;4411 return 1.0f;
4412 } else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderResolutionTwoThird)) {4412 } else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderResolutionTwoThird)) {
4413 return 0.666f;4413 return 0.666f;
4414 } else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderResolutionHalf)) {4414 } else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderResolutionHalf)) {
@@ -4418,6 +4418,6 @@ float Application::getRenderResolutionScale() const { · 3 unmodified lines
4418 } else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderResolutionQuarter)) {4418 } else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderResolutionQuarter)) {
4419 return 0.25f;4419 return 0.25f;
4420 } else {4420 } else {
4421 return 1.f;4421 return 1.0f;
4422 }4422 }
4423}4423}