添加调整主光源强度的滑动条,场景渲染中四个滑动条分别对应光强、光Pitch角、光Yaw角、曝光
parent
00b04fc33c
commit
645797f8f5
|
@ -165,6 +165,19 @@
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>12</number>
|
<number>12</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QSlider" name="lightRadianceSlider">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>600</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSlider" name="horizontalSlider">
|
<widget class="QSlider" name="horizontalSlider">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
using namespace Renderer;
|
using namespace Renderer;
|
||||||
|
|
||||||
QVector3D mainLightRadiance = 40 * QVector3D(0.7529, 0.7450, 0.6784).normalized();
|
QVector3D mainLightRadiance = 10 * QVector3D(0.7529, 0.7450, 0.6784).normalized();
|
||||||
static float sunPitch = 105, sunYaw = 80;
|
static float sunPitch = 105, sunYaw = 80;
|
||||||
static int sunSpeed = 10;
|
static int sunSpeed = 10;
|
||||||
|
|
||||||
|
@ -89,6 +89,11 @@ void RendererGLWidget::setModel(QString path)
|
||||||
doneCurrent();
|
doneCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Renderer::RendererGLWidget::setMainLightRadiance(QVector3D radiance)
|
||||||
|
{
|
||||||
|
mainLightRadiance = radiance;
|
||||||
|
}
|
||||||
|
|
||||||
void RendererGLWidget::setMainLightPitch(float pitch)
|
void RendererGLWidget::setMainLightPitch(float pitch)
|
||||||
{
|
{
|
||||||
//qDebug() << "pitch" << pitch;
|
//qDebug() << "pitch" << pitch;
|
||||||
|
@ -344,30 +349,34 @@ void RendererGLWidget::paintGL()
|
||||||
if (model != nullptr)
|
if (model != nullptr)
|
||||||
model->draw();
|
model->draw();
|
||||||
|
|
||||||
//plainProgramPtr->bind();
|
/// Debug Lighting
|
||||||
//plainProgramPtr->setUniformValue("projection", projection);
|
if (false)
|
||||||
//plainProgramPtr->setUniformValue("view", view);
|
{
|
||||||
//plainProgramPtr->setUniformValue("albedo", 0.5f, 0.5f, 0.5f);
|
plainProgramPtr->bind();
|
||||||
//QMatrix4x4 model;
|
plainProgramPtr->setUniformValue("projection", projection);
|
||||||
//int nrRows = 7, nrColumns = 7;
|
plainProgramPtr->setUniformValue("view", view);
|
||||||
//float spacing = 2.5;
|
plainProgramPtr->setUniformValue("albedo", 0.5f, 0.5f, 0.5f);
|
||||||
//for (int row = 0; row < nrRows; ++row)
|
QMatrix4x4 model;
|
||||||
//{
|
int nrRows = 7, nrColumns = 7;
|
||||||
// plainProgramPtr->setUniformValue("metallic", (float)row / (float)nrRows);
|
float spacing = 2.5;
|
||||||
// for (int col = 0; col < nrColumns; ++col)
|
for (int row = 0; row < nrRows; ++row)
|
||||||
// {
|
{
|
||||||
// plainProgramPtr->setUniformValue("roughness", glm::clamp((float)col / (float)nrColumns, 0.05f, 1.0f));
|
plainProgramPtr->setUniformValue("metallic", (float)row / (float)nrRows);
|
||||||
|
for (int col = 0; col < nrColumns; ++col)
|
||||||
|
{
|
||||||
|
plainProgramPtr->setUniformValue("roughness", glm::clamp((float)col / (float)nrColumns, 0.05f, 1.0f));
|
||||||
|
|
||||||
// model.setToIdentity();
|
model.setToIdentity();
|
||||||
// model.scale(10);
|
model.scale(10);
|
||||||
// model.translate(QVector3D((float)(col - (nrColumns / 2)) * spacing,
|
model.translate(QVector3D((float)(col - (nrColumns / 2)) * spacing,
|
||||||
// (float)(row - (nrRows / 2)) * spacing + 20,
|
(float)(row - (nrRows / 2)) * spacing + 20,
|
||||||
// -2.0f));
|
-2.0f));
|
||||||
// plainProgramPtr->setUniformValue("model", model);
|
plainProgramPtr->setUniformValue("model", model);
|
||||||
// IblUtils::renderSphere(glFunc);
|
IblUtils::renderSphere(glFunc);
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
//plainProgramPtr->release();
|
plainProgramPtr->release();
|
||||||
|
}
|
||||||
|
|
||||||
pageIdDownsampleProgramPtr->bind();
|
pageIdDownsampleProgramPtr->bind();
|
||||||
gl->BindImageTexture(3, gbuffers[4], 0, GL_FALSE, 0, GL_READ_WRITE, GL_RG16UI);
|
gl->BindImageTexture(3, gbuffers[4], 0, GL_FALSE, 0, GL_READ_WRITE, GL_RG16UI);
|
||||||
|
|
|
@ -29,6 +29,7 @@ namespace Renderer
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setModel(QString path);
|
void setModel(QString path);
|
||||||
|
void setMainLightRadiance(QVector3D radiance);
|
||||||
void setMainLightPitch(float pitch);
|
void setMainLightPitch(float pitch);
|
||||||
void setMainLightYaw(float yaw);
|
void setMainLightYaw(float yaw);
|
||||||
void setExposure(float exposure);
|
void setExposure(float exposure);
|
||||||
|
|
|
@ -64,6 +64,9 @@ Renderer::RendererWidget::RendererWidget(QWidget* parent)
|
||||||
emit openPaintingFile(paintingPath);
|
emit openPaintingFile(paintingPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QObject::connect(ui.lightRadianceSlider, &QSlider::valueChanged, [&](int value) {
|
||||||
|
ui.openGLWidget->setMainLightRadiance(value / 10.f * QVector3D(0.7529, 0.7450, 0.6784).normalized());
|
||||||
|
});
|
||||||
QObject::connect(ui.horizontalSlider, &QSlider::valueChanged,
|
QObject::connect(ui.horizontalSlider, &QSlider::valueChanged,
|
||||||
ui.openGLWidget, &Renderer::RendererGLWidget::setMainLightPitch);
|
ui.openGLWidget, &Renderer::RendererGLWidget::setMainLightPitch);
|
||||||
QObject::connect(ui.horizontalSlider_2, &QSlider::valueChanged,
|
QObject::connect(ui.horizontalSlider_2, &QSlider::valueChanged,
|
||||||
|
@ -71,6 +74,7 @@ Renderer::RendererWidget::RendererWidget(QWidget* parent)
|
||||||
QObject::connect(ui.exposureSlider, &QSlider::valueChanged, [&](int value) {
|
QObject::connect(ui.exposureSlider, &QSlider::valueChanged, [&](int value) {
|
||||||
ui.openGLWidget->setExposure(value / 100.f);
|
ui.openGLWidget->setExposure(value / 100.f);
|
||||||
});
|
});
|
||||||
|
ui.lightRadianceSlider->setValue(100);
|
||||||
ui.horizontalSlider->setValue(105);
|
ui.horizontalSlider->setValue(105);
|
||||||
ui.horizontalSlider_2->setValue(80);
|
ui.horizontalSlider_2->setValue(80);
|
||||||
ui.exposureSlider->setValue(60);
|
ui.exposureSlider->setValue(60);
|
||||||
|
|
Loading…
Reference in New Issue