Showing the changes to interface/src/ImportDialog.cpp (1 of 27 files). Show all
Unified · Split
| @@ -6,6 +6,7 @@ · 5 unmodified lines | |||
| 6 | // Copyright (c) 2013 High Fidelity, Inc. All rights reserved. | 6 | // Copyright (c) 2013 High Fidelity, Inc. All rights reserved. |
| 7 | // | 7 | // |
| 8 | #include "ImportDialog.h" | 8 | #include "ImportDialog.h" |
| 9 | #include "Application.h" | ||
| 9 | 10 | ||
| 10 | #include <QStandardPaths> | 11 | #include <QStandardPaths> |
| 11 | #include <QGridLayout> | 12 | #include <QGridLayout> |
| @@ -23,7 +24,7 @@ const QString IMPORT_FILE_TYPES = QObject::tr("Sparse Voxel Oc · 11 unmodified lines | |||
| 23 | const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); | 24 | const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); |
| 24 | 25 | ||
| 25 | 26 | ||
| 26 | const glm::vec3 UP = glm::vec3(0, 1, 0); | 27 | const glm::vec3 UP_VECT = glm::vec3(0, 1, 0); |
| 27 | const float ANGULAR_RATE = 0.02f; | 28 | const float ANGULAR_RATE = 0.02f; |
| 28 | const float VERTICAL_ANGLE = M_PI_4 / 2.0f; | 29 | const float VERTICAL_ANGLE = M_PI_4 / 2.0f; |
| 29 | const float RETURN_RATE = 0.02f; | 30 | const float RETURN_RATE = 0.02f; |
| @@ -61,7 +62,7 @@ private: · 31 unmodified lines | |||
| 61 | }; | 62 | }; |
| 62 | 63 | ||
| 63 | GLWidget::GLWidget(QWidget *parent, VoxelSystem *voxelSystem) | 64 | GLWidget::GLWidget(QWidget *parent, VoxelSystem *voxelSystem) |
| 64 | : QGLWidget(parent), | 65 | : QGLWidget(parent, Application::getInstance()->getGLWidget()), |
| 65 | _voxelSystem(voxelSystem), | 66 | _voxelSystem(voxelSystem), |
| 66 | _draw(false), | 67 | _draw(false), |
| 67 | _a(0.0f), | 68 | _a(0.0f), |
| @@ -77,11 +78,6 @@ void GLWidget::initializeGL() { · 9 unmodified lines | |||
| 77 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 78 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
| 78 | glShadeModel (GL_SMOOTH); | 79 | glShadeModel (GL_SMOOTH); |
| 79 | glEnable(GL_DEPTH_TEST); | 80 | glEnable(GL_DEPTH_TEST); |
| 80 | |||
| 81 | if(_voxelSystem) { | ||
| 82 | _voxelSystem->init(); | ||
| 83 | } | ||
| 84 | |||
| 85 | } | 81 | } |
| 86 | 82 | ||
| 87 | void GLWidget::resizeGL(int width, int height) { | 83 | void GLWidget::resizeGL(int width, int height) { |
| @@ -111,7 +107,7 @@ void GLWidget::paintGL() { · 23 unmodified lines | |||
| 111 | _targetCenter.y + (glm::length(_targetCenter) + NEAR_CLIP) * sin(_h), | 107 | _targetCenter.y + (glm::length(_targetCenter) + NEAR_CLIP) * sin(_h), |
| 112 | _targetCenter.z + (glm::length(_targetCenter) + NEAR_CLIP) * sin(_a), | 108 | _targetCenter.z + (glm::length(_targetCenter) + NEAR_CLIP) * sin(_a), |
| 113 | _targetCenter.x, _targetCenter.y, _targetCenter.z, | 109 | _targetCenter.x, _targetCenter.y, _targetCenter.z, |
| 114 | UP.x, UP.y, UP.z); | 110 | UP_VECT.x, UP_VECT.y, UP_VECT.z); |
| 115 | 111 | ||
| 116 | 112 | ||
| 117 | if (_draw && _voxelSystem) { | 113 | if (_draw && _voxelSystem) { |
| @@ -138,7 +134,7 @@ void GLWidget::paintGL() { · 20 unmodified lines | |||
| 138 | glVertex3d(2 * _targetCenter.x, 2 * _targetCenter.y, 0 ); | 134 | glVertex3d(2 * _targetCenter.x, 2 * _targetCenter.y, 0 ); |
| 139 | glEnd(); | 135 | glEnd(); |
| 140 | 136 | ||
| 141 | _voxelSystem->render(false); | 137 | _voxelSystem->render(true); |
| 142 | } | 138 | } |
| 143 | } | 139 | } |
| 144 | 140 | ||
| @@ -221,11 +217,7 @@ void ImportDialog::reject() { · 76 unmodified lines | |||
| 221 | } | 217 | } |
| 222 | 218 | ||
| 223 | int ImportDialog::exec() { | 219 | int ImportDialog::exec() { |
| 224 | reset(); | 220 | return QFileDialog::exec(); |
| 225 | int ret = QFileDialog::exec(); | ||
| 226 | preview(false); | ||
| 227 | |||
| 228 | return ret; | ||
| 229 | } | 221 | } |
| 230 | 222 | ||
| 231 | void ImportDialog::setGLCamera(float x, float y, float z) { | 223 | void ImportDialog::setGLCamera(float x, float y, float z) { |