git-svn-id: svn://db.shs.com.ru/libs@703 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -30,6 +30,8 @@ list(APPEND SRC ${FSRC})
|
|||||||
qt_sources(FSRC DIR "core")
|
qt_sources(FSRC DIR "core")
|
||||||
list(APPEND SRC ${FSRC})
|
list(APPEND SRC ${FSRC})
|
||||||
qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM)
|
qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM)
|
||||||
|
file(GLOB PHS "*_p.h" "formats/*_p.h" "core/*_p.h")
|
||||||
|
list(REMOVE_ITEM out_HDR "${PHS}")
|
||||||
qt_add_library(qglengine_core SHARED out_CPP)
|
qt_add_library(qglengine_core SHARED out_CPP)
|
||||||
qt_target_link_libraries(qglengine_core qad_utils qad_widgets assimp ${OPENGL_LIBRARIES})
|
qt_target_link_libraries(qglengine_core qad_utils qad_widgets assimp ${OPENGL_LIBRARIES})
|
||||||
message(STATUS "Building qglengine_core")
|
message(STATUS "Building qglengine_core")
|
||||||
|
|||||||
274
qglengine/core/glcubemap.cpp
Normal file
274
qglengine/core/glcubemap.cpp
Normal file
@@ -0,0 +1,274 @@
|
|||||||
|
/*
|
||||||
|
QGLView
|
||||||
|
Copyright (C) 2019 Ivan Pelipenko peri4ko@yandex.ru
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gltypes.h"
|
||||||
|
#include "glcubemap.h"
|
||||||
|
#include "hdr_p.h"
|
||||||
|
|
||||||
|
using namespace QGLEngineShaders;
|
||||||
|
|
||||||
|
|
||||||
|
QVector<QVector3D> loadFileHDR(const QString & path, QSize * size) {
|
||||||
|
if (size) *size = QSize();
|
||||||
|
QVector<QVector3D> ret;
|
||||||
|
QFile f(path);
|
||||||
|
if (!f.open(QIODevice::ReadOnly)) {
|
||||||
|
qDebug() << "[QGLEngine] Can`t open" << path;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
QTextStream ts(&f);
|
||||||
|
QString line = ts.readLine(256);
|
||||||
|
if (line != "#?RADIANCE") return ret;
|
||||||
|
QSize sz;
|
||||||
|
while (!ts.atEnd()) {
|
||||||
|
line = ts.readLine(256);
|
||||||
|
if (line.startsWith("FORMAT")) {
|
||||||
|
line.remove(0, 7);
|
||||||
|
if (!line.startsWith("32-bit")) {
|
||||||
|
qDebug() << "[QGLEngine] File" << path << "has unknown format!";
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (line.mid(1, 2) == "Y ") {
|
||||||
|
QStringList sl = line.trimmed().split(" ");
|
||||||
|
sl.removeAll("");
|
||||||
|
if (sl.size() != 4) {
|
||||||
|
qDebug() << "[QGLEngine] File" << path << "has unknown size!";
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
sz.setWidth (sl[3].toInt());
|
||||||
|
sz.setHeight(sl[1].toInt());
|
||||||
|
//qDebug() << "found size" << sz;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sz.isEmpty()) return ret;
|
||||||
|
f.seek(ts.pos());
|
||||||
|
QDataStream ds(&f);
|
||||||
|
int count = sz.width() * sz.height();
|
||||||
|
QVector<float> data(count*3);
|
||||||
|
if (!RGBE_ReadPixels_RLE(&ds, data.data(), sz.width(), sz.height()))
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
if (size) *size = sz;
|
||||||
|
ret.resize(count);
|
||||||
|
//QColor col;
|
||||||
|
//QImage im(sz, QImage::Format_ARGB32);
|
||||||
|
//QRgb * imdata = (QRgb*)im.bits();
|
||||||
|
for (int i = 0; i < count; ++i) {
|
||||||
|
QVector3D p(pow(data[i*3 + 2], 1. / 2.2),
|
||||||
|
pow(data[i*3 + 1], 1. / 2.2),
|
||||||
|
pow(data[i*3 + 0], 1. / 2.2));
|
||||||
|
ret[i] = p;
|
||||||
|
//col = QColor::fromRgbF(piClamp(p[0], 0.f, 1.f),
|
||||||
|
// piClamp(p[1], 0.f, 1.f),
|
||||||
|
// piClamp(p[2], 0.f, 1.f));
|
||||||
|
//imdata[i] = col.rgb();
|
||||||
|
}
|
||||||
|
//im.save("_hdr.png");
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
|
||||||
|
//#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
|
||||||
|
//#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
|
||||||
|
//#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
|
||||||
|
//#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
|
||||||
|
//#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
|
||||||
|
QVector<QVector3D> faceHDR(const QVector<QVector3D> & data, QSize sz, QSize & fsz, int face) {
|
||||||
|
QVector<QVector3D> ret;
|
||||||
|
if (data.isEmpty() || sz.isNull()) return ret;
|
||||||
|
QRect fr;
|
||||||
|
int fw = sz.width () / 4;
|
||||||
|
int fh = sz.height() / 3;
|
||||||
|
fsz = QSize(fw, fh);
|
||||||
|
ret.reserve(fw * fh);
|
||||||
|
switch (face) {
|
||||||
|
case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
|
||||||
|
fr.setRect(fw, fh, fw, fh);
|
||||||
|
for (int x = fr.left(); x <= fr.right(); ++x) {
|
||||||
|
for (int y = fr.top(); y <= fr.bottom(); ++y) {
|
||||||
|
ret << data[y*sz.width() + x];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
|
||||||
|
fr.setRect(fw*3, fh, fw, fh);
|
||||||
|
for (int x = fr.right(); x >= fr.left(); --x) {
|
||||||
|
for (int y = fr.bottom(); y >= fr.top(); --y) {
|
||||||
|
ret << data[y*sz.width() + x];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
|
||||||
|
fr.setRect( 0, fh, fw, fh);
|
||||||
|
for (int y = fr.bottom(); y >= fr.top(); --y) {
|
||||||
|
for (int x = fr.left(); x <= fr.right(); ++x) {
|
||||||
|
ret << data[y*sz.width() + x];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
|
||||||
|
fr.setRect(fw*2, fh, fw, fh);
|
||||||
|
for (int y = fr.top(); y <= fr.bottom(); ++y) {
|
||||||
|
for (int x = fr.right(); x >= fr.left(); --x) {
|
||||||
|
ret << data[y*sz.width() + x];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
|
||||||
|
fr.setRect(fw, 0, fw, fh);
|
||||||
|
for (int x = fr.left(); x <= fr.right(); ++x) {
|
||||||
|
for (int y = fr.top(); y <= fr.bottom(); ++y) {
|
||||||
|
ret << data[y*sz.width() + x];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
|
||||||
|
fr.setRect(fw, fh*2, fw, fh);
|
||||||
|
for (int x = fr.left(); x <= fr.right(); ++x) {
|
||||||
|
for (int y = fr.top(); y <= fr.bottom(); ++y) {
|
||||||
|
ret << data[y*sz.width() + x];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
if (fr.isEmpty()) return ret;
|
||||||
|
//qDebug() << ret.size() << fr;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CubeTexture::CubeTexture(QOpenGLExtraFunctions * f_, int _size, const GLenum & _format): f(f_) {
|
||||||
|
size = _size;
|
||||||
|
format_ = _format;
|
||||||
|
id_ = 0;
|
||||||
|
changed_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CubeTexture::init() {
|
||||||
|
if (isInit()) return true;
|
||||||
|
f->glGenTextures(1, &id_);
|
||||||
|
f->glBindTexture(GL_TEXTURE_CUBE_MAP, id_);
|
||||||
|
f->glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
|
f->glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
f->glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||||
|
f->glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||||
|
f->glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
//glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
|
||||||
|
//glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, format_, size, size, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||||
|
//glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, format_, size, size, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||||
|
//glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, format_, size, size, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||||
|
//glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, format_, size, size, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||||
|
//glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, format_, size, size, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||||
|
//glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, format_, size, size, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||||
|
changed_ = false;
|
||||||
|
return id_ > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CubeTexture::destroy() {
|
||||||
|
if (!isInit()) return;
|
||||||
|
f->glDeleteTextures(1, &id_);
|
||||||
|
id_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CubeTexture::bind(int channel) {
|
||||||
|
init();
|
||||||
|
f->glActiveTexture(GL_TEXTURE0 + channel);
|
||||||
|
f->glBindTexture(GL_TEXTURE_CUBE_MAP, id_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CubeTexture::release() {
|
||||||
|
f->glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CubeTexture::loadHDR(const QVector<QVector3D> & data, QSize sz) {
|
||||||
|
bind();
|
||||||
|
QSize fsz;
|
||||||
|
QVector<QVector3D> fd;
|
||||||
|
for (int i = 0; i < 6; ++i) {
|
||||||
|
fd = faceHDR(data, sz, fsz, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i);
|
||||||
|
//qDebug() << "load cube" << fd[0];
|
||||||
|
//f->glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||||
|
f->glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, format_, fsz.width(), fsz.height(), 0, GL_RGB, GL_FLOAT, fd.isEmpty() ? 0 : fd.constData());
|
||||||
|
//qDebug() << QString::number(GetLastError(), 16);
|
||||||
|
}
|
||||||
|
f->glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CubeTexture::setFileHDR(const QString & path) {
|
||||||
|
hdr_path = path;
|
||||||
|
changed_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CubeTexture::load() {
|
||||||
|
if (!changed_) return;
|
||||||
|
init();
|
||||||
|
if (!hdr_path.isEmpty()) {
|
||||||
|
QSize sz;
|
||||||
|
QVector<QVector3D> data = loadFileHDR(hdr_path, &sz);
|
||||||
|
loadHDR(data, sz);
|
||||||
|
}
|
||||||
|
changed_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void CubeTexture::load() {
|
||||||
|
if (isEmpty()) return;
|
||||||
|
create();
|
||||||
|
if (!path(0).isEmpty()) loadFront(path(0));
|
||||||
|
if (!path(1).isEmpty()) loadBack(path(1));
|
||||||
|
if (!path(2).isEmpty()) loadLeft(path(2));
|
||||||
|
if (!path(3).isEmpty()) loadRight(path(3));
|
||||||
|
if (!path(4).isEmpty()) loadTop(path(4));
|
||||||
|
if (!path(5).isEmpty()) loadBottom(path(5));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CubeTexture::loadFromDirectory(const QString & dir) {
|
||||||
|
QDir d(dir); QFileInfoList sl;
|
||||||
|
sl = d.entryInfoList(QStringList("front.*"), QDir::Files | QDir::NoDotAndDotDot); if (!sl.isEmpty()) loadFront(sl[0].absoluteFilePath());
|
||||||
|
sl = d.entryInfoList(QStringList("back.*"), QDir::Files | QDir::NoDotAndDotDot); if (!sl.isEmpty()) loadBack(sl[0].absoluteFilePath());
|
||||||
|
sl = d.entryInfoList(QStringList("left.*"), QDir::Files | QDir::NoDotAndDotDot); if (!sl.isEmpty()) loadLeft(sl[0].absoluteFilePath());
|
||||||
|
sl = d.entryInfoList(QStringList("right.*"), QDir::Files | QDir::NoDotAndDotDot); if (!sl.isEmpty()) loadRight(sl[0].absoluteFilePath());
|
||||||
|
sl = d.entryInfoList(QStringList("top.*"), QDir::Files | QDir::NoDotAndDotDot); if (!sl.isEmpty()) loadTop(sl[0].absoluteFilePath());
|
||||||
|
sl = d.entryInfoList(QStringList("bottom.*"), QDir::Files | QDir::NoDotAndDotDot); if (!sl.isEmpty()) loadBottom(sl[0].absoluteFilePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CubeTexture::loadPathesFromDirectory(const QString & dir) {
|
||||||
|
QDir d(dir); QFileInfoList sl;
|
||||||
|
sl = d.entryInfoList(QStringList("front.*"), QDir::Files | QDir::NoDotAndDotDot); if (!sl.isEmpty()) pathes[0] = sl[0].absoluteFilePath();
|
||||||
|
sl = d.entryInfoList(QStringList("back.*"), QDir::Files | QDir::NoDotAndDotDot); if (!sl.isEmpty()) pathes[1] = sl[0].absoluteFilePath();
|
||||||
|
sl = d.entryInfoList(QStringList("left.*"), QDir::Files | QDir::NoDotAndDotDot); if (!sl.isEmpty()) pathes[2] = sl[0].absoluteFilePath();
|
||||||
|
sl = d.entryInfoList(QStringList("right.*"), QDir::Files | QDir::NoDotAndDotDot); if (!sl.isEmpty()) pathes[3] = sl[0].absoluteFilePath();
|
||||||
|
sl = d.entryInfoList(QStringList("top.*"), QDir::Files | QDir::NoDotAndDotDot); if (!sl.isEmpty()) pathes[4] = sl[0].absoluteFilePath();
|
||||||
|
sl = d.entryInfoList(QStringList("bottom.*"), QDir::Files | QDir::NoDotAndDotDot); if (!sl.isEmpty()) pathes[5] = sl[0].absoluteFilePath();
|
||||||
|
}
|
||||||
|
*/
|
||||||
67
qglengine/core/glcubemap.h
Normal file
67
qglengine/core/glcubemap.h
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
QGLView
|
||||||
|
Copyright (C) 2019 Ivan Pelipenko peri4ko@yandex.ru
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GLCUBEMAP_H
|
||||||
|
#define GLCUBEMAP_H
|
||||||
|
|
||||||
|
#include "glshaders_types.h"
|
||||||
|
#include "chunkstream.h"
|
||||||
|
|
||||||
|
QVector<QVector3D> loadFileHDR(const QString & path, QSize * size = 0);
|
||||||
|
|
||||||
|
class CubeTexture {
|
||||||
|
public:
|
||||||
|
CubeTexture(QOpenGLExtraFunctions * f_, int _size, const GLenum & _format = GL_RGB16F);
|
||||||
|
bool init();
|
||||||
|
void destroy();
|
||||||
|
void bind(int channel = 0);
|
||||||
|
void release();
|
||||||
|
void resize(int _size) {size = _size; changed_ = true;}
|
||||||
|
void loadHDR(const QVector<QVector3D> & data, QSize sz);
|
||||||
|
void setFileHDR(const QString & path);
|
||||||
|
QString fileHDR() const {return hdr_path;}
|
||||||
|
//void loadFromDirectory(const QString & dir);
|
||||||
|
//void loadFront(const QString & path) {bind(); pathes[0] = path; createGLTexture(id_, rotateQImageLeft(QImage(path)).scaled(size, size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), format_, GL_TEXTURE_CUBE_MAP_POSITIVE_X);}
|
||||||
|
//void loadBack(const QString & path) {bind(); pathes[1] = path; createGLTexture(id_, rotateQImageRight(QImage(path)).scaled(size, size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), format_, GL_TEXTURE_CUBE_MAP_NEGATIVE_X);}
|
||||||
|
//void loadLeft(const QString & path) {bind(); pathes[2] = path; createGLTexture(id_, QImage(path).scaled(size, size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), format_, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y);}
|
||||||
|
//void loadRight(const QString & path) {bind(); pathes[3] = path; createGLTexture(id_, rotateQImage180(QImage(path)).scaled(size, size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), format_, GL_TEXTURE_CUBE_MAP_POSITIVE_Y);}
|
||||||
|
//void loadTop(const QString & path) {bind(); pathes[4] = path; createGLTexture(id_, rotateQImageLeft(QImage(path)).scaled(size, size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), format_, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);}
|
||||||
|
//void loadBottom(const QString & path) {bind(); pathes[5] = path; createGLTexture(id_, rotateQImageLeft(QImage(path)).scaled(size, size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), format_, GL_TEXTURE_CUBE_MAP_POSITIVE_Z);}
|
||||||
|
//void load();
|
||||||
|
//bool isEmpty() const {foreach (const QString & i, pathes) if (!i.isEmpty()) return false; return true;}
|
||||||
|
GLenum format() const {return format_;}
|
||||||
|
void setFormat(GLenum f) {format_ = f; changed_ = true;}
|
||||||
|
GLuint id() const {return id_;}
|
||||||
|
bool isInit() const {return id_ != 0;}
|
||||||
|
//const QString & path(int side) const {return pathes[side];}
|
||||||
|
//void setPath(int side, const QString & p) {pathes[side] = p;}
|
||||||
|
//void loadPathesFromDirectory(const QString & dir);
|
||||||
|
void load();
|
||||||
|
private:
|
||||||
|
|
||||||
|
QOpenGLExtraFunctions * f;
|
||||||
|
bool changed_;
|
||||||
|
int size;
|
||||||
|
GLenum format_;
|
||||||
|
GLuint id_;
|
||||||
|
QString hdr_path;
|
||||||
|
//QVector<QString> pathes;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // GLCUBEMAP_H
|
||||||
@@ -199,3 +199,13 @@ void Material::setTypes() {
|
|||||||
map_emission ._type = mtEmission ;
|
map_emission ._type = mtEmission ;
|
||||||
map_relief ._type = mtRelief ;
|
map_relief ._type = mtRelief ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Material::detectMaps() {
|
||||||
|
map_diffuse .use_bitmap = !map_diffuse .bitmap_path.isEmpty();
|
||||||
|
map_normal .use_bitmap = !map_normal .bitmap_path.isEmpty();
|
||||||
|
map_metalness.use_bitmap = !map_metalness.bitmap_path.isEmpty();
|
||||||
|
map_roughness.use_bitmap = !map_roughness.bitmap_path.isEmpty();
|
||||||
|
map_emission .use_bitmap = !map_emission .bitmap_path.isEmpty();
|
||||||
|
map_relief .use_bitmap = !map_relief .bitmap_path.isEmpty();
|
||||||
|
}
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ public:
|
|||||||
void load(TextureManager * tm);
|
void load(TextureManager * tm);
|
||||||
void setMapsChanged();
|
void setMapsChanged();
|
||||||
void setTypes();
|
void setTypes();
|
||||||
|
void detectMaps();
|
||||||
QString name;
|
QString name;
|
||||||
QColor color_diffuse;
|
QColor color_diffuse;
|
||||||
QColor color_emission;
|
QColor color_emission;
|
||||||
|
|||||||
125
qglengine/core/hdr.cpp
Normal file
125
qglengine/core/hdr.cpp
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
QGLView
|
||||||
|
Copyright (C) 2019 Ivan Pelipenko peri4ko@yandex.ru
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "hdr_p.h"
|
||||||
|
#include "qmath.h"
|
||||||
|
|
||||||
|
#define RGBE_DATA_RED 2
|
||||||
|
#define RGBE_DATA_GREEN 1
|
||||||
|
#define RGBE_DATA_BLUE 0
|
||||||
|
/* number of floats per pixel */
|
||||||
|
#define RGBE_DATA_SIZE 3
|
||||||
|
|
||||||
|
|
||||||
|
void rgbe2float(float *red, float *green, float *blue, uchar rgbe[4]) {
|
||||||
|
float f;
|
||||||
|
if (rgbe[3]) {
|
||||||
|
f = static_cast<float>(ldexp(1.0,rgbe[3]-(int)(128+8)));
|
||||||
|
*red = rgbe[0] * f;
|
||||||
|
*green = rgbe[1] * f;
|
||||||
|
*blue = rgbe[2] * f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*red = *green = *blue = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* simple read routine. will not correctly handle run length encoding */
|
||||||
|
bool RGBE_ReadPixels(QDataStream * fp, float * data, int numpixels) {
|
||||||
|
uchar rgbe[4];
|
||||||
|
while(numpixels-- > 0) {
|
||||||
|
if (fp->readRawData((char*)rgbe, sizeof(rgbe)) < 1)
|
||||||
|
return false;
|
||||||
|
rgbe2float(&data[RGBE_DATA_RED], &data[RGBE_DATA_GREEN], &data[RGBE_DATA_BLUE],rgbe);
|
||||||
|
data += RGBE_DATA_SIZE;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool RGBE_ReadPixels_RLE(QDataStream * fp, float * data, int scanline_width, int num_scanlines) {
|
||||||
|
uchar rgbe[4], *ptr, *ptr_end;
|
||||||
|
int i, count;
|
||||||
|
uchar buf[2];
|
||||||
|
QByteArray scanline_buffer;
|
||||||
|
|
||||||
|
if ((scanline_width < 8)||(scanline_width > 0x7fff))
|
||||||
|
/* run length encoding is not allowed so read flat*/
|
||||||
|
return RGBE_ReadPixels(fp,data,scanline_width*num_scanlines);
|
||||||
|
scanline_buffer.resize(4*scanline_width);
|
||||||
|
/* read in each successive scanline */
|
||||||
|
while(num_scanlines > 0) {
|
||||||
|
if (fp->readRawData((char*)rgbe,sizeof(rgbe)) < 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((rgbe[0] != 2)||(rgbe[1] != 2)||(rgbe[2] & 0x80)) {
|
||||||
|
/* this file is not run length encoded */
|
||||||
|
rgbe2float(&data[RGBE_DATA_RED],&data[RGBE_DATA_GREEN],&data[RGBE_DATA_BLUE],rgbe);
|
||||||
|
data += RGBE_DATA_SIZE;
|
||||||
|
return RGBE_ReadPixels(fp,data,scanline_width*num_scanlines-1);
|
||||||
|
}
|
||||||
|
if ((((int)rgbe[2])<<8 | rgbe[3]) != scanline_width) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ptr = (uchar*)scanline_buffer.data();
|
||||||
|
/* read each of the four channels for the scanline into the buffer */
|
||||||
|
for(i=0;i<4;i++) {
|
||||||
|
ptr_end = (uchar*)scanline_buffer.data() + ((i+1)*scanline_width);
|
||||||
|
while(ptr < ptr_end) {
|
||||||
|
if (fp->readRawData((char*)buf,sizeof(buf[0])*2) < 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (buf[0] > 128) {
|
||||||
|
/* a run of the same value */
|
||||||
|
count = buf[0]-128;
|
||||||
|
if ((count == 0)||(count > ptr_end - ptr)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
while(count-- > 0)
|
||||||
|
*ptr++ = buf[1];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* a non-run */
|
||||||
|
count = buf[0];
|
||||||
|
if ((count == 0)||(count > ptr_end - ptr)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*ptr++ = buf[1];
|
||||||
|
if (--count > 0) {
|
||||||
|
if (fp->readRawData((char*)ptr,sizeof(*ptr)*count) < 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ptr += count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* now convert data from buffer into floats */
|
||||||
|
for(i=0;i<scanline_width;i++) {
|
||||||
|
rgbe[0] = scanline_buffer[i];
|
||||||
|
rgbe[1] = scanline_buffer[i+scanline_width];
|
||||||
|
rgbe[2] = scanline_buffer[i+2*scanline_width];
|
||||||
|
rgbe[3] = scanline_buffer[i+3*scanline_width];
|
||||||
|
rgbe2float(&data[RGBE_DATA_RED],&data[RGBE_DATA_GREEN],
|
||||||
|
&data[RGBE_DATA_BLUE],rgbe);
|
||||||
|
data += RGBE_DATA_SIZE;
|
||||||
|
}
|
||||||
|
num_scanlines--;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
26
qglengine/core/hdr_p.h
Normal file
26
qglengine/core/hdr_p.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
QGLView
|
||||||
|
Copyright (C) 2019 Ivan Pelipenko peri4ko@yandex.ru
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HDR_P_H
|
||||||
|
#define HDR_P_H
|
||||||
|
|
||||||
|
#include <QDataStream>
|
||||||
|
|
||||||
|
bool RGBE_ReadPixels_RLE(QDataStream * fp, float * data, int scanline_width, int num_scanlines);
|
||||||
|
|
||||||
|
#endif // HDR_P_H
|
||||||
@@ -124,6 +124,7 @@ Material * assimpMaterial(const aiMaterial * m) {
|
|||||||
ret->map_roughness.bitmap_path = aiMatString(m, AI_MATKEY_TEXTURE_SHININESS(0));
|
ret->map_roughness.bitmap_path = aiMatString(m, AI_MATKEY_TEXTURE_SHININESS(0));
|
||||||
ret->map_emission .bitmap_path = aiMatString(m, AI_MATKEY_TEXTURE_EMISSIVE(0));
|
ret->map_emission .bitmap_path = aiMatString(m, AI_MATKEY_TEXTURE_EMISSIVE(0));
|
||||||
ret->transparency = 1.f - aiMatFloat(m, AI_MATKEY_OPACITY, 1.f);
|
ret->transparency = 1.f - aiMatFloat(m, AI_MATKEY_OPACITY, 1.f);
|
||||||
|
ret->detectMaps();
|
||||||
ret->setTypes();
|
ret->setTypes();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,8 +90,9 @@ QGLView::QGLView(): OpenGLWindow(), renderer_(this), mouse(this) {
|
|||||||
//camera().aim_ = camera().pos_;
|
//camera().aim_ = camera().pos_;
|
||||||
ktm_.restart();
|
ktm_.restart();
|
||||||
|
|
||||||
Mesh * m = Primitive::torus(100, 40, 1., 0.4, 360);
|
//Mesh * m = Primitive::torus(100, 40, 1., 0.4, 360);
|
||||||
//Mesh * m = Primitive::coneFrame(10, 1, 1., 2.);
|
Mesh * m = Primitive::cube(10, 10, 10);
|
||||||
|
m->flipNormals();
|
||||||
//QMatrix4x4 mat;
|
//QMatrix4x4 mat;
|
||||||
//mat.rotate(90, 0,1,0);
|
//mat.rotate(90, 0,1,0);
|
||||||
//mat.translate(0, 0, 2);
|
//mat.translate(0, 0, 2);
|
||||||
@@ -178,17 +179,19 @@ void QGLView::render() {
|
|||||||
|
|
||||||
void QGLView::initialize() {
|
void QGLView::initialize() {
|
||||||
checkCaps();
|
checkCaps();
|
||||||
renderer_.reloadShaders();
|
|
||||||
renderer_.init(width(), height());
|
|
||||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
glDisable(GL_MULTISAMPLE);
|
glDisable(GL_MULTISAMPLE);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
glEnable(GL_TEXTURE_CUBE_MAP);
|
||||||
glEnable(GL_TEXTURE_MAX_ANISOTROPY_EXT);
|
glEnable(GL_TEXTURE_MAX_ANISOTROPY_EXT);
|
||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
|
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
|
||||||
glCullFace(GL_BACK);
|
glCullFace(GL_BACK);
|
||||||
|
renderer_.reloadShaders();
|
||||||
|
renderer_.init(width(), height());
|
||||||
is_init = true;
|
is_init = true;
|
||||||
need_init_ = false;
|
need_init_ = false;
|
||||||
emit glInitializeDone();
|
emit glInitializeDone();
|
||||||
|
|||||||
@@ -75,6 +75,12 @@ public:
|
|||||||
QGLView();
|
QGLView();
|
||||||
virtual ~QGLView();
|
virtual ~QGLView();
|
||||||
|
|
||||||
|
enum CameraLightMode {
|
||||||
|
clmOff,
|
||||||
|
clmAuto,
|
||||||
|
clmOn,
|
||||||
|
};
|
||||||
|
|
||||||
enum Feature {
|
enum Feature {
|
||||||
qglFXAA,
|
qglFXAA,
|
||||||
qglAnisotropicLevel,
|
qglAnisotropicLevel,
|
||||||
@@ -102,6 +108,7 @@ public:
|
|||||||
qglDepthOfFieldDiaphragm
|
qglDepthOfFieldDiaphragm
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_ENUM(CameraLightMode)
|
||||||
|
|
||||||
void stop();
|
void stop();
|
||||||
void start(float freq = 60.);
|
void start(float freq = 60.);
|
||||||
@@ -114,6 +121,7 @@ public:
|
|||||||
float gamma() const {return renderer_.gamma_;}
|
float gamma() const {return renderer_.gamma_;}
|
||||||
bool autoExposure() const {return renderer_.tone_proc.enabled;}
|
bool autoExposure() const {return renderer_.tone_proc.enabled;}
|
||||||
int maxAnisotropicLevel() const {return max_anisotropic;}
|
int maxAnisotropicLevel() const {return max_anisotropic;}
|
||||||
|
QString environmentMapFile() const {return renderer_.tex_env.fileHDR();}
|
||||||
|
|
||||||
QColor ambientColor() const {return ambientColor_;}
|
QColor ambientColor() const {return ambientColor_;}
|
||||||
QColor fogColor() const {return fogColor_;}
|
QColor fogColor() const {return fogColor_;}
|
||||||
@@ -164,8 +172,8 @@ public:
|
|||||||
|
|
||||||
Scene * scene() {return scene_;}
|
Scene * scene() {return scene_;}
|
||||||
void focusOn(const Box3D & bb);
|
void focusOn(const Box3D & bb);
|
||||||
void setCameraLightOn(bool on) {renderer_.setCameraLightOn(on);}
|
void setCameraLightMode(CameraLightMode m) {renderer_.setCameraLightMode(m);}
|
||||||
bool isCameraLightOn() const {return renderer_.isCameraLightOn();}
|
CameraLightMode cameraLightMode() const {return (CameraLightMode)renderer_.cameraLightMode();}
|
||||||
|
|
||||||
Camera * camera() {return camera_;}
|
Camera * camera() {return camera_;}
|
||||||
const Camera * camera() const {return camera_;}
|
const Camera * camera() const {return camera_;}
|
||||||
@@ -238,6 +246,7 @@ public slots:
|
|||||||
void setGamma(const float & arg) {renderer_.gamma_ = arg;}
|
void setGamma(const float & arg) {renderer_.gamma_ = arg;}
|
||||||
void setAutoExposure(bool arg) {renderer_.tone_proc.enabled = arg;}
|
void setAutoExposure(bool arg) {renderer_.tone_proc.enabled = arg;}
|
||||||
void setAmbientColor(const QColor & arg) {ambientColor_ = arg;}
|
void setAmbientColor(const QColor & arg) {ambientColor_ = arg;}
|
||||||
|
void setEnvironmentMapFile(QString file) {renderer_.tex_env.setFileHDR(file);}
|
||||||
void setFogColor(const QColor & arg) {fogColor_ = arg;}
|
void setFogColor(const QColor & arg) {fogColor_ = arg;}
|
||||||
void setFogDensity(const float & arg) {fogDensity_ = arg;}
|
void setFogDensity(const float & arg) {fogDensity_ = arg;}
|
||||||
void setFogDecay(const float & arg) {fogDecay_ = arg;}
|
void setFogDecay(const float & arg) {fogDecay_ = arg;}
|
||||||
|
|||||||
@@ -242,3 +242,10 @@ void QGLViewWindow::on_actionScale_triggered(bool on) {
|
|||||||
actionScale ->setChecked(true);
|
actionScale ->setChecked(true);
|
||||||
view->view()->setCurrentAction(RendererService::haScale);
|
view->view()->setCurrentAction(RendererService::haScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include "glcubemap.h"
|
||||||
|
void QGLViewWindow::on_pushButton_3_clicked() {
|
||||||
|
QString f = QFileDialog::getOpenFileName(this, "Select file", "", "*");
|
||||||
|
if (f.isEmpty()) return;
|
||||||
|
}
|
||||||
|
|||||||
@@ -105,6 +105,8 @@ private slots:
|
|||||||
void on_spinFogDensity_valueChanged(double v) {view->view()->setFogDensity(v);}
|
void on_spinFogDensity_valueChanged(double v) {view->view()->setFogDensity(v);}
|
||||||
void on_spinFogDecay_valueChanged(double v) {view->view()->setFogDecay(v);}
|
void on_spinFogDecay_valueChanged(double v) {view->view()->setFogDecay(v);}
|
||||||
|
|
||||||
|
void on_pushButton_3_clicked();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
@@ -80,8 +80,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>945</width>
|
<width>934</width>
|
||||||
<height>636</height>
|
<height>737</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||||
@@ -635,6 +635,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>load HDR</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@@ -741,7 +748,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1107</width>
|
<width>1107</width>
|
||||||
<height>21</height>
|
<height>24</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ using namespace QGLEngineShaders;
|
|||||||
Renderer::Renderer(QGLView * view_): RendererBase(view_),
|
Renderer::Renderer(QGLView * view_): RendererBase(view_),
|
||||||
fbo_ds (view_, QVector<GLenum>() << GL_RGBA16F << GL_RGBA32F << GL_RGBA16F << GL_RGBA16F << GL_RGBA16F),
|
fbo_ds (view_, QVector<GLenum>() << GL_RGBA16F << GL_RGBA32F << GL_RGBA16F << GL_RGBA16F << GL_RGBA16F),
|
||||||
fbo_out (view_, obrBuffersCount, false, GL_RGBA16F),
|
fbo_out (view_, obrBuffersCount, false, GL_RGBA16F),
|
||||||
rend_mat(this), rend_service(this), rend_selection(this), tone_proc(this) {
|
rend_mat(this), rend_service(this), rend_selection(this), tone_proc(this), tex_env(view_, 512) {
|
||||||
quad = Primitive::plane(2., 2.);
|
quad = Primitive::plane(2., 2.);
|
||||||
cam_light = new Light();
|
cam_light = new Light();
|
||||||
cam_light->intensity = 0.75;
|
cam_light->intensity = 0.75;
|
||||||
@@ -69,7 +69,8 @@ Renderer::Renderer(QGLView * view_): RendererBase(view_),
|
|||||||
<< ShaderPair("dof", &shader_dof);*/
|
<< ShaderPair("dof", &shader_dof);*/
|
||||||
shader_fxaa = 0;
|
shader_fxaa = 0;
|
||||||
gamma_ = 1.;
|
gamma_ = 1.;
|
||||||
edit_mode = need_init_shaders = is_camera_light = true;
|
edit_mode = need_init_shaders = true;
|
||||||
|
camera_light_mode = QGLView::clmAuto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -90,6 +91,7 @@ void Renderer::init(int width, int height) {
|
|||||||
initQuad(quad);
|
initQuad(quad);
|
||||||
initTextureArrays();
|
initTextureArrays();
|
||||||
initCoeffTextures();
|
initCoeffTextures();
|
||||||
|
tex_env.init();
|
||||||
need_init_shaders = true;
|
need_init_shaders = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,6 +160,7 @@ void Renderer::initShaders() {
|
|||||||
prog->setUniformValue(QString("tex_%1").arg(i).toLatin1().constData(), i);
|
prog->setUniformValue(QString("tex_%1").arg(i).toLatin1().constData(), i);
|
||||||
prog->setUniformValue("tex_coeffs[0]", (int)Renderer::dbrBuffersCount);
|
prog->setUniformValue("tex_coeffs[0]", (int)Renderer::dbrBuffersCount);
|
||||||
//prog->setUniformValue("tex_coeffs[1]", (int)Renderer::dbrBuffersCount+1);
|
//prog->setUniformValue("tex_coeffs[1]", (int)Renderer::dbrBuffersCount+1);
|
||||||
|
prog->setUniformValue("tex_env", (int)Renderer::dbrBuffersCount+1);
|
||||||
}
|
}
|
||||||
if (bindShader(srFinalPass, &prog)) {
|
if (bindShader(srFinalPass, &prog)) {
|
||||||
prog->setUniformValue("tex_g1" , 0);
|
prog->setUniformValue("tex_g1" , 0);
|
||||||
@@ -238,6 +241,7 @@ void Renderer::renderLight(int first_wr_buff, bool clear_only) {
|
|||||||
}
|
}
|
||||||
fbo_ds.bindColorTextures();
|
fbo_ds.bindColorTextures();
|
||||||
fbo_out.bind();
|
fbo_out.bind();
|
||||||
|
tex_env.bind((int)Renderer::dbrBuffersCount+1);
|
||||||
//int ri = 1, wi = 0;
|
//int ri = 1, wi = 0;
|
||||||
typedef QPair<Renderer::ShaderRole, Light::Type> PassPair;
|
typedef QPair<Renderer::ShaderRole, Light::Type> PassPair;
|
||||||
QVector<PassPair> passes;
|
QVector<PassPair> passes;
|
||||||
@@ -256,6 +260,7 @@ void Renderer::renderLight(int first_wr_buff, bool clear_only) {
|
|||||||
prog->setUniformValue("fog_color", view->fogColor_);
|
prog->setUniformValue("fog_color", view->fogColor_);
|
||||||
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>());
|
||||||
renderQuad(prog, quad, cam);
|
renderQuad(prog, quad, cam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -264,6 +269,7 @@ void Renderer::renderLight(int first_wr_buff, bool clear_only) {
|
|||||||
|
|
||||||
void Renderer::renderScene() {
|
void Renderer::renderScene() {
|
||||||
initShaders();
|
initShaders();
|
||||||
|
tex_env.load();
|
||||||
QOpenGLExtraFunctions * f = view;
|
QOpenGLExtraFunctions * f = view;
|
||||||
Scene & scene(*(view->scene_));
|
Scene & scene(*(view->scene_));
|
||||||
Camera * cam = view->camera();
|
Camera * cam = view->camera();
|
||||||
@@ -289,7 +295,10 @@ void Renderer::renderScene() {
|
|||||||
|
|
||||||
/// lights
|
/// lights
|
||||||
cur_lights = scene.lights_used;
|
cur_lights = scene.lights_used;
|
||||||
if (is_camera_light) {
|
bool use_camlight = (camera_light_mode == QGLView::clmOn);
|
||||||
|
if ((camera_light_mode == QGLView::clmAuto) && cur_lights.isEmpty())
|
||||||
|
use_camlight = true;
|
||||||
|
if (use_camlight) {
|
||||||
cur_lights[Light::Omni] << cam_light;
|
cur_lights[Light::Omni] << cam_light;
|
||||||
cam_light->setPos(cam->pos());
|
cam_light->setPos(cam->pos());
|
||||||
}
|
}
|
||||||
@@ -367,7 +376,7 @@ void Renderer::renderScene() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Renderer::setCameraLightOn(bool on) {
|
void Renderer::setCameraLightMode(int m) {
|
||||||
is_camera_light = on;
|
camera_light_mode = m;
|
||||||
view->scene()->setLightsChanged();
|
view->scene()->setLightsChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "renderer_service.h"
|
#include "renderer_service.h"
|
||||||
#include "renderer_selection.h"
|
#include "renderer_selection.h"
|
||||||
#include "tonemapping_proc.h"
|
#include "tonemapping_proc.h"
|
||||||
|
#include "glcubemap.h"
|
||||||
#include <QQueue>
|
#include <QQueue>
|
||||||
|
|
||||||
|
|
||||||
@@ -82,8 +83,8 @@ public:
|
|||||||
void resize(int width, int height);
|
void resize(int width, int height);
|
||||||
void reloadShaders();
|
void reloadShaders();
|
||||||
void renderScene();
|
void renderScene();
|
||||||
void setCameraLightOn(bool on);
|
void setCameraLightMode(int m);
|
||||||
bool isCameraLightOn() const {return is_camera_light;}
|
int cameraLightMode() const {return camera_light_mode;}
|
||||||
|
|
||||||
QImage materialThumbnail(Material * m) {return rend_mat.materialThumbnail(m);}
|
QImage materialThumbnail(Material * m) {return rend_mat.materialThumbnail(m);}
|
||||||
void recreateMaterialThumbnails(bool force_all = false) {rend_mat.recreateMaterialThumbnails(force_all);}
|
void recreateMaterialThumbnails(bool force_all = false) {rend_mat.recreateMaterialThumbnails(force_all);}
|
||||||
@@ -101,7 +102,8 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
float gamma_;
|
float gamma_;
|
||||||
bool edit_mode, need_init_shaders, is_camera_light, need_render_sum;
|
int camera_light_mode;
|
||||||
|
bool edit_mode, need_init_shaders, need_render_sum;
|
||||||
Framebuffer fbo_ds, fbo_out;
|
Framebuffer fbo_ds, fbo_out;
|
||||||
/*QOpenGLShaderProgram * shader_fxaa, * shader_ds_0, * shader_ds_1, * shader_hdr, * shader_small;
|
/*QOpenGLShaderProgram * shader_fxaa, * shader_ds_0, * shader_ds_1, * shader_hdr, * shader_small;
|
||||||
QOpenGLShaderProgram * shader_bloom_0, * shader_bloom_1, * shader_motion_blur, * shader_fbo_add;
|
QOpenGLShaderProgram * shader_bloom_0, * shader_bloom_1, * shader_motion_blur, * shader_fbo_add;
|
||||||
@@ -119,6 +121,7 @@ private:
|
|||||||
|
|
||||||
Mesh * quad;
|
Mesh * quad;
|
||||||
Light * cam_light;
|
Light * cam_light;
|
||||||
|
CubeTexture tex_env;
|
||||||
|
|
||||||
QPoint mouse_pos;
|
QPoint mouse_pos;
|
||||||
QRect mouse_rect;
|
QRect mouse_rect;
|
||||||
|
|||||||
@@ -115,13 +115,17 @@ void RendererBase::setUniformViewCorners(QOpenGLShaderProgram * prog, Camera * c
|
|||||||
h = viewport.height();
|
h = viewport.height();
|
||||||
}
|
}
|
||||||
QMatrix4x4 mproji = cam->projectionMatrix(w / h).inverted();
|
QMatrix4x4 mproji = cam->projectionMatrix(w / h).inverted();
|
||||||
QVector4D corner_dirs[4];
|
QMatrix4x4 mviewi = cam->viewMatrix().inverted();
|
||||||
|
QVector4D corner_dirs[4], world_dirs[4];
|
||||||
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));
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i) {
|
||||||
|
world_dirs[i] = mviewi.mapVector(corner_dirs[i].toVector3D());
|
||||||
prog->setUniformValue(QString("view_corners[%1]").arg(i).toLatin1().constData(), corner_dirs[i]);
|
prog->setUniformValue(QString("view_corners[%1]").arg(i).toLatin1().constData(), corner_dirs[i]);
|
||||||
|
prog->setUniformValue(QString("world_corners[%1]").arg(i).toLatin1().constData(), world_dirs[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +1,34 @@
|
|||||||
// vert //
|
// vert //
|
||||||
|
|
||||||
out vec3 view_dir;
|
out vec3 view_dir, world_dir;
|
||||||
|
|
||||||
uniform vec4 view_corners[4];
|
uniform vec4 view_corners[4], world_corners[4];
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
qgl_FragTexture = qgl_Texture;
|
qgl_FragTexture = qgl_Texture;
|
||||||
gl_Position = qgl_ftransform();
|
gl_Position = qgl_ftransform();
|
||||||
view_dir = view_corners[gl_VertexID].xyz;
|
view_dir = view_corners [gl_VertexID].xyz;
|
||||||
|
world_dir = world_corners[gl_VertexID].xyz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// frag //
|
// frag //
|
||||||
|
|
||||||
in vec3 view_dir;
|
in vec3 view_dir, world_dir;
|
||||||
|
|
||||||
uniform vec2 dt;
|
uniform vec2 dt;
|
||||||
uniform float z_near;
|
uniform float z_near;
|
||||||
uniform sampler2D tex_coeffs[2];
|
uniform sampler2D tex_coeffs[2];
|
||||||
uniform sampler2D tex_0, tex_1, tex_2, tex_3, tex_4;
|
uniform sampler2D tex_0, tex_1, tex_2, tex_3, tex_4;
|
||||||
|
uniform samplerCube tex_env;
|
||||||
uniform int lights_start, lights_count;
|
uniform int lights_start, lights_count;
|
||||||
|
|
||||||
uniform vec4 fog_color = vec4(0.5, 0.5, 0.5, 1);
|
uniform vec4 fog_color = vec4(0.5, 0.5, 0.5, 1);
|
||||||
uniform float fog_decay = 10, fog_density = 0;
|
uniform float fog_decay = 10, fog_density = 0;
|
||||||
|
uniform mat3 view_mat;
|
||||||
|
|
||||||
const vec3 luma = vec3(0.299, 0.587, 0.114);
|
const vec3 luma = vec3(0.299, 0.587, 0.114);
|
||||||
const float _min_rough = 1.e-8;
|
const float _min_rough = 1.e-8, max_lod = 8;
|
||||||
|
|
||||||
vec4 pos, lpos, shp;
|
vec4 pos, lpos, shp;
|
||||||
vec3 li, si, ldir, halfV, bn, bn2, lwdir;
|
vec3 li, si, ldir, halfV, bn, bn2, lwdir;
|
||||||
@@ -154,11 +157,14 @@ void main(void) {
|
|||||||
li *= (1 - shlick);
|
li *= (1 - shlick);
|
||||||
alpha = min(1, alpha * (1 + shlick));
|
alpha = min(1, alpha * (1 + shlick));
|
||||||
|
|
||||||
vec2 brdf = texture(tex_coeffs[0], vec2(NdotV*0.99, roughness3*0.995)).rg;
|
vec2 brdf = texture(tex_coeffs[0], vec2(NdotV*0.99, roughness*0.995)).rg;
|
||||||
float env_spec = shlick * brdf.x + brdf.y;
|
float env_spec = shlick * brdf.x + brdf.y;
|
||||||
|
vec3 spec_col = mix(vec3(1), diffuse, metalness);
|
||||||
|
vec3 env_dir = view_mat * reflect(-v, normal);
|
||||||
|
vec3 env_col = textureLod(tex_env, env_dir, sqrt(roughness) * max_lod).rgb * spec_col;
|
||||||
|
|
||||||
vec3 res_col = max(vec3(0), li * diffuse + si * mix(vec3(1), diffuse, metalness) + emission);
|
vec3 res_col = max(vec3(0), li * diffuse + si * spec_col + emission);
|
||||||
res_col = mix(res_col, fog_color.rgb, env_spec);
|
res_col = mix(res_col, env_col, env_spec * reflectivity);
|
||||||
|
|
||||||
float plen = length(pos.xyz);
|
float plen = length(pos.xyz);
|
||||||
float fog = 1 - exp(-plen / fog_decay);
|
float fog = 1 - exp(-plen / fog_decay);
|
||||||
@@ -169,6 +175,7 @@ void main(void) {
|
|||||||
|
|
||||||
//vec3 specular = prefilteredColor * (F * envBRDF.x + envBRDF.y);
|
//vec3 specular = prefilteredColor * (F * envBRDF.x + envBRDF.y);
|
||||||
//qgl_FragColor.rgb = vec3(shlick * brdf.x + brdf.y);
|
//qgl_FragColor.rgb = vec3(shlick * brdf.x + brdf.y);
|
||||||
//qgl_FragColor.rgb = vec3(env_spec);
|
//qgl_FragColor.rgb = vec3(alpha);
|
||||||
//qgl_FragColor.rgb = vec3(1-GeometrySchlickGGX(dot(normal, v),roughness));
|
//qgl_FragColor.rgb = vec3(textureLod(tex_env, world_dir, 0).rgb);
|
||||||
|
//qgl_FragColor.a = 1.;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ TonemappingProc::TonemappingProc(Renderer * rend): QThread(), r(rend),
|
|||||||
timer_delim = 0;
|
timer_delim = 0;
|
||||||
frame_max = cur_max = 1.;
|
frame_max = cur_max = 1.;
|
||||||
need_render_sum = exit_ = false;
|
need_render_sum = exit_ = false;
|
||||||
enabled = true;
|
enabled = false;
|
||||||
timer_tone = startTimer(10);
|
timer_tone = startTimer(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "view_editor.h"
|
#include "view_editor.h"
|
||||||
#include "ui_view_editor.h"
|
#include "ui_view_editor.h"
|
||||||
|
#include <QFileDialog>
|
||||||
#include <colorbutton.h>
|
#include <colorbutton.h>
|
||||||
#include <spinslider.h>
|
#include <spinslider.h>
|
||||||
|
|
||||||
@@ -27,6 +28,7 @@ ViewEditor::ViewEditor(QWidget * parent): QWidget(parent) {
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
view = 0;
|
view = 0;
|
||||||
active = true;
|
active = true;
|
||||||
|
ui->checkCameraLight->setCheckState(Qt::PartiallyChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -44,7 +46,10 @@ void ViewEditor::assignQGLView(QGLView * v) {
|
|||||||
ui->colorSelectionHalo->setColor(view->selectionHaloColor());
|
ui->colorSelectionHalo->setColor(view->selectionHaloColor());
|
||||||
ui->checkFXAA->setChecked(view->isFeatureEnabled(QGLView::qglFXAA));
|
ui->checkFXAA->setChecked(view->isFeatureEnabled(QGLView::qglFXAA));
|
||||||
ui->checkCameraOrbit->setChecked(view->isCameraOrbit());
|
ui->checkCameraOrbit->setChecked(view->isCameraOrbit());
|
||||||
|
ui->checkCameraLight->setCheckState((Qt::CheckState)view->cameraLightMode());
|
||||||
ui->checkService->setChecked(view->isServiceMode());
|
ui->checkService->setChecked(view->isServiceMode());
|
||||||
|
ui->lineHDR->setProperty("GLpath", view->environmentMapFile());
|
||||||
|
ui->lineHDR->setText(QFileInfo(view->environmentMapFile()).fileName());
|
||||||
active = true;
|
active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,13 +145,32 @@ void ViewEditor::on_checkCameraOrbit_clicked(bool val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ViewEditor::on_checkCameraLight_clicked(bool val) {
|
|
||||||
if (!view || !active) return;
|
|
||||||
view->setCameraLightOn(val);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ViewEditor::on_checkService_clicked(bool val) {
|
void ViewEditor::on_checkService_clicked(bool val) {
|
||||||
if (!view || !active) return;
|
if (!view || !active) return;
|
||||||
view->setServiceMode(val);
|
view->setServiceMode(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ViewEditor::on_checkCameraLight_stateChanged(int s) {
|
||||||
|
if (!view || !active) return;
|
||||||
|
view->setCameraLightMode((QGLView::CameraLightMode)s);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ViewEditor::on_buttonHDRClear_clicked() {
|
||||||
|
if (!view || !active) return;
|
||||||
|
ui->lineHDR->setText("");
|
||||||
|
ui->lineHDR->setProperty("GLpath", "");
|
||||||
|
view->setEnvironmentMapFile("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ViewEditor::on_buttonHDRSelect_clicked() {
|
||||||
|
if (!view || !active) return;
|
||||||
|
QString str = QFileDialog::getOpenFileName(this, "Select image", ui->lineHDR->property("GLpath").toString(), "Radiance HDR(*.hdr)");
|
||||||
|
if (str.isEmpty()) return;
|
||||||
|
ui->lineHDR->setText(QFileInfo(str).fileName());
|
||||||
|
ui->lineHDR->setProperty("GLpath", str);
|
||||||
|
view->setEnvironmentMapFile(str);
|
||||||
|
}
|
||||||
|
|||||||
@@ -55,8 +55,10 @@ private slots:
|
|||||||
void on_checkAutoExposure_toggled(bool val);
|
void on_checkAutoExposure_toggled(bool val);
|
||||||
void on_checkFXAA_clicked(bool val);
|
void on_checkFXAA_clicked(bool val);
|
||||||
void on_checkCameraOrbit_clicked(bool val);
|
void on_checkCameraOrbit_clicked(bool val);
|
||||||
void on_checkCameraLight_clicked(bool val);
|
|
||||||
void on_checkService_clicked(bool val);
|
void on_checkService_clicked(bool val);
|
||||||
|
void on_checkCameraLight_stateChanged(int s);
|
||||||
|
void on_buttonHDRClear_clicked();
|
||||||
|
void on_buttonHDRSelect_clicked();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,65 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_22">
|
||||||
|
<property name="text">
|
||||||
|
<string>Gamma:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="SpinSlider" name="spinViewGamma">
|
||||||
|
<property name="minimum">
|
||||||
|
<double>0.010000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>5.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="decimals">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Env HDR:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineHDR"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="buttonHDRClear">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../qad/utils/qad_utils.qrc">
|
||||||
|
<normaloff>:/icons/edit-delete.png</normaloff>:/icons/edit-delete.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="buttonHDRSelect">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../qad/application/qad_application.qrc">
|
||||||
|
<normaloff>:/icons/document-open.png</normaloff>:/icons/document-open.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -90,9 +149,6 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Auto exposure</string>
|
<string>Auto exposure</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
@@ -105,6 +161,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QCheckBox" name="checkCameraLight">
|
||||||
|
<property name="text">
|
||||||
|
<string>Camera light</string>
|
||||||
|
</property>
|
||||||
|
<property name="tristate">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -112,117 +178,86 @@
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Camera</string>
|
<string>Camera</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item row="1" column="2">
|
<item>
|
||||||
<widget class="QLabel" name="label_22">
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
<property name="text">
|
<item>
|
||||||
<string>Gamma:</string>
|
<widget class="QCheckBox" name="checkCameraOrbit">
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="alignment">
|
<string>Orbit</string>
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
</property>
|
||||||
</property>
|
<property name="checked">
|
||||||
</widget>
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>1</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>FOV:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="SpinSlider" name="spinFOV">
|
||||||
|
<property name="minimum">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>179.900000000000006</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>60.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="3">
|
<item>
|
||||||
<widget class="SpinSlider" name="spinViewGamma">
|
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||||
<property name="minimum">
|
<item>
|
||||||
<double>0.010000000000000</double>
|
<widget class="QLabel" name="label_5">
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="maximum">
|
<string>Depth start:</string>
|
||||||
<double>5.000000000000000</double>
|
</property>
|
||||||
</property>
|
<property name="alignment">
|
||||||
<property name="value">
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
<double>1.000000000000000</double>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
<property name="decimals">
|
</item>
|
||||||
<number>2</number>
|
<item>
|
||||||
</property>
|
<widget class="QDoubleSpinBox" name="spinDepthStart">
|
||||||
</widget>
|
<property name="decimals">
|
||||||
</item>
|
<number>3</number>
|
||||||
<item row="0" column="1" rowspan="2">
|
</property>
|
||||||
<spacer name="horizontalSpacer">
|
<property name="maximum">
|
||||||
<property name="orientation">
|
<double>999999999.000000000000000</double>
|
||||||
<enum>Qt::Horizontal</enum>
|
</property>
|
||||||
</property>
|
<property name="stepType">
|
||||||
<property name="sizeType">
|
<enum>QAbstractSpinBox::AdaptiveDecimalStepType</enum>
|
||||||
<enum>QSizePolicy::Preferred</enum>
|
</property>
|
||||||
</property>
|
<property name="value">
|
||||||
<property name="sizeHint" stdset="0">
|
<double>1.000000000000000</double>
|
||||||
<size>
|
</property>
|
||||||
<width>20</width>
|
</widget>
|
||||||
<height>1</height>
|
</item>
|
||||||
</size>
|
</layout>
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>FOV:</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QCheckBox" name="checkCameraLight">
|
|
||||||
<property name="text">
|
|
||||||
<string>CamLight</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3">
|
|
||||||
<widget class="SpinSlider" name="spinFOV">
|
|
||||||
<property name="minimum">
|
|
||||||
<double>0.100000000000000</double>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<double>179.900000000000006</double>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<double>60.000000000000000</double>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QCheckBox" name="checkCameraOrbit">
|
|
||||||
<property name="text">
|
|
||||||
<string>Orbit</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>Depth start:</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1" colspan="3">
|
|
||||||
<widget class="QDoubleSpinBox" name="spinDepthStart">
|
|
||||||
<property name="decimals">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<double>999999999.000000000000000</double>
|
|
||||||
</property>
|
|
||||||
<property name="stepType">
|
|
||||||
<enum>QAbstractSpinBox::AdaptiveDecimalStepType</enum>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<double>1.000000000000000</double>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -468,6 +503,9 @@
|
|||||||
<header>colorbutton.h</header>
|
<header>colorbutton.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="../../qad/utils/qad_utils.qrc"/>
|
||||||
|
<include location="../../qad/application/qad_application.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
Reference in New Issue
Block a user