soft shadows fixes
This commit is contained in:
@@ -154,7 +154,7 @@ void Renderer::reloadShaders() {
|
||||
shader_fxaa = nullptr;
|
||||
if (tone_proc.shader_sum) delete tone_proc.shader_sum;
|
||||
tone_proc.shader_sum = nullptr;
|
||||
QString dir = ":/shaders/";
|
||||
QString dir = "./shaders/";
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
loadShadersMulti(shaders[it.key()], dir + it.value(), true, shader_defines.value(it.key()));
|
||||
@@ -348,6 +348,7 @@ void Renderer::renderLight(int first_wr_buff, bool clear_only) {
|
||||
prog->setUniformValue("noise_size", noise_size);
|
||||
prog->setUniformValue("soft_shadows_enabled", view->soft_shadows);
|
||||
prog->setUniformValue("soft_shadows_samples", view->soft_shadows_samples);
|
||||
prog->setUniformValue("soft_shadows_quality", view->soft_shadows_quality);
|
||||
prog->setUniformValue("tex_shadows_cone", (int)tarShadowsCone);
|
||||
prog->setUniformValue("tex_shadows_omni", (int)tarShadowsOmni);
|
||||
prog->setUniformValue("tex_depths_cone", (int)tarDepthsCone);
|
||||
|
||||
@@ -43,7 +43,8 @@ QGLView::QGLView(): OpenGLWindow(), renderer_(this), mouse(this) {
|
||||
shaders_supported = false;
|
||||
FXAA_ = false;
|
||||
fps_cnt = 0;
|
||||
soft_shadows_samples = 16;
|
||||
soft_shadows_quality = 1.;
|
||||
soft_shadows_samples = 32;
|
||||
soft_shadows = false;
|
||||
fps_tm = fps_ = 0.;
|
||||
fogColor_ = Qt::darkGray;
|
||||
|
||||
@@ -63,6 +63,7 @@ class QGLENGINE_CORE_EXPORT QGLView
|
||||
Q_PROPERTY(QSize textureMapSize READ textureMapSize WRITE setTextureMapSize)
|
||||
Q_PROPERTY(QSize shadowMapSize READ shadowMapSize WRITE setShadowMapSize)
|
||||
Q_PROPERTY(int softShadowsSamples READ softShadowsSamples WRITE setSoftShadowsSamples)
|
||||
Q_PROPERTY(float softShadowsQuality READ softShadowsQuality WRITE setSoftShadowsQuality)
|
||||
Q_PROPERTY(bool softShadows READ softShadows WRITE setSoftShadows)
|
||||
|
||||
public:
|
||||
@@ -168,6 +169,8 @@ public:
|
||||
|
||||
int softShadowsSamples() const { return soft_shadows_samples; }
|
||||
void setSoftShadowsSamples(int s) { soft_shadows_samples = s; }
|
||||
float softShadowsQuality() const { return soft_shadows_quality; }
|
||||
void setSoftShadowsQuality(float s) { soft_shadows_quality = s; }
|
||||
bool softShadows() const { return soft_shadows; }
|
||||
void setSoftShadows(bool on) { soft_shadows = on; }
|
||||
|
||||
@@ -208,7 +211,7 @@ private:
|
||||
GLint max_anisotropic, max_texture_chanels;
|
||||
RenderMode render_mode;
|
||||
QSize prev_size, shadow_map_size;
|
||||
float lineWidth_;
|
||||
float lineWidth_, soft_shadows_quality;
|
||||
float fps_, fps_tm, fogDensity_, fogDecay_;
|
||||
float hoverHaloFill_, selectionHaloFill_, m_motionBlurFactor;
|
||||
int timer, fps_cnt, sh_id_loc, soft_shadows_samples;
|
||||
|
||||
@@ -66,6 +66,7 @@ void ViewEditor::assignQGLView(QGLView * v) {
|
||||
ui->spinFogDensity->setValue(view->fogDensity());
|
||||
ui->checkSoftShadows->setChecked(view->softShadows());
|
||||
ui->spinSoftShadowSamples->setValue(view->softShadowsSamples());
|
||||
ui->spinSoftShadowQuality->setValue(view->softShadowsQuality());
|
||||
auto setMapSize = [](QComboBox * combo, QSize sz) {
|
||||
for (int i = 0; i < combo->count(); ++i) {
|
||||
if (combo->itemData(i).toSize() == sz) {
|
||||
@@ -247,6 +248,12 @@ void ViewEditor::on_spinSoftShadowSamples_valueChanged(double arg1) {
|
||||
}
|
||||
|
||||
|
||||
void ViewEditor::on_spinSoftShadowQuality_valueChanged(double arg1) {
|
||||
if (!view || !active) return;
|
||||
view->setSoftShadowsQuality(arg1);
|
||||
}
|
||||
|
||||
|
||||
void ViewEditor::on_checkVSync_clicked(bool val) {
|
||||
if (!view || !active) return;
|
||||
view->setVSync(val);
|
||||
|
||||
@@ -69,6 +69,7 @@ private slots:
|
||||
void on_comboMapSizeShadow_currentIndexChanged(int index);
|
||||
void on_checkSoftShadows_clicked(bool arg1);
|
||||
void on_spinSoftShadowSamples_valueChanged(double arg1);
|
||||
void on_spinSoftShadowQuality_valueChanged(double arg1);
|
||||
};
|
||||
|
||||
#endif // VIEW_EDITOR_H
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>453</width>
|
||||
<height>773</height>
|
||||
<height>807</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@@ -218,30 +218,56 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Soft shadow samples:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="1">
|
||||
<widget class="SpinSlider" name="spinSoftShadowSamples">
|
||||
<property name="minimum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>128.000000000000000</double>
|
||||
<double>256.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>16.000000000000000</double>
|
||||
<double>32.000000000000000</double>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Soft shadow quality:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="SpinSlider" name="spinSoftShadowQuality">
|
||||
<property name="minimum">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
Reference in New Issue
Block a user