From 2156e1d3e9ebd77f472facad31fdf5e13dd92e18 Mon Sep 17 00:00:00 2001 From: peri4 Date: Wed, 6 Sep 2023 20:50:14 +0300 Subject: [PATCH] ViewEditor and QGLView camera parameters now saved and applied only to default camera --- src/core/view/qglview.cpp | 2 ++ src/core/view/qglview.h | 8 ++++---- src/core/view/qglview_settings.h | 3 +++ src/widgets/object_editor.ui | 10 ++++++++-- src/widgets/view_editor.ui | 5 ++++- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/core/view/qglview.cpp b/src/core/view/qglview.cpp index 41bf210..f4ba215 100644 --- a/src/core/view/qglview.cpp +++ b/src/core/view/qglview.cpp @@ -145,6 +145,8 @@ void QGLView::render() { emit glBeginPaint(); glPointSize(settings.lineWidth); glLineWidth(settings.lineWidth); + default_camera->setDepthStart(settings.depthStart); + default_camera->setFOV(settings.FOV); QSizeF fbo_sz = renderer_.fbo_ds.size(); renderer_.rend_selection.size_coeff = {double(fbo_sz.width()) / pixelWidth(), double(fbo_sz.height()) / pixelHeight()}; renderer_.mouse_pos = mapFromGlobal(QCursor::pos()) * devicePixelRatio(); diff --git a/src/core/view/qglview.h b/src/core/view/qglview.h index 0b31faf..252db23 100644 --- a/src/core/view/qglview.h +++ b/src/core/view/qglview.h @@ -87,8 +87,8 @@ public: void start(float freq = 0.); float lineWidth() const { return settings.lineWidth; } - float FOV() const { return camera()->FOV(); } - float depthStart() const { return camera()->depthStart(); } + float FOV() const { return settings.FOV; } + float depthStart() const { return settings.depthStart; } float currentFPS() const { return fps_; } float gamma() const { return settings.gamma; } bool autoExposure() const { return settings.autoExposure; } @@ -236,8 +236,8 @@ private slots: public slots: void setLineWidth(const float & arg) { settings.lineWidth = arg; } - void setFOV(const float & arg) { camera()->setFOV(arg); } - void setDepthStart(const float & arg) { camera()->setDepthStart(arg); } + void setFOV(const float & arg) { settings.FOV = arg; } + void setDepthStart(const float & arg) { settings.depthStart = arg; } void setGamma(const float & arg) { settings.gamma = arg; } void setAutoExposure(bool arg) { settings.autoExposure = arg; } void setEnvironmentMapFile(QString file) { diff --git a/src/core/view/qglview_settings.h b/src/core/view/qglview_settings.h index 690ec22..a91ce38 100644 --- a/src/core/view/qglview_settings.h +++ b/src/core/view/qglview_settings.h @@ -51,6 +51,9 @@ struct QGLENGINE_CORE_EXPORT QGLViewSettings { ID(17) float gamma = 1.f; ID(18) bool autoExposure = false; + + ID(19) float depthStart = 0.1f; + ID(20) float FOV = 60.f; }; #undef ID diff --git a/src/widgets/object_editor.ui b/src/widgets/object_editor.ui index 5c00aef..e5fd5b3 100644 --- a/src/widgets/object_editor.ui +++ b/src/widgets/object_editor.ui @@ -60,7 +60,7 @@ 0 - -300 + -306 444 1100 @@ -847,6 +847,9 @@ 999999999.000000000000000 + + 0.010000000000000 + 0.100000000000000 @@ -874,7 +877,7 @@ 1 - 5.000000000000000 + 1.000000000000000 30.000000000000000 @@ -966,6 +969,9 @@ ColorButton QPushButton
colorbutton.h
+ + colorChanged(QColor) + ScrollSpinBox diff --git a/src/widgets/view_editor.ui b/src/widgets/view_editor.ui index f4565df..3e1114e 100644 --- a/src/widgets/view_editor.ui +++ b/src/widgets/view_editor.ui @@ -443,8 +443,11 @@ 999999999.000000000000000 + + 0.010000000000000 + - 1.000000000000000 + 0.100000000000000