nvidia fix, soft shadows

This commit is contained in:
2023-02-13 18:35:25 +03:00
parent c8dcd5e9c0
commit 36540468dc
17 changed files with 358 additions and 107 deletions

View File

@@ -51,7 +51,7 @@ ObjectEditor::ObjectEditor(QWidget * parent): QWidget(parent) {
ol.clear();
ol << ui->spinLightIntensity << ui->spinLightDecayConst << ui->spinLightDecayLinear << ui->spinLightDecayQuadratic
<< ui->spinLightAngleStart << ui->spinLightAngleEnd << ui->spinAimDist;
<< ui->spinLightAngleStart << ui->spinLightAngleEnd << ui->spinAimDist << ui->spinLightSize;
foreach(QObject * o, ol)
connect(o, SIGNAL(valueChanged(double)), this, SLOT(spinLightChanged(double)));
@@ -153,6 +153,7 @@ void ObjectEditor::setObject(ObjectBase * o) {
ui->spinLightDecayQuadratic->setValue(l->decay_quadratic);
ui->spinLightAngleStart->setValue(l->angle_start);
ui->spinLightAngleEnd->setValue(l->angle_end);
ui->spinLightSize->setValue(l->size);
ui->spinAimDist->setValue(l->distance());
on_comboLightType_currentIndexChanged(ui->comboLightType->currentIndex());
}
@@ -253,6 +254,7 @@ void ObjectEditor::spinLightChanged(double v) {
if (s == ui->spinLightAngleStart) o->angle_start = v;
if (s == ui->spinLightAngleEnd) o->angle_end = v;
if (s == ui->spinAimDist) o->setDistance(v);
if (s == ui->spinLightSize) o->size = v;
o->apply();
}
ignore_next = true;

View File

@@ -60,9 +60,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<y>-287</y>
<width>444</width>
<height>1047</height>
<height>1081</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
@@ -700,13 +700,48 @@
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_19">
<property name="text">
<string>Size:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="SpinSlider" name="spinLightSize">
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>999.000000000000000</double>
</property>
<property name="value">
<double>0.100000000000000</double>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="pageStep">
<double>1.000000000000000</double>
</property>
<property name="squareScale">
<bool>true</bool>
</property>
<property name="spinMaximum">
<double>999.000000000000000</double>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="labelLightAngle">
<property name="text">
<string>Angle:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">

View File

@@ -30,12 +30,15 @@ ViewEditor::ViewEditor(QWidget * parent): QWidget(parent) {
ui->setupUi(this);
ui->scrollArea->viewport()->setAutoFillBackground(false);
ui->scrollAreaWidgetContents->setAutoFillBackground(false);
view = nullptr;
active = true;
ui->checkCameraLight->setCheckState(Qt::PartiallyChecked);
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
ui->spinDepthStart->setStepType(QAbstractSpinBox::AdaptiveDecimalStepType);
#endif
for (int i = 6; i <= 13; ++i) {
QSize sz(pow2(i), pow2(i));
ui->comboMapSizeTexture->addItem(QString::number(sz.width()), sz);
ui->comboMapSizeShadow->addItem(QString::number(sz.width()), sz);
}
}
@@ -45,8 +48,8 @@ void ViewEditor::assignQGLView(QGLView * v) {
active = false;
ui->spinFOV->setValue(view->FOV());
ui->spinDepthStart->setValue(view->depthStart());
ui->groupHoverHalo->setChecked(view->isHoverHaloEnabled());
ui->groupSelectionHalo->setChecked(view->isSelectionHaloEnabled());
ui->checkHoverHalo->setChecked(view->isHoverHaloEnabled());
ui->checkSelectionHalo->setChecked(view->isSelectionHaloEnabled());
ui->spinHoverHaloFill->setValue(view->hoverHaloFillAlpha());
ui->spinSelectionHaloFill->setValue(view->selectionHaloFillAlpha());
ui->colorHoverHalo->setColor(view->hoverHaloColor());
@@ -61,6 +64,18 @@ void ViewEditor::assignQGLView(QGLView * v) {
ui->colorFogBack->setColor(view->fogColor());
ui->spinFogDecay->setValue(view->fogDecay());
ui->spinFogDensity->setValue(view->fogDensity());
ui->checkSoftShadows->setChecked(view->softShadows());
ui->spinSoftShadowSamples->setValue(view->softShadowsSamples());
auto setMapSize = [](QComboBox * combo, QSize sz) {
for (int i = 0; i < combo->count(); ++i) {
if (combo->itemData(i).toSize() == sz) {
combo->setCurrentIndex(i);
break;
}
}
};
setMapSize(ui->comboMapSizeTexture, view->textureMapSize());
setMapSize(ui->comboMapSizeShadow, view->shadowMapSize());
active = true;
}
@@ -99,13 +114,20 @@ void ViewEditor::on_comboViewRenderMode_currentIndexChanged(int val) {
}
void ViewEditor::on_groupHoverHalo_clicked(bool val) {
void ViewEditor::on_groupHalos_clicked(bool val) {
if (!view || !active) return;
view->setHoverHaloEnabled(val && ui->checkHoverHalo->isChecked());
view->setSelectionHaloEnabled(val && ui->checkSelectionHalo->isChecked());
}
void ViewEditor::on_checkHoverHalo_clicked(bool val) {
if (!view || !active) return;
view->setHoverHaloEnabled(val);
}
void ViewEditor::on_groupSelectionHalo_clicked(bool val) {
void ViewEditor::on_checkSelectionHalo_clicked(bool val) {
if (!view || !active) return;
view->setSelectionHaloEnabled(val);
}
@@ -201,6 +223,30 @@ void ViewEditor::on_spinFogDecay_valueChanged(double arg1) {
}
void ViewEditor::on_comboMapSizeTexture_currentIndexChanged(int index) {
if (!view || !active) return;
view->setTextureMapSize(ui->comboMapSizeTexture->itemData(index).toSize());
}
void ViewEditor::on_comboMapSizeShadow_currentIndexChanged(int index) {
if (!view || !active) return;
view->setShadowMapSize(ui->comboMapSizeShadow->itemData(index).toSize());
}
void ViewEditor::on_checkSoftShadows_clicked(bool arg1) {
if (!view || !active) return;
view->setSoftShadows(arg1);
}
void ViewEditor::on_spinSoftShadowSamples_valueChanged(double arg1) {
if (!view || !active) return;
view->setSoftShadowsSamples(arg1);
}
void ViewEditor::on_checkVSync_clicked(bool val) {
if (!view || !active) return;
view->setVSync(val);

View File

@@ -39,16 +39,17 @@ protected:
void changeEvent(QEvent * e);
Ui::ViewEditor * ui;
QGLView * view;
bool active;
QGLView * view = nullptr;
bool active = true;
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_groupHalos_clicked(bool val);
void on_checkHoverHalo_clicked(bool val);
void on_checkSelectionHalo_clicked(bool val);
void on_spinHoverHaloFill_valueChanged(double val);
void on_spinSelectionHaloFill_valueChanged(double val);
void on_colorHoverHalo_colorChanged(QColor color);
@@ -64,6 +65,10 @@ private slots:
void on_colorFogBack_colorChanged(const QColor & color);
void on_spinFogDensity_valueChanged(double arg1);
void on_spinFogDecay_valueChanged(double arg1);
void on_comboMapSizeTexture_currentIndexChanged(int index);
void on_comboMapSizeShadow_currentIndexChanged(int index);
void on_checkSoftShadows_clicked(bool arg1);
void on_spinSoftShadowSamples_valueChanged(double arg1);
};
#endif // VIEW_EDITOR_H

View File

@@ -36,8 +36,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>479</width>
<height>737</height>
<width>453</width>
<height>773</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@@ -205,6 +205,43 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkSoftShadows">
<property name="text">
<string>Soft shadows</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>Soft shadow samples:</string>
</property>
</widget>
</item>
<item>
<widget class="SpinSlider" name="spinSoftShadowSamples">
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>128.000000000000000</double>
</property>
<property name="value">
<double>16.000000000000000</double>
</property>
<property name="decimals">
<number>0</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
@@ -291,22 +328,25 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupHoverHalo">
<widget class="QGroupBox" name="groupHalos">
<property name="title">
<string>Hover halo</string>
<string>Halos</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_11">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="checkHoverHalo">
<property name="text">
<string>Fill:</string>
<string>Hover:</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<item row="0" column="1">
<widget class="SpinSlider" name="spinHoverHaloFill">
<property name="minimum">
<double>0.000000000000000</double>
@@ -328,7 +368,7 @@
</property>
</widget>
</item>
<item>
<item row="0" column="2">
<widget class="ColorButton" name="colorHoverHalo">
<property name="color">
<color>
@@ -342,26 +382,17 @@
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupSelectionHalo">
<property name="title">
<string>Selection halo</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_20">
<item row="1" column="0">
<widget class="QCheckBox" name="checkSelectionHalo">
<property name="text">
<string>Fill:</string>
<string>Selection:</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<item row="1" column="1">
<widget class="SpinSlider" name="spinSelectionHaloFill">
<property name="minimum">
<double>0.000000000000000</double>
@@ -383,7 +414,7 @@
</property>
</widget>
</item>
<item>
<item row="1" column="2">
<widget class="ColorButton" name="colorSelectionHalo">
<property name="color">
<color>
@@ -417,6 +448,9 @@
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
@@ -499,7 +533,7 @@
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Color</string>
<string>Color:</string>
</property>
</widget>
</item>
@@ -508,6 +542,43 @@
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Map sizes</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Textures:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboMapSizeTexture">
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Shadows:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboMapSizeShadow">
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">