delete GLView crash fix
fixed fog/background color, now not x2 amplified fixed bug when no shadows enabled on start (sum with fog on geometry)
This commit is contained in:
@@ -196,6 +196,9 @@ inline QColor operator/(const QColor & c, float v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline QVector4D color2vector(const QColor & c) {
|
||||||
|
return QVector4D(c.redF(), c.greenF(), c.blueF(), c.alphaF());
|
||||||
|
}
|
||||||
inline void qglColor(const QColor & c) {
|
inline void qglColor(const QColor & c) {
|
||||||
glColor4f(c.redF(), c.greenF(), c.blueF(), c.alphaF());
|
glColor4f(c.redF(), c.greenF(), c.blueF(), c.alphaF());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -223,6 +223,10 @@ void Renderer::initShaders() {
|
|||||||
prog->setUniformValue("tex_coeff_brdf", trCoeffBRDF);
|
prog->setUniformValue("tex_coeff_brdf", trCoeffBRDF);
|
||||||
prog->setUniformValue("tex_env", trEnvironment);
|
prog->setUniformValue("tex_env", trEnvironment);
|
||||||
setUniformMaps(prog);
|
setUniformMaps(prog);
|
||||||
|
prog->setUniformValue("tex_shadows_cone", (int)tarShadowsCone);
|
||||||
|
prog->setUniformValue("tex_shadows_omni", (int)tarShadowsOmni);
|
||||||
|
prog->setUniformValue("tex_depths_cone", (int)tarDepthsCone);
|
||||||
|
prog->setUniformValue("tex_depths_omni", (int)tarDepthsOmni);
|
||||||
}
|
}
|
||||||
if (bindShader(srFinalPass, &prog)) {
|
if (bindShader(srFinalPass, &prog)) {
|
||||||
prog->setUniformValue("tex_g1", 0);
|
prog->setUniformValue("tex_g1", 0);
|
||||||
@@ -345,12 +349,13 @@ void Renderer::renderLight(int first_wr_buff, bool clear_only) {
|
|||||||
}*/
|
}*/
|
||||||
fbo_out.setWriteBuffer(first_wr_buff + pass.second);
|
fbo_out.setWriteBuffer(first_wr_buff + pass.second);
|
||||||
glClearFramebuffer(back, false);
|
glClearFramebuffer(back, false);
|
||||||
|
back = QColor(0, 0, 0, 0);
|
||||||
if (clear_only) continue;
|
if (clear_only) continue;
|
||||||
setUniformCamera(prog, cam);
|
setUniformCamera(prog, cam);
|
||||||
setUniformViewCorners(prog, cam);
|
setUniformViewCorners(prog, cam);
|
||||||
prog->setUniformValue("lights_start", lights_start[pass.second]);
|
prog->setUniformValue("lights_start", lights_start[pass.second]);
|
||||||
prog->setUniformValue("lights_count", (int)cur_lights[pass.second].size());
|
prog->setUniformValue("lights_count", (int)cur_lights[pass.second].size());
|
||||||
prog->setUniformValue("fog_color", view->fogColor());
|
prog->setUniformValue("fog_color", color2vector(view->fogColor()) / 2.);
|
||||||
prog->setUniformValue("fog_decay", qMax(view->fogDecay(), 0.001f));
|
prog->setUniformValue("fog_decay", qMax(view->fogDecay(), 0.001f));
|
||||||
prog->setUniformValue("fog_density", view->fogDensity());
|
prog->setUniformValue("fog_density", view->fogDensity());
|
||||||
prog->setUniformValue("view_mat", cam->viewMatrix().inverted().toGenericMatrix<3, 3>());
|
prog->setUniformValue("view_mat", cam->viewMatrix().inverted().toGenericMatrix<3, 3>());
|
||||||
@@ -361,10 +366,6 @@ void Renderer::renderLight(int first_wr_buff, bool clear_only) {
|
|||||||
prog->setUniformValue("soft_shadows_enabled", view->soft_shadows);
|
prog->setUniformValue("soft_shadows_enabled", view->soft_shadows);
|
||||||
prog->setUniformValue("soft_shadows_samples", view->soft_shadows_samples);
|
prog->setUniformValue("soft_shadows_samples", view->soft_shadows_samples);
|
||||||
prog->setUniformValue("soft_shadows_quality", view->soft_shadows_quality);
|
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);
|
|
||||||
prog->setUniformValue("tex_depths_omni", (int)tarDepthsOmni);
|
|
||||||
GLenum filter = view->softShadows() ? GL_NEAREST : GL_LINEAR;
|
GLenum filter = view->softShadows() ? GL_NEAREST : GL_LINEAR;
|
||||||
shadow_maps_cone.bind(view, tarShadowsCone);
|
shadow_maps_cone.bind(view, tarShadowsCone);
|
||||||
view->glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, filter);
|
view->glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, filter);
|
||||||
|
|||||||
@@ -103,7 +103,6 @@ QGLView::QGLView(): OpenGLWindow(), renderer_(this), mouse(this) {
|
|||||||
|
|
||||||
QGLView::~QGLView() {
|
QGLView::~QGLView() {
|
||||||
stop();
|
stop();
|
||||||
scene_->clear();
|
|
||||||
delete scene_;
|
delete scene_;
|
||||||
delete default_camera;
|
delete default_camera;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,6 @@ QGLViewWindow::QGLViewWindow(QWidget * parent): QMainWindow(parent), Ui::QGLView
|
|||||||
spinDOFDiaphragm->setValue(view->view()->feature(QGLView::qglDepthOfFieldDiaphragm).toDouble());
|
spinDOFDiaphragm->setValue(view->view()->feature(QGLView::qglDepthOfFieldDiaphragm).toDouble());
|
||||||
spinDOFSpeed->setValue(view->view()->feature(QGLView::qglDepthOfFieldAutoFocusSpeed).toDouble());
|
spinDOFSpeed->setValue(view->view()->feature(QGLView::qglDepthOfFieldAutoFocusSpeed).toDouble());
|
||||||
*/
|
*/
|
||||||
view->view()->start(-1);
|
|
||||||
startTimer(1000 / 60);
|
startTimer(1000 / 60);
|
||||||
|
|
||||||
connect(view->view(), SIGNAL(keyEvent(Qt::Key, Qt::KeyboardModifiers)), this, SLOT(view_keyEvent(Qt::Key, Qt::KeyboardModifiers)));
|
connect(view->view(), SIGNAL(keyEvent(Qt::Key, Qt::KeyboardModifiers)), this, SLOT(view_keyEvent(Qt::Key, Qt::KeyboardModifiers)));
|
||||||
@@ -140,6 +139,7 @@ QGLViewWindow::QGLViewWindow(QWidget * parent): QMainWindow(parent), Ui::QGLView
|
|||||||
auto * o = primitiveEditor->createCurrent();
|
auto * o = primitiveEditor->createCurrent();
|
||||||
o->calculateBoundingBox();
|
o->calculateBoundingBox();
|
||||||
view->view()->focusOn(o->boundingBox());
|
view->view()->focusOn(o->boundingBox());
|
||||||
|
view->view()->start(-1);
|
||||||
|
|
||||||
session.load();
|
session.load();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user