diff --git a/qglengine/qglview_test/qglview_window.cpp b/qglengine/qglview_test/qglview_window.cpp index fd1b38c..d2df073 100644 --- a/qglengine/qglview_test/qglview_window.cpp +++ b/qglengine/qglview_test/qglview_window.cpp @@ -43,18 +43,6 @@ QGLViewWindow::QGLViewWindow(QWidget * parent): QMainWindow(parent), Ui::QGLView view->view()->setDepthStart(0.1); view->view()->setSelectionMode(Scene::smMultiSelection); - spinFOV->setValue(view->view()->FOV()); - spinDepthStart->setValue(view->view()->depthStart()); - groupHoverHalo->setChecked(view->view()->isHoverHaloEnabled()); - groupSelectionHalo->setChecked(view->view()->isSelectionHaloEnabled()); - spinHoverHaloFill->setValue(view->view()->hoverHaloFillAlpha()); - spinSelectionHaloFill->setValue(view->view()->selectionHaloFillAlpha()); - colorHoverHalo->setColor(view->view()->hoverHaloColor()); - colorSelectionHalo->setColor(view->view()->selectionHaloColor()); - checkFXAA->setChecked(view->view()->isFeatureEnabled(QGLView::qglFXAA)); - colorBack->setColor(view->view()->backColor()); - colorAmbient->setColor(view->view()->ambientColor()); - checkCameraOrbit->setChecked(view->view()->isCameraOrbit()); groupShadows->setChecked(view->view()->isFeatureEnabled(QGLView::qglShadowsEnabled)); groupEyeAccomodation->setChecked(view->view()->isFeatureEnabled(QGLView::qglEyeAccomodationEnabled)); @@ -88,6 +76,7 @@ QGLViewWindow::QGLViewWindow(QWidget * parent): QMainWindow(parent), Ui::QGLView matEditor->assignQGLView(view->view()); objectEditor->assignQGLView(view->view()); primitiveEditor->assignQGLView(view->view()); + viewEditor->assignQGLView(view->view()); session.load(); diff --git a/qglengine/qglview_test/qglview_window.h b/qglengine/qglview_test/qglview_window.h index 420d6ad..1d61f9c 100644 --- a/qglengine/qglview_test/qglview_window.h +++ b/qglengine/qglview_test/qglview_window.h @@ -61,24 +61,6 @@ private: bool isChanged; private slots: - void on_spinFOV_valueChanged(double val) {view->view()->setFOV(val);} - void on_spinDepthStart_valueChanged(double val) {view->view()->setDepthStart(val);} - void on_spinViewGamma_valueChanged(double val) {view->view()->setGamma(val);} - void on_comboViewRenderMode_currentIndexChanged(int val) {static int modes[] = {GL_POINT, GL_LINE, GL_FILL}; view->view()->setRenderMode((ObjectBase::RenderMode)modes[val]);} - void on_groupHoverHalo_clicked(bool val) {view->view()->setHoverHaloEnabled(val);} - void on_groupSelectionHalo_clicked(bool val) {view->view()->setSelectionHaloEnabled(val);} - void on_spinHoverHaloFill_valueChanged(double val) {view->view()->setHoverHaloFillAlpha(val);} - void on_spinSelectionHaloFill_valueChanged(double val) {view->view()->setSelectionHaloFillAlpha(val);} - void on_colorHoverHalo_colorChanged(QColor color) {view->view()->setHoverHaloColor(color);} - void on_colorSelectionHalo_colorChanged(QColor color) {view->view()->setSelectionHaloColor(color);} - void on_checkAutoExposure_toggled(bool val) {view->view()->setAutoExposure(val);} - void on_checkFXAA_clicked(bool val) {view->view()->setFeature(QGLView::qglFXAA, val);} - void on_colorBack_colorChanged(QColor color) {view->view()->setBackColor(color);} - void on_colorAmbient_colorChanged(QColor color) {view->view()->setAmbientColor(color);} - void on_checkCameraOrbit_clicked(bool val) {view->view()->setCameraOrbit(val);} - void on_checkCameraLight_clicked(bool val) {view->view()->setCameraLightOn(val);} - void on_checkService_clicked(bool val) {view->view()->setServiceMode(val);} - void on_groupShadows_clicked(bool val) {view->view()->setFeature(QGLView::qglShadowsEnabled, val);} void on_groupEyeAccomodation_clicked(bool val) {view->view()->setFeature(QGLView::qglEyeAccomodationEnabled, val);} void on_groupBloom_clicked(bool val) {view->view()->setFeature(QGLView::qglBloomEnabled, val);} diff --git a/qglengine/qglview_test/qglview_window.ui b/qglengine/qglview_test/qglview_window.ui index 58acecc..e228f57 100644 --- a/qglengine/qglview_test/qglview_window.ui +++ b/qglengine/qglview_test/qglview_window.ui @@ -58,433 +58,7 @@ - - - - QFormLayout::AllNonFixedFieldsGrow - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 0 - - - 0 - - - 0 - - - 0 - - - - - FOV - - - - - - - 0.100000000000000 - - - 179.900000000000006 - - - 60.000000000000000 - - - - - - - Depth start - - - - - - - 3 - - - 999999999.000000000000000 - - - QAbstractSpinBox::AdaptiveDecimalStepType - - - 1.000000000000000 - - - - - - - Draw mode - - - - - - - 2 - - - - Point - - - - - Wireframe - - - - - Solid - - - - - - - - Back color - - - - - - - - 10 - 10 - 10 - - - - - - - - Ambient - - - - - - - - 10 - 10 - 10 - - - - - - - - Gamma - - - - - - - 0.010000000000000 - - - 5.000000000000000 - - - 1.000000000000000 - - - 2 - - - - - - - - - - - - Hover halo - - - true - - - - - - - 255 - 0 - 251 - - - - true - - - - - - - Fill - - - - - - - 0.000000000000000 - - - 1.000000000000000 - - - 0.300000000000000 - - - 2 - - - 0.050000000000000 - - - 0.100000000000000 - - - - - - - - - - FXAA - - - - - - - Service mode - - - true - - - - - - - Auto exposure - - - true - - - - - - - Selection halo - - - true - - - - - - - 0 - 143 - 239 - - - - true - - - - - - - Fill - - - - - - - 0.000000000000000 - - - 1.000000000000000 - - - 0.300000000000000 - - - 2 - - - 0.050000000000000 - - - 0.100000000000000 - - - - - - - - - - - - - - Camera - - - - - - Orbit - - - true - - - - - - - Camera Light - - - true - - - - - - - - - - - 0 - 0 - - - - Fog - - - - QFormLayout::AllNonFixedFieldsGrow - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - Density: - - - - - - - - - 0.000000000000000 - - - 10.000000000000000 - - - 0.000000000000000 - - - 3 - - - 0.050000000000000 - - - 0.100000000000000 - - - - - - - - 128 - 128 - 128 - - - - - - - - - - Decay: - - - - - - - 0.000000000000000 - - - 9999.000000000000000 - - - 10.000000000000000 - - - 2 - - - 0.050000000000000 - - - 0.100000000000000 - - - true - - - 9999.000000000000000 - - - - - - - + @@ -1372,11 +946,6 @@ QWidget
spinslider.h
- - ColorButton - QPushButton -
colorbutton.h
-
GLWidget QWidget @@ -1407,6 +976,12 @@
primitiveeditor.h
1
+ + ViewEditor + QWidget +
view_editor.h
+ 1 +
diff --git a/qglengine/widgets/view_editor.cpp b/qglengine/widgets/view_editor.cpp new file mode 100644 index 0000000..49b8725 --- /dev/null +++ b/qglengine/widgets/view_editor.cpp @@ -0,0 +1,152 @@ +/* + QGLView + Copyright (C) 2019 Ivan Pelipenko peri4ko@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "view_editor.h" +#include "ui_view_editor.h" +#include +#include + + +ViewEditor::ViewEditor(QWidget * parent): QWidget(parent) { + ui = new Ui::ViewEditor(); + ui->setupUi(this); + view = 0; + active = true; +} + + +void ViewEditor::assignQGLView(QGLView * v) { + view = v; + if (!view) return; + active = false; + ui->spinFOV->setValue(view->FOV()); + ui->spinDepthStart->setValue(view->depthStart()); + ui->groupHoverHalo->setChecked(view->isHoverHaloEnabled()); + ui->groupSelectionHalo->setChecked(view->isSelectionHaloEnabled()); + ui->spinHoverHaloFill->setValue(view->hoverHaloFillAlpha()); + ui->spinSelectionHaloFill->setValue(view->selectionHaloFillAlpha()); + ui->colorHoverHalo->setColor(view->hoverHaloColor()); + ui->colorSelectionHalo->setColor(view->selectionHaloColor()); + ui->checkFXAA->setChecked(view->isFeatureEnabled(QGLView::qglFXAA)); + ui->checkCameraOrbit->setChecked(view->isCameraOrbit()); + ui->checkService->setChecked(view->isServiceMode()); + active = true; +} + + +void ViewEditor::changeEvent(QEvent * e) { + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} + + +void ViewEditor::on_spinFOV_valueChanged(double val) { + if (!view || !active) return; + view->setFOV(val); +} + + +void ViewEditor::on_spinDepthStart_valueChanged(double val) { + if (!view || !active) return; + view->setDepthStart(val); +} + + +void ViewEditor::on_spinViewGamma_valueChanged(double val) { + if (!view || !active) return; + view->setGamma(val); +} + + +void ViewEditor::on_comboViewRenderMode_currentIndexChanged(int val) { + if (!view || !active) return; + static int modes[] = {GL_POINT, GL_LINE, GL_FILL}; + view->setRenderMode((ObjectBase::RenderMode)modes[val]); +} + + +void ViewEditor::on_groupHoverHalo_clicked(bool val) { + if (!view || !active) return; + view->setHoverHaloEnabled(val); +} + + +void ViewEditor::on_groupSelectionHalo_clicked(bool val) { + if (!view || !active) return; + view->setSelectionHaloEnabled(val); +} + + +void ViewEditor::on_spinHoverHaloFill_valueChanged(double val) { + if (!view || !active) return; + view->setHoverHaloFillAlpha(val); +} + + +void ViewEditor::on_spinSelectionHaloFill_valueChanged(double val) { + if (!view || !active) return; + view->setSelectionHaloFillAlpha(val); +} + + +void ViewEditor::on_colorHoverHalo_colorChanged(QColor color) { + if (!view || !active) return; + view->setHoverHaloColor(color); +} + + +void ViewEditor::on_colorSelectionHalo_colorChanged(QColor color) { + if (!view || !active) return; + view->setSelectionHaloColor(color); +} + + +void ViewEditor::on_checkAutoExposure_toggled(bool val) { + if (!view || !active) return; + view->setAutoExposure(val); +} + + +void ViewEditor::on_checkFXAA_clicked(bool val) { + if (!view || !active) return; + view->setFeature(QGLView::qglFXAA, val); +} + + +void ViewEditor::on_checkCameraOrbit_clicked(bool val) { + if (!view || !active) return; + view->setCameraOrbit(val); +} + + +void ViewEditor::on_checkCameraLight_clicked(bool val) { + if (!view || !active) return; + view->setCameraLightOn(val); +} + + +void ViewEditor::on_checkService_clicked(bool val) { + if (!view || !active) return; + view->setServiceMode(val); +} diff --git a/qglengine/widgets/view_editor.h b/qglengine/widgets/view_editor.h new file mode 100644 index 0000000..b6d1472 --- /dev/null +++ b/qglengine/widgets/view_editor.h @@ -0,0 +1,65 @@ +/* + QGLView + Copyright (C) 2019 Ivan Pelipenko peri4ko@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef VIEW_EDITOR_H +#define VIEW_EDITOR_H + +#include +#include "qglview.h" + +namespace Ui { + class ViewEditor; +} + +class ViewEditor: public QWidget +{ + Q_OBJECT +public: + explicit ViewEditor(QWidget * parent = 0); + + void assignQGLView(QGLView * v); + +protected: + void changeEvent(QEvent * e); + + Ui::ViewEditor * ui; + QGLView * view; + bool active; + +private slots: + void on_spinFOV_valueChanged(double val); + void on_spinDepthStart_valueChanged(double val); + void on_spinViewGamma_valueChanged(double val); + void on_comboViewRenderMode_currentIndexChanged(int val); + void on_groupHoverHalo_clicked(bool val); + void on_groupSelectionHalo_clicked(bool val); + void on_spinHoverHaloFill_valueChanged(double val); + void on_spinSelectionHaloFill_valueChanged(double val); + void on_colorHoverHalo_colorChanged(QColor color); + void on_colorSelectionHalo_colorChanged(QColor color); + void on_checkAutoExposure_toggled(bool val); + void on_checkFXAA_clicked(bool val); + void on_checkCameraOrbit_clicked(bool val); + void on_checkCameraLight_clicked(bool val); + void on_checkService_clicked(bool val); + +signals: + +}; + +#endif // VIEW_EDITOR_H diff --git a/qglengine/widgets/view_editor.ui b/qglengine/widgets/view_editor.ui new file mode 100644 index 0000000..1a711b7 --- /dev/null +++ b/qglengine/widgets/view_editor.ui @@ -0,0 +1,473 @@ + + + ViewEditor + + + + 0 + 0 + 328 + 538 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Draw mode: + + + + + + + 2 + + + + Point + + + + + Wireframe + + + + + Solid + + + + + + + + + + + + + FXAA + + + + + + + Auto exposure + + + true + + + + + + + Service mode + + + true + + + + + + + + + Camera + + + + + + Gamma: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 0.010000000000000 + + + 5.000000000000000 + + + 1.000000000000000 + + + 2 + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 20 + 1 + + + + + + + + FOV: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + CamLight + + + true + + + + + + + 0.100000000000000 + + + 179.900000000000006 + + + 60.000000000000000 + + + + + + + Orbit + + + true + + + + + + + Depth start: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 3 + + + 999999999.000000000000000 + + + QAbstractSpinBox::AdaptiveDecimalStepType + + + 1.000000000000000 + + + + + + + + + + Hover halo + + + true + + + + + + Fill: + + + + + + + 0.000000000000000 + + + 1.000000000000000 + + + 0.300000000000000 + + + 2 + + + 0.050000000000000 + + + 0.100000000000000 + + + + + + + + 255 + 0 + 251 + + + + true + + + + + + + + + + Selection halo + + + true + + + + + + Fill: + + + + + + + 0.000000000000000 + + + 1.000000000000000 + + + 0.300000000000000 + + + 2 + + + 0.050000000000000 + + + 0.100000000000000 + + + + + + + + 0 + 143 + 239 + + + + true + + + + + + + + + + + + + 0 + 0 + + + + Fog + + + + QFormLayout::AllNonFixedFieldsGrow + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + Density: + + + + + + + + + 0.000000000000000 + + + 10.000000000000000 + + + 0.000000000000000 + + + 3 + + + 0.050000000000000 + + + 0.100000000000000 + + + + + + + + 128 + 128 + 128 + + + + + + + + + + Decay: + + + + + + + 0.000000000000000 + + + 9999.000000000000000 + + + 10.000000000000000 + + + 2 + + + 0.050000000000000 + + + 0.100000000000000 + + + true + + + 9999.000000000000000 + + + + + + + + + + + + Qt::Vertical + + + + 20 + 1 + + + + + + + + + SpinSlider + QWidget +
spinslider.h
+
+ + ColorButton + QPushButton +
colorbutton.h
+
+
+ + +