git-svn-id: svn://db.shs.com.ru/libs@605 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2019-10-07 15:51:43 +00:00
parent 8556e28984
commit c0c11def52
21 changed files with 748 additions and 612 deletions

View File

@@ -116,8 +116,9 @@ void GLFramebuffer::release() {
void GLFramebuffer::setWriteBuffer(int index) { void GLFramebuffer::setWriteBuffer(int index) {
//QVector<GLenum> buffers; buffers << GL_COLOR_ATTACHMENT0 + index; //QVector<GLenum> buffers; buffers << GL_COLOR_ATTACHMENT0 + index;
glDrawBuffer(GL_COLOR_ATTACHMENT0 + index); GLenum e = GL_COLOR_ATTACHMENT0 + index;
//glDrawBuffers(buffers.size(), buffers.constData()); glDrawBuffer(e);
//glDrawBuffers(1, &e);
} }

View File

@@ -116,7 +116,7 @@ QString loadShaderFile(QOpenGLShaderProgram * prog, QOpenGLShader::ShaderType ty
all.insert(ip + 1, qgl_uniform); all.insert(ip + 1, qgl_uniform);
} }
prog->addShaderFromSourceCode(type, all); prog->addShaderFromSourceCode(type, all);
// qDebug() << "********" << all; //qDebug() << "********" << all;
return all; return all;
} }

View File

@@ -53,41 +53,51 @@ QString findFile(const QString & file, const QStringList & pathes) {
} }
void quadProgPoint(QOpenGLFunctions * glFuncs, QOpenGLShaderProgram * prog, QVector4D * corner_dirs,
GLfloat x, GLfloat y, GLfloat tx, GLfloat ty, int locv, int loct, int locc, int index) {
if (prog) {
if (corner_dirs)
prog->setAttributeValue(locc, corner_dirs[index]);
glFuncs->glVertexAttrib2f(loct, tx, ty);
glFuncs->glVertexAttrib2f(locv, x, y);
} else {
glTexCoord2f(tx, ty);
glVertex2f(x, y);
}
}
void glDrawQuad(QOpenGLShaderProgram * prog, QVector4D * corner_dirs, GLfloat x, GLfloat y, GLfloat w, GLfloat h) { void glDrawQuad(QOpenGLShaderProgram * prog, QVector4D * corner_dirs, GLfloat x, GLfloat y, GLfloat w, GLfloat h) {
glResetAllTransforms(); glResetAllTransforms();
glSetPolygonMode(GL_FILL); glSetPolygonMode(GL_FILL);
glDisable(GL_LIGHTING);
glEnable(GL_TEXTURE_2D);
int loc = prog ? prog->attributeLocation("qgl_Color") : -1, int loc = prog ? prog->attributeLocation("qgl_Color") : -1,
locv = prog ? prog->attributeLocation("qgl_Vertex") : -1, locv = prog ? prog->attributeLocation("qgl_Vertex") : -1,
loct = prog ? prog->attributeLocation("qgl_Texture") : -1, loct = prog ? prog->attributeLocation("qgl_Texture") : -1,
locc = prog ? prog->attributeLocation("view_corner") : -1; locc = prog ? prog->attributeLocation("view_corner") : -1;
//if (prog) {qDebug() << locv << loct << locc;}
QOpenGLFunctions * glFuncs = QOpenGLContext::currentContext()->functions();
if (prog) { if (prog) {
static const GLfloat cols [] = {1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f};
static const GLfloat verts[] = {x, y, x+w, y, x, y+h, x+w, y+h};
static const GLfloat texs [] = {0.f, 0.f, 1.f, 0.f, 0.f, 1.f, 1.f, 1.f};
GLfloat vcs[] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f};
if (corner_dirs) {
vcs[0] = corner_dirs[0].x(); vcs[1] = corner_dirs[0].y(); vcs[2] = corner_dirs[0].z();
vcs[3] = corner_dirs[1].x(); vcs[4] = corner_dirs[1].y(); vcs[5] = corner_dirs[1].z();
vcs[6] = corner_dirs[2].x(); vcs[7] = corner_dirs[2].y(); vcs[8] = corner_dirs[2].z();
vcs[9] = corner_dirs[3].x(); vcs[10] = corner_dirs[3].y(); vcs[11] = corner_dirs[3].z();
}
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glFuncs->glBindBuffer(GL_ARRAY_BUFFER, 0);
glFuncs->glEnableVertexAttribArray(loc);
glFuncs->glVertexAttribPointer(loc, 3, GL_FLOAT, 0, 0, cols);
glFuncs->glEnableVertexAttribArray(locv);
glFuncs->glVertexAttribPointer(locv, 2, GL_FLOAT, 0, 0, verts);
glFuncs->glEnableVertexAttribArray(loct);
glFuncs->glVertexAttribPointer(loct, 2, GL_FLOAT, 0, 0, texs);
glFuncs->glEnableVertexAttribArray(locc);
glFuncs->glVertexAttribPointer(locc, 3, GL_FLOAT, 0, 0, vcs);
glFuncs->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
} else {
glBegin(GL_TRIANGLE_STRIP);
glColor4f(1.f, 1.f, 1.f, 1.f);
glTexCoord2f(0.f, 0.f); glVertex2f(x, y);
glTexCoord2f(1.f, 0.f); glVertex2f(x+w, y);
glTexCoord2f(0.f, 1.f); glVertex2f(x, y+h);
glTexCoord2f(1.f, 1.f); glVertex2f(x+w, y+h);
glEnd();
} }
//if (prog)
//qDebug() << loc << locv << loct << locc;
glBegin(GL_QUADS);
QOpenGLFunctions *glFuncs = QOpenGLContext::currentContext()->functions();
if (prog) {
glFuncs->glVertexAttrib3f(loc, 1.f, 1.f, 1.f);
}
glColor3f(1.f, 1.f, 1.f);
quadProgPoint(glFuncs, prog, corner_dirs, x , y , 0.f, 0.f, locv, loct, locc, 0);
quadProgPoint(glFuncs, prog, corner_dirs, x+w, y , 1.f, 0.f, locv, loct, locc, 1);
quadProgPoint(glFuncs, prog, corner_dirs, x+w, y+h, 1.f, 1.f, locv, loct, locc, 2);
quadProgPoint(glFuncs, prog, corner_dirs, x , y+h, 0.f, 1.f, locv, loct, locc, 3);
glEnd();
} }

View File

@@ -31,6 +31,7 @@ QGLView::QGLView(): OpenGLWindow(), fbo_selection(3) {
// setScene(new QGraphicsScene()); // setScene(new QGraphicsScene());
// setInteractive(true); // setInteractive(true);
setIcon(QIcon("://icons/qglview.png")); setIcon(QIcon("://icons/qglview.png"));
deleting_ = false;
timer = 0; timer = 0;
need_init_ = is_first_draw = true; need_init_ = is_first_draw = true;
objects_.is_root = true; objects_.is_root = true;
@@ -106,6 +107,7 @@ QGLView::~QGLView() {
stop(); stop();
if (shader_select) delete shader_select; if (shader_select) delete shader_select;
if (shader_halo) delete shader_halo; if (shader_halo) delete shader_halo;
deleting_ = true;
} }
@@ -344,12 +346,14 @@ void QGLView::render() {
renderer_->renderScene(); renderer_->renderScene();
} }
emit glPainting(); emit glPainting();
glUseProgram(0);
if (selectionHalo_ || hoverHalo_) { if (selectionHalo_ || hoverHalo_) {
glReleaseTextures(); glReleaseTextures();
glUseProgram(0);
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
//glClearFramebuffer(Qt::black, false);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glDisable(GL_TEXTURE_CUBE_MAP); glDisable(GL_TEXTURE_CUBE_MAP);
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
@@ -363,13 +367,20 @@ void QGLView::render() {
if (hoverHalo_ && hov_obj) { if (hoverHalo_ && hov_obj) {
glBindTexture(GL_TEXTURE_2D, fbo_selection.colorTexture(1)); glBindTexture(GL_TEXTURE_2D, fbo_selection.colorTexture(1));
//qDebug() << "draw hover"; //qDebug() << "draw hover";
//glBindTexture(GL_TEXTURE_2D, textures_manager->loadTexture("batt_pn.jpg"));
glDrawQuad(); glDrawQuad();
} }
} }
glUseProgram(0);
glResetAllTransforms(); glResetAllTransforms();
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
glUseProgram(0);
//glDisable(GL_BLEND);
//glDisable(GL_LIGHTING);
//glActiveTexture(GL_TEXTURE0);
//glBindTexture(GL_TEXTURE_2D, textures_manager->loadTexture("batt_pn.jpg"));
//glDrawQuad();
emit glEndPaint(); emit glEndPaint();
@@ -457,20 +468,21 @@ void QGLView::renderHalo(const GLObjectBase * obj, const uint iid, const QColor
if (!shader_halo) return; if (!shader_halo) return;
if (!shader_halo->isLinked()) return; if (!shader_halo->isLinked()) return;
if (obj) { if (obj) {
shader_halo->bind();
shader_halo->setUniformValue("qgl_ModelViewProjectionMatrix", QMatrix4x4());
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, fbo_selection.colorTexture()); glBindTexture(GL_TEXTURE_2D, fbo_selection.colorTexture());
shader_halo->bind();
shader_halo->setUniformValue("qgl_ModelViewProjectionMatrix", QMatrix4x4());
shader_halo->setUniformValue("t0", 0); shader_halo->setUniformValue("t0", 0);
shader_halo->setUniformValue("dt", QVector2D(1.f / width(), 1.f / height())); shader_halo->setUniformValue("dt", QVector2D(1.f / width(), 1.f / height()));
shader_halo->setUniformValue("selected", QVector4D(float((iid >> 24) & 0xFF) / 255.f, shader_halo->setUniformValue("selected", QVector4D(float((iid >> 24) & 0xFF) / 255.f,
float((iid >> 16) & 0xFF) / 255.f, float((iid >> 16) & 0xFF) / 255.f,
float((iid >> 8) & 0xFF) / 255.f, float((iid >> 8) & 0xFF) / 255.f,
float(iid & 0xFF) / 255.f)); float( iid & 0xFF) / 255.f));
shader_halo->setUniformValue("color", color); shader_halo->setUniformValue("color", color);
shader_halo->setUniformValue("fill", GLfloat(fill)); shader_halo->setUniformValue("fill", GLfloat(fill));
//qDebug() << "render halo" << iid << shader_halo->log() << shader_halo->programId(); //qDebug() << "render halo" << iid << shader_halo->log() << shader_halo->programId();
glDisableDepth(); glDisableDepth();
//glClearFramebuffer(color);
glDrawQuad(shader_halo); glDrawQuad(shader_halo);
glDepthMask(GL_TRUE); glDepthMask(GL_TRUE);
//glFlush(); //glFlush();
@@ -545,9 +557,11 @@ void QGLView::collectLights() {
void QGLView::objectDeleted(GLObjectBase * o) { void QGLView::objectDeleted(GLObjectBase * o) {
if (deleting_) return;
//qDebug() << "del" << o; //qDebug() << "del" << o;
if (sel_obj == o) selectObject(nullptr); if (sel_obj == o) selectObject(nullptr);
if (hov_obj == o) hov_obj = nullptr; if (hov_obj == o) hov_obj = nullptr;
collectLights();
} }
@@ -590,8 +604,8 @@ void QGLView::checkCaps() {
void QGLView::reloadThisShaders() { void QGLView::reloadThisShaders() {
if (!shaders_supported) return; if (!shaders_supported) return;
loadShaders(shader_select, "selection", "://shaders"); loadShaders(shader_select, "selection", "shaders");
loadShaders(shader_halo, "selection_halo", "://shaders"); loadShaders(shader_halo, "selection_halo", "shaders");
//loadShaders(shader_rope, "rope", "://shaders"); //loadShaders(shader_rope, "rope", "://shaders");
} }
@@ -789,6 +803,7 @@ QByteArray QGLView::saveCamera() {
void QGLView::restoreCamera(const QByteArray &ba) { void QGLView::restoreCamera(const QByteArray &ba) {
if (ba.isEmpty()) return; if (ba.isEmpty()) return;
qDebug() << "restoreCamera" << ba.size();
ChunkStream cs(ba); ChunkStream cs(ba);
QVector3D pos, aim, ang; QVector3D pos, aim, ang;
while (!cs.atEnd()) { while (!cs.atEnd()) {

View File

@@ -238,7 +238,7 @@ private:
QSize prev_size; QSize prev_size;
float lineWidth_; float lineWidth_;
float fogDensity_, fogStart_, fogEnd_, fps_, fps_tm, hoverHaloFill_, selectionHaloFill_, m_motionBlurFactor; float fogDensity_, fogStart_, fogEnd_, fps_, fps_tm, hoverHaloFill_, selectionHaloFill_, m_motionBlurFactor;
int timer, fps_cnt, sh_id_loc; int timer, fps_cnt, sh_id_loc, deleting_;
bool is_first_draw, is_init, fogEnabled_, lightEnabled_, grabMouse_, mouse_first, mouseRotate_, mouseSelect_, customMouseMove_; bool is_first_draw, is_init, fogEnabled_, lightEnabled_, grabMouse_, mouse_first, mouseRotate_, mouseSelect_, customMouseMove_;
bool shaders_supported, changed_, cameraOrbit_, need_init_; bool shaders_supported, changed_, cameraOrbit_, need_init_;
bool hoverHalo_, selectionHalo_, shaders_bind, selecting_; bool hoverHalo_, selectionHalo_, shaders_bind, selecting_;

View File

@@ -34,6 +34,10 @@ QGLViewWindow::QGLViewWindow(QWidget * parent): QMainWindow(parent), Ui::QGLView
icon_geo = QIcon(":/icons/type-geo.png"); icon_geo = QIcon(":/icons/type-geo.png");
icon_camera = QIcon(":/icons/type-camera.png"); icon_camera = QIcon(":/icons/type-camera.png");
icon_light = QIcon(":/icons/type-light.png"); icon_light = QIcon(":/icons/type-light.png");
QAction * a = new QAction(QIcon(":/icons/edit-delete.png"), "Remove");
connect(a, SIGNAL(triggered()), this, SLOT(removeObjects()));
treeObjects->addAction(a);
spinViewLineWidth->setValue(lineThickness()*2);
sel_obj = nullptr; sel_obj = nullptr;
view->view()->camera()->setAim(QVector3D()); view->view()->camera()->setAim(QVector3D());
@@ -311,6 +315,16 @@ void QGLViewWindow::on_treeObjects_itemClicked(QTreeWidgetItem * ti, int) {
} }
void QGLViewWindow::removeObjects() {
QList<QTreeWidgetItem*> sil = treeObjects->selectedItems();
foreach (QTreeWidgetItem * i, sil) {
GLObjectBase * o = (GLObjectBase*)(i->data(0, Qt::UserRole).toULongLong());
delete o;
}
qDeleteAll(sil);
}
void QGLViewWindow::objectsTreeChanged() { void QGLViewWindow::objectsTreeChanged() {
treeObjects->clear(); treeObjects->clear();
makeObjetTree(&(view->view()->rootObject()), treeObjects->invisibleRootItem()); makeObjetTree(&(view->view()->rootObject()), treeObjects->invisibleRootItem());

View File

@@ -124,6 +124,7 @@ private slots:
void on_treeObjects_itemClicked(QTreeWidgetItem * ti, int); void on_treeObjects_itemClicked(QTreeWidgetItem * ti, int);
void removeObjects();
void objectsTreeChanged(); void objectsTreeChanged();
void materialChanged(); void materialChanged();
void selectionChanged(GLObjectBase * cur, GLObjectBase *); void selectionChanged(GLObjectBase * cur, GLObjectBase *);

View File

@@ -7,14 +7,14 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1125</width> <width>1125</width>
<height>1056</height> <height>1032</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>QGLView converter</string> <string>QGLView converter</string>
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
<item> <item>
<widget class="QWidget" name="widget_2" native="true"> <widget class="QWidget" name="widget_2" native="true">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
@@ -421,513 +421,560 @@
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_7"> <layout class="QVBoxLayout" name="verticalLayout_7">
<item> <item>
<widget class="QGroupBox" name="groupShadows"> <widget class="QScrollArea" name="scrollArea_2">
<property name="title"> <property name="frameShape">
<string>Shadows</string> <enum>QFrame::NoFrame</enum>
</property> </property>
<property name="checkable"> <property name="widgetResizable">
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QFormLayout" name="formLayout_3"> <widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="fieldGrowthPolicy"> <property name="geometry">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum> <rect>
<x>0</x>
<y>0</y>
<width>294</width>
<height>737</height>
</rect>
</property> </property>
<property name="labelAlignment"> <layout class="QVBoxLayout" name="verticalLayout_9">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <property name="leftMargin">
</property> <number>0</number>
<item row="1" column="0"> </property>
<widget class="QLabel" name="label_10"> <property name="topMargin">
<property name="text"> <number>0</number>
<string>Shadowmap size</string> </property>
</property> <property name="rightMargin">
</widget> <number>0</number>
</item> </property>
<item row="1" column="1"> <property name="bottomMargin">
<widget class="SpinSlider" name="spinShadowmapSize"> <number>0</number>
<property name="minimum"> </property>
<double>16.000000000000000</double> <item>
</property> <widget class="QGroupBox" name="groupShadows">
<property name="maximum"> <property name="title">
<double>2048.000000000000000</double> <string>Shadows</string>
</property> </property>
<property name="value"> <property name="checkable">
<double>512.000000000000000</double> <bool>true</bool>
</property> </property>
<property name="decimals"> <layout class="QFormLayout" name="formLayout_3">
<number>0</number> <property name="fieldGrowthPolicy">
</property> <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
<property name="singleStep"> </property>
<double>16.000000000000000</double> <property name="labelAlignment">
</property> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<property name="pageStep"> </property>
<double>512.000000000000000</double> <item row="1" column="0">
</property> <widget class="QLabel" name="label_10">
<property name="squareScale"> <property name="text">
<bool>true</bool> <string>Shadowmap size</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0" colspan="2"> <item row="1" column="1">
<widget class="QCheckBox" name="checkSoftShadows"> <widget class="SpinSlider" name="spinShadowmapSize">
<property name="text"> <property name="minimum">
<string>Soft</string> <double>16.000000000000000</double>
</property> </property>
<property name="checked"> <property name="maximum">
<bool>true</bool> <double>2048.000000000000000</double>
</property> </property>
</widget> <property name="value">
</item> <double>512.000000000000000</double>
</layout> </property>
</widget> <property name="decimals">
</item> <number>0</number>
<item> </property>
<widget class="QGroupBox" name="groupBloom"> <property name="singleStep">
<property name="title"> <double>16.000000000000000</double>
<string>Bloom</string> </property>
</property> <property name="pageStep">
<property name="checkable"> <double>512.000000000000000</double>
<bool>true</bool> </property>
</property> <property name="squareScale">
<layout class="QFormLayout" name="formLayout_5"> <bool>true</bool>
<property name="fieldGrowthPolicy"> </property>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum> </widget>
</property> </item>
<property name="labelAlignment"> <item row="0" column="0" colspan="2">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <widget class="QCheckBox" name="checkSoftShadows">
</property> <property name="text">
<item row="0" column="0"> <string>Soft</string>
<widget class="QLabel" name="label_18"> </property>
<property name="text"> <property name="checked">
<string>Factror</string> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> </layout>
<widget class="SpinSlider" name="spinBloomFactor"> </widget>
<property name="minimum"> </item>
<double>0.000000000000000</double> <item>
</property> <widget class="QGroupBox" name="groupBloom">
<property name="maximum"> <property name="title">
<double>100.000000000000000</double> <string>Bloom</string>
</property> </property>
<property name="value"> <property name="checkable">
<double>1.000000000000000</double> <bool>true</bool>
</property> </property>
<property name="decimals"> <layout class="QFormLayout" name="formLayout_5">
<number>1</number> <property name="fieldGrowthPolicy">
</property> <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
<property name="singleStep"> </property>
<double>0.100000000000000</double> <property name="labelAlignment">
</property> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<property name="pageStep"> </property>
<double>1.000000000000000</double> <item row="0" column="0">
</property> <widget class="QLabel" name="label_18">
<property name="squareScale"> <property name="text">
<bool>false</bool> <string>Factror</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="0" column="1">
<widget class="SpinSlider" name="spinBloomRadius"> <widget class="SpinSlider" name="spinBloomFactor">
<property name="minimum"> <property name="minimum">
<double>1.000000000000000</double> <double>0.000000000000000</double>
</property> </property>
<property name="maximum"> <property name="maximum">
<double>128.000000000000000</double> <double>100.000000000000000</double>
</property> </property>
<property name="value"> <property name="value">
<double>8.000000000000000</double> <double>1.000000000000000</double>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>0</number> <number>1</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>1.000000000000000</double> <double>0.100000000000000</double>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<double>4.000000000000000</double> <double>1.000000000000000</double>
</property> </property>
<property name="squareScale"> <property name="squareScale">
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="1">
<widget class="QLabel" name="label_17"> <widget class="SpinSlider" name="spinBloomRadius">
<property name="text"> <property name="minimum">
<string>Radius</string> <double>1.000000000000000</double>
</property> </property>
</widget> <property name="maximum">
</item> <double>128.000000000000000</double>
<item row="1" column="0"> </property>
<widget class="QLabel" name="label_19"> <property name="value">
<property name="text"> <double>8.000000000000000</double>
<string>Threshold</string> </property>
</property> <property name="decimals">
</widget> <number>0</number>
</item> </property>
<item row="1" column="1"> <property name="singleStep">
<widget class="SpinSlider" name="spinBloomThreshold"> <double>1.000000000000000</double>
<property name="minimum"> </property>
<double>0.000000000000000</double> <property name="pageStep">
</property> <double>4.000000000000000</double>
<property name="maximum"> </property>
<double>1.000000000000000</double> <property name="squareScale">
</property> <bool>false</bool>
<property name="value"> </property>
<double>0.900000000000000</double> </widget>
</property> </item>
<property name="decimals"> <item row="2" column="0">
<number>2</number> <widget class="QLabel" name="label_17">
</property> <property name="text">
<property name="singleStep"> <string>Radius</string>
<double>0.050000000000000</double> </property>
</property> </widget>
<property name="pageStep"> </item>
<double>0.100000000000000</double> <item row="1" column="0">
</property> <widget class="QLabel" name="label_19">
<property name="squareScale"> <property name="text">
<bool>false</bool> <string>Threshold</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item row="1" column="1">
</widget> <widget class="SpinSlider" name="spinBloomThreshold">
</item> <property name="minimum">
<item> <double>0.000000000000000</double>
<widget class="QGroupBox" name="groupMotionBlur"> </property>
<property name="title"> <property name="maximum">
<string>Motion blur</string> <double>1.000000000000000</double>
</property> </property>
<property name="checkable"> <property name="value">
<bool>true</bool> <double>0.900000000000000</double>
</property> </property>
<layout class="QFormLayout" name="formLayout_2"> <property name="decimals">
<property name="fieldGrowthPolicy"> <number>2</number>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum> </property>
</property> <property name="singleStep">
<property name="labelAlignment"> <double>0.050000000000000</double>
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property>
</property> <property name="pageStep">
<item row="0" column="0"> <double>0.100000000000000</double>
<widget class="QLabel" name="label_12"> </property>
<property name="text"> <property name="squareScale">
<string>Factror</string> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> </layout>
<widget class="QLabel" name="label_13"> </widget>
<property name="text"> </item>
<string>Steps</string> <item>
</property> <widget class="QGroupBox" name="groupMotionBlur">
</widget> <property name="title">
</item> <string>Motion blur</string>
<item row="0" column="1"> </property>
<widget class="SpinSlider" name="spinMotionBlurFactor"> <property name="checkable">
<property name="minimum"> <bool>true</bool>
<double>0.000000000000000</double> </property>
</property> <layout class="QFormLayout" name="formLayout_2">
<property name="maximum"> <property name="fieldGrowthPolicy">
<double>10000.000000000000000</double> <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property> </property>
<property name="value"> <property name="labelAlignment">
<double>1.000000000000000</double> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
<property name="decimals"> <item row="0" column="0">
<number>1</number> <widget class="QLabel" name="label_12">
</property> <property name="text">
<property name="singleStep"> <string>Factror</string>
<double>0.100000000000000</double> </property>
</property> </widget>
<property name="pageStep"> </item>
<double>1.000000000000000</double> <item row="1" column="0">
</property> <widget class="QLabel" name="label_13">
<property name="squareScale"> <property name="text">
<bool>false</bool> <string>Steps</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="0" column="1">
<widget class="SpinSlider" name="spinMotionBlurSteps"> <widget class="SpinSlider" name="spinMotionBlurFactor">
<property name="minimum"> <property name="minimum">
<double>1.000000000000000</double> <double>0.000000000000000</double>
</property> </property>
<property name="maximum"> <property name="maximum">
<double>128.000000000000000</double> <double>10000.000000000000000</double>
</property> </property>
<property name="value"> <property name="value">
<double>8.000000000000000</double> <double>1.000000000000000</double>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>0</number> <number>1</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>1.000000000000000</double> <double>0.100000000000000</double>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<double>4.000000000000000</double> <double>1.000000000000000</double>
</property> </property>
<property name="squareScale"> <property name="squareScale">
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item row="1" column="1">
</widget> <widget class="SpinSlider" name="spinMotionBlurSteps">
</item> <property name="minimum">
<item> <double>1.000000000000000</double>
<widget class="QGroupBox" name="groupEyeAccomodation"> </property>
<property name="title"> <property name="maximum">
<string>Eye accomodation</string> <double>128.000000000000000</double>
</property> </property>
<property name="checkable"> <property name="value">
<bool>true</bool> <double>8.000000000000000</double>
</property> </property>
<layout class="QFormLayout" name="formLayout_4"> <property name="decimals">
<property name="fieldGrowthPolicy"> <number>0</number>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum> </property>
</property> <property name="singleStep">
<property name="labelAlignment"> <double>1.000000000000000</double>
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property>
</property> <property name="pageStep">
<item row="0" column="0"> <double>4.000000000000000</double>
<widget class="QLabel" name="label_3"> </property>
<property name="text"> <property name="squareScale">
<string>Time</string> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> </layout>
<widget class="QLabel" name="label_14"> </widget>
<property name="text"> </item>
<string>Max speed</string> <item>
</property> <widget class="QGroupBox" name="groupEyeAccomodation">
</widget> <property name="title">
</item> <string>Eye accomodation</string>
<item row="0" column="1"> </property>
<widget class="SpinSlider" name="spinAccom"> <property name="checkable">
<property name="minimum"> <bool>true</bool>
<double>0.000000000000000</double> </property>
</property> <layout class="QFormLayout" name="formLayout_4">
<property name="maximum"> <property name="fieldGrowthPolicy">
<double>256.000000000000000</double> <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property> </property>
<property name="value"> <property name="labelAlignment">
<double>32.000000000000000</double> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
<property name="squareScale"> <item row="0" column="0">
<bool>true</bool> <widget class="QLabel" name="label_3">
</property> <property name="text">
</widget> <string>Time</string>
</item> </property>
<item row="1" column="1"> </widget>
<widget class="SpinSlider" name="spinAccomMS"> </item>
<property name="minimum"> <item row="1" column="0">
<double>0.010000000000000</double> <widget class="QLabel" name="label_14">
</property> <property name="text">
<property name="maximum"> <string>Max speed</string>
<double>1.000000000000000</double> </property>
</property> </widget>
<property name="value"> </item>
<double>0.100000000000000</double> <item row="0" column="1">
</property> <widget class="SpinSlider" name="spinAccom">
<property name="decimals"> <property name="minimum">
<number>3</number> <double>0.000000000000000</double>
</property> </property>
<property name="singleStep"> <property name="maximum">
<double>0.100000000000000</double> <double>256.000000000000000</double>
</property> </property>
<property name="pageStep"> <property name="value">
<double>1.000000000000000</double> <double>32.000000000000000</double>
</property> </property>
<property name="squareScale"> <property name="squareScale">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item row="1" column="1">
</widget> <widget class="SpinSlider" name="spinAccomMS">
</item> <property name="minimum">
<item> <double>0.010000000000000</double>
<widget class="QGroupBox" name="groupDOF"> </property>
<property name="title"> <property name="maximum">
<string>Depth of field</string> <double>1.000000000000000</double>
</property> </property>
<property name="checkable"> <property name="value">
<bool>true</bool> <double>0.100000000000000</double>
</property> </property>
<layout class="QFormLayout" name="formLayout_11"> <property name="decimals">
<property name="fieldGrowthPolicy"> <number>3</number>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum> </property>
</property> <property name="singleStep">
<property name="labelAlignment"> <double>0.100000000000000</double>
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property>
</property> <property name="pageStep">
<item row="2" column="0"> <double>1.000000000000000</double>
<widget class="QLabel" name="label_15"> </property>
<property name="text"> <property name="squareScale">
<string>Diaphragm</string> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> </layout>
<widget class="QLabel" name="label_16"> </widget>
<property name="text"> </item>
<string>Max speed</string> <item>
</property> <widget class="QGroupBox" name="groupDOF">
</widget> <property name="title">
</item> <string>Depth of field</string>
<item row="2" column="1"> </property>
<widget class="SpinSlider" name="spinDOFDiaphragm"> <property name="checkable">
<property name="minimum"> <bool>true</bool>
<double>0.100000000000000</double> </property>
</property> <layout class="QFormLayout" name="formLayout_11">
<property name="maximum"> <property name="fieldGrowthPolicy">
<double>1024.000000000000000</double> <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property> </property>
<property name="value"> <property name="labelAlignment">
<double>8.000000000000000</double> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
<property name="squareScale"> <item row="2" column="0">
<bool>true</bool> <widget class="QLabel" name="label_15">
</property> <property name="text">
</widget> <string>Diaphragm</string>
</item> </property>
<item row="3" column="1"> </widget>
<widget class="SpinSlider" name="spinDOFSpeed"> </item>
<property name="minimum"> <item row="3" column="0">
<double>0.010000000000000</double> <widget class="QLabel" name="label_16">
</property> <property name="text">
<property name="maximum"> <string>Max speed</string>
<double>10.000000000000000</double> </property>
</property> </widget>
<property name="value"> </item>
<double>0.100000000000000</double> <item row="2" column="1">
</property> <widget class="SpinSlider" name="spinDOFDiaphragm">
<property name="decimals"> <property name="minimum">
<number>2</number> <double>0.100000000000000</double>
</property> </property>
<property name="singleStep"> <property name="maximum">
<double>0.100000000000000</double> <double>1024.000000000000000</double>
</property> </property>
<property name="pageStep"> <property name="value">
<double>1.000000000000000</double> <double>8.000000000000000</double>
</property> </property>
<property name="squareScale"> <property name="squareScale">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="3" column="1">
<widget class="QLabel" name="label_21"> <widget class="SpinSlider" name="spinDOFSpeed">
<property name="text"> <property name="minimum">
<string>Focus</string> <double>0.010000000000000</double>
</property> </property>
</widget> <property name="maximum">
</item> <double>10.000000000000000</double>
<item row="1" column="1"> </property>
<widget class="SpinSlider" name="spinDOFFocus"> <property name="value">
<property name="minimum"> <double>0.100000000000000</double>
<double>0.100000000000000</double> </property>
</property> <property name="decimals">
<property name="maximum"> <number>2</number>
<double>1000.000000000000000</double> </property>
</property> <property name="singleStep">
<property name="value"> <double>0.100000000000000</double>
<double>1.000000000000000</double> </property>
</property> <property name="pageStep">
<property name="squareScale"> <double>1.000000000000000</double>
<bool>true</bool> </property>
</property> <property name="squareScale">
<property name="spinMaximum"> <bool>true</bool>
<double>999999.000000000000000</double> </property>
</property> </widget>
</widget> </item>
</item> <item row="1" column="0">
<item row="0" column="0" colspan="2"> <widget class="QLabel" name="label_21">
<widget class="QCheckBox" name="checkDOFAutoFocus"> <property name="text">
<property name="text"> <string>Focus</string>
<string>Auto focus</string> </property>
</property> </widget>
</widget> </item>
</item> <item row="1" column="1">
</layout> <widget class="SpinSlider" name="spinDOFFocus">
</widget> <property name="minimum">
</item> <double>0.100000000000000</double>
<item> </property>
<widget class="QGroupBox" name="groupReflections"> <property name="maximum">
<property name="title"> <double>1000.000000000000000</double>
<string>Reflections</string> </property>
</property> <property name="value">
<property name="checkable"> <double>1.000000000000000</double>
<bool>true</bool> </property>
</property> <property name="squareScale">
<layout class="QFormLayout" name="formLayout_6"> <bool>true</bool>
<property name="fieldGrowthPolicy"> </property>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum> <property name="spinMaximum">
</property> <double>999999.000000000000000</double>
<property name="labelAlignment"> </property>
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </widget>
</property> </item>
<item row="0" column="0" colspan="2"> <item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="checkReflectionsBlur"> <widget class="QCheckBox" name="checkDOFAutoFocus">
<property name="text"> <property name="text">
<string>Blur</string> <string>Auto focus</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupSSAO"> <widget class="QGroupBox" name="groupReflections">
<property name="title"> <property name="title">
<string>SSAO</string> <string>Reflections</string>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QFormLayout" name="formLayout_7"> <layout class="QFormLayout" name="formLayout_6">
<property name="fieldGrowthPolicy"> <property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum> <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property> </property>
<property name="labelAlignment"> <property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
<item row="0" column="0"> <item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_9"> <widget class="QCheckBox" name="checkReflectionsBlur">
<property name="text"> <property name="text">
<string>Time</string> <string>Blur</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> </layout>
<widget class="SpinSlider" name="spinSSAORadius"> </widget>
<property name="minimum"> </item>
<double>0.000000000000000</double> <item>
</property> <widget class="QGroupBox" name="groupSSAO">
<property name="maximum"> <property name="title">
<double>16.000000000000000</double> <string>SSAO</string>
</property> </property>
<property name="value"> <property name="checkable">
<double>5.000000000000000</double> <bool>true</bool>
</property> </property>
<property name="decimals"> <layout class="QFormLayout" name="formLayout_7">
<number>0</number> <property name="fieldGrowthPolicy">
</property> <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
<property name="singleStep"> </property>
<double>1.000000000000000</double> <property name="labelAlignment">
</property> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<property name="pageStep"> </property>
<double>4.000000000000000</double> <item row="0" column="0">
</property> <widget class="QLabel" name="label_9">
<property name="squareScale"> <property name="text">
<bool>false</bool> <string>Time</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item row="0" column="1">
<widget class="SpinSlider" name="spinSSAORadius">
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>16.000000000000000</double>
</property>
<property name="value">
<double>5.000000000000000</double>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
<property name="pageStep">
<double>4.000000000000000</double>
</property>
<property name="squareScale">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>
@@ -999,20 +1046,54 @@
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
<item> <item>
<widget class="MaterialEditor" name="matEditor" native="true"/> <widget class="QScrollArea" name="scrollArea">
</item> <property name="frameShape">
<item> <enum>QFrame::NoFrame</enum>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="widgetResizable">
<size> <bool>true</bool>
<width>20</width>
<height>1</height>
</size>
</property> </property>
</spacer> <widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>333</width>
<height>853</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="MaterialEditor" name="matEditor" native="true"/>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>834</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -1038,40 +1119,49 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="GLWidget" name="view" native="true"> <widget class="QSplitter" name="splitter">
<property name="sizePolicy"> <property name="orientation">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <enum>Qt::Horizontal</enum>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
</widget> <widget class="GLWidget" name="view">
</item> <property name="sizePolicy">
<item> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<widget class="QGroupBox" name="groupBox"> <horstretch>0</horstretch>
<property name="title"> <verstretch>0</verstretch>
<string>Objects</string> </sizepolicy>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> </widget>
<item> <widget class="QGroupBox" name="groupBox">
<widget class="QTreeWidget" name="treeObjects"> <property name="title">
<property name="editTriggers"> <string>Objects</string>
<set>QAbstractItemView::NoEditTriggers</set> </property>
</property> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="verticalScrollMode"> <item>
<enum>QAbstractItemView::ScrollPerPixel</enum> <widget class="QTreeWidget" name="treeObjects">
</property> <property name="contextMenuPolicy">
<property name="uniformRowHeights"> <enum>Qt::ActionsContextMenu</enum>
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Name</string>
</property> </property>
</column> <property name="editTriggers">
</widget> <set>QAbstractItemView::NoEditTriggers</set>
</item> </property>
</layout> <property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>
@@ -1098,7 +1188,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1125</width> <width>1125</width>
<height>21</height> <height>24</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">
@@ -1204,7 +1294,7 @@
<customwidget> <customwidget>
<class>GLWidget</class> <class>GLWidget</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header location="global">glwidget.h</header> <header>glwidget.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget> <customwidget>

View File

@@ -80,10 +80,10 @@ void RendererDeferredShading::renderScene() {
QMatrix4x4 vc_proji; QMatrix4x4 vc_proji;
vc_proji.perspective(90., 1., view.camera()->depthStart(), view.camera()->depthEnd()); vc_proji.perspective(90., 1., view.camera()->depthStart(), view.camera()->depthEnd());
vc_proji = vc_proji.inverted(); vc_proji = vc_proji.inverted();
corner_dirs[0] = (mproji * QVector4D( 1, 1, 0, 1)); corner_dirs[0] = (mproji * QVector4D(-1, -1, 0, 1));
corner_dirs[1] = (mproji * QVector4D(-1, 1, 0, 1)); corner_dirs[1] = (mproji * QVector4D( 1, -1, 0, 1));
corner_dirs[2] = (mproji * QVector4D(-1, -1, 0, 1)); corner_dirs[2] = (mproji * QVector4D(-1, 1, 0, 1));
corner_dirs[3] = (mproji * QVector4D( 1, -1, 0, 1)); corner_dirs[3] = (mproji * QVector4D( 1, 1, 0, 1));
//qDebug() << corner_dirs[0] << corner_dirs[1] << corner_dirs[2] << corner_dirs[3]; //qDebug() << corner_dirs[0] << corner_dirs[1] << corner_dirs[2] << corner_dirs[3];
fbo_g.bind(); fbo_g.bind();
int buffs[] = {0, 1, 2, 3, 4}; int buffs[] = {0, 1, 2, 3, 4};
@@ -545,7 +545,7 @@ void RendererDeferredShading::reloadShaders() {
for (int i = 0; i < shaders.size(); ++i) { for (int i = 0; i < shaders.size(); ++i) {
QOpenGLShaderProgram * p(*(shaders[i].second)); QOpenGLShaderProgram * p(*(shaders[i].second));
if (!p) p = new QOpenGLShaderProgram(view.context()); if (!p) p = new QOpenGLShaderProgram(view.context());
loadShaders(p, shaders[i].first, "://shaders"); loadShaders(p, shaders[i].first, "shaders");
*(shaders[i].second) = p; *(shaders[i].second) = p;
} }
} }

View File

@@ -49,16 +49,17 @@ void RendererSimple::resizeFBO(int w, int h) {
void RendererSimple::renderScene() { void RendererSimple::renderScene() {
int passes = (view.lightsCount() - 1) / 8 + 1; int passes = (view.lightsCount() - 1) / 8 + 1;
//QMatrix4x4 pm = getGLMatrix(GL_PROJECTION_MATRIX), mvm = getGLMatrix(GL_MODELVIEW_MATRIX), pmvm = pm * mvm, lpm, lmvm, lpmvm; //QMatrix4x4 pm = getGLMatrix(GL_PROJECTION_MATRIX), mvm = getGLMatrix(GL_MODELVIEW_MATRIX), pmvm = pm * mvm, lpm, lmvm, lpmvm;
glSetCapEnabled(GL_MULTISAMPLE, view.isFeatureEnabled(QGLView::qglMSAA)); //glSetCapEnabled(GL_MULTISAMPLE, view.isFeatureEnabled(QGLView::qglMSAA));
if (passes < 1) passes = 1; if (passes < 1) passes = 1;
//glEnable(GL_FOG); //glEnable(GL_FOG);
if (view.isFeatureEnabled(QGLView::qglFXAA)) fbo.bind(); //if (view.isFeatureEnabled(QGLView::qglFXAA)) fbo.bind();
//glEnable(GL_TEXTURE_2D); //glEnable(GL_TEXTURE_2D);
if (passes > 1) { if (passes > 1 || view.isFeatureEnabled(QGLView::qglFXAA)) {
fbo.bind(); fbo.bind();
fbo.setWriteBuffer(0); fbo.setWriteBuffer(0);
glClearFramebuffer(); glClearFramebuffer();
} } else
glSetCapEnabled(GL_MULTISAMPLE, view.isFeatureEnabled(QGLView::qglMSAA));
glEnable(GL_RESCALE_NORMAL); glEnable(GL_RESCALE_NORMAL);
for (int l = 0; l < passes; ++l) { for (int l = 0; l < passes; ++l) {
if (passes > 1) fbo.setWriteBuffer(1); if (passes > 1) fbo.setWriteBuffer(1);

View File

@@ -2,5 +2,5 @@
void main(void) { void main(void) {
qgl_FragTexture = qgl_Texture; qgl_FragTexture = qgl_Texture;
gl_Position = qgl_ftransform(); gl_Position = vec4(qgl_Vertex,1);
} }

View File

@@ -2,5 +2,5 @@
void main(void) { void main(void) {
qgl_FragTexture = qgl_Texture; qgl_FragTexture = qgl_Texture;
gl_Position = qgl_ftransform(); gl_Position = vec4(qgl_Vertex,1);
} }

View File

@@ -2,5 +2,5 @@
void main(void) { void main(void) {
qgl_FragTexture = qgl_Texture; qgl_FragTexture = qgl_Texture;
gl_Position = qgl_ftransform(); gl_Position = vec4(qgl_Vertex,1);
} }

View File

@@ -120,7 +120,7 @@ void main(void) {
pos.w = 1; pos.w = 1;
pos.xyz = view_dir * z; pos.xyz = view_dir * z;
pos.z = -pos.z; //pos.z = -pos.z;
//pos.z = posz; //pos.z = posz;
//pos.xyz += n * height; //pos.xyz += n * height;
@@ -142,8 +142,8 @@ void main(void) {
// calcLight(0, n, v, v2); // calcLight(0, n, v, v2);
qgl_FragData[0] = vec4(max(vec3(0), li * dc + si * v2.rgb + v3.rgb + texelFetch(t_pp, tc, 0).rgb), v0.w); qgl_FragData[0] = vec4(max(vec3(0), li * dc + si * v2.rgb + v3.rgb + texelFetch(t_pp, tc, 0).rgb), v0.w);
//qgl_FragData[0].rgb = vec3(-z); //qgl_FragData[0].rgb = vec3(length(view_pos.xyz - qgl_Light[1].position.xyz)/3);
//qgl_FragData[0].rgb = li + vec3(texelFetch(t_pp, tc, 0).xyz); //qgl_FragData[0].rgb = vec3(view_pos.xyz);
//shd = shd - shp.w; //shd = shd - shp.w;
/*vec3 fp = pos.xyz;// * lpos.w; /*vec3 fp = pos.xyz;// * lpos.w;

View File

@@ -5,10 +5,12 @@ out vec3 view_dir;
out vec4 view_pos; out vec4 view_pos;
void main(void) { void main(void) {
view_dir = view_corner / view_corner.z; //view_dir = vec3(0.8);
view_pos = vec4(qgl_ModelViewMatrix * vec4(qgl_Vertex.xy, 1, 1)); view_pos = vec4(qgl_ModelViewMatrix * vec4(qgl_Vertex.xy, 1, 1));
view_pos /= view_pos.w; view_pos /= view_pos.w;
view_dir = vec3(view_corner.xyz);// / view_corner.z;
qgl_FragTexture = qgl_Texture; qgl_FragTexture = qgl_Texture;
qgl_FragColor = qgl_Color; qgl_FragColor = qgl_Color;
gl_Position = qgl_ftransform(); gl_Position = qgl_ftransform();
//gl_Position = vec4(qgl_Vertex,1);
} }

View File

@@ -2,5 +2,5 @@
void main(void) { void main(void) {
qgl_FragTexture = qgl_Texture; qgl_FragTexture = qgl_Texture;
gl_Position = qgl_ftransform(); gl_Position = vec4(qgl_Vertex,1);
} }

View File

@@ -16,5 +16,6 @@ void main(void) {
float vm = step(1e-3, (d0 * 25.) * (d1 * 25.) * (d2 * 255.) * (d3 * 255.)); float vm = step(1e-3, (d0 * 25.) * (d1 * 25.) * (d2 * 255.) * (d3 * 255.));
float v = mix(vs - vm, vs - vm - vm + 1, fill); float v = mix(vs - vm, vs - vm - vm + 1, fill);
//qgl_FragData[0] = vec4(1,0,0,0.5);//vec4(color.rgb, v * color.a); //qgl_FragData[0] = vec4(1,0,0,0.5);//vec4(color.rgb, v * color.a);
qgl_FragData[0] = vec4(color.bgr, v * color.a); gl_FragColor = v*vec4(color.bgr, v * color.a);
//qgl_FragData[0] = vec4(1);
} }

View File

@@ -2,5 +2,6 @@
void main(void) { void main(void) {
qgl_FragTexture = qgl_Texture; qgl_FragTexture = qgl_Texture;
qgl_FragColor = qgl_Color;
gl_Position = qgl_ftransform(); gl_Position = qgl_ftransform();
} }

View File

@@ -6,5 +6,5 @@ out vec3 view_dir;
void main(void) { void main(void) {
view_dir = view_corner / view_corner.z; view_dir = view_corner / view_corner.z;
qgl_FragTexture = qgl_Texture; qgl_FragTexture = qgl_Texture;
gl_Position = qgl_ftransform(); gl_Position = vec4(qgl_Vertex,1);
} }

View File

@@ -2,5 +2,5 @@
void main(void) { void main(void) {
qgl_FragTexture = qgl_Texture; qgl_FragTexture = qgl_Texture;
gl_Position = qgl_ftransform(); gl_Position = vec4(qgl_Vertex,1);
} }

View File

@@ -2,5 +2,5 @@
void main(void) { void main(void) {
qgl_FragTexture = qgl_Texture; qgl_FragTexture = qgl_Texture;
gl_Position = qgl_ftransform(); gl_Position = vec4(qgl_Vertex,1);
} }