git-svn-id: svn://db.shs.com.ru/libs@544 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -173,7 +173,7 @@ void GLTextureManagerBase::convertToNormal(QImage & im) {
|
||||
sum[1] /= wh;
|
||||
sum[2] /= wh;
|
||||
qDebug() << sum[0] << sum[1] << sum[2];
|
||||
if ((qAbs(sum[0]) <= 0.05f) && (qAbs(sum[1]) <= 0.05f) && (sum[2] >= 0.4f)) /// already normal
|
||||
if ((qAbs(sum[0]) <= 0.05f) && (qAbs(sum[1]) <= 0.05f) && (sum[2] >= 0.25f)) /// already normal
|
||||
return;
|
||||
qDebug() << "convert to bump";
|
||||
QImage dim = QImage(sim.width(), sim.height(), QImage::Format_ARGB32);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <QPainter>
|
||||
|
||||
//__GLWidget__ * currentQGLView;
|
||||
QMutex globMutex;
|
||||
//QMutex globMutex;
|
||||
|
||||
|
||||
QString readCharsUntilNull(QDataStream & s) {
|
||||
|
||||
@@ -141,8 +141,8 @@ inline float urand(const float & scale = 1.) {return ((float)rand() / RAND_MAX -
|
||||
inline float uprand(const float & scale = 1.) {return ((float)rand() / RAND_MAX) * scale;}
|
||||
QString readCharsUntilNull(QDataStream & s);
|
||||
QString findFile(const QString & file, const QStringList & pathes);
|
||||
inline QColor operator *(const QColor & c, float v) {return QColor(c.red() * v, c.green() * v, c.blue() * v, c.alpha() * v);}
|
||||
inline QColor operator /(const QColor & c, float v) {return QColor(c.red() / v, c.green() / v, c.blue() / v, c.alpha() / v);}
|
||||
inline QColor operator *(const QColor & c, float v) {return QColor(piClamp<int>(c.red() * v, 0, 255), piClamp<int>(c.green() * v, 0, 255), piClamp<int>(c.blue() * v, 0, 255), piClamp<int>(c.alpha() * v, 0, 255));}
|
||||
inline QColor operator /(const QColor & c, float v) {return QColor(piClamp<int>(c.red() / v, 0, 255), piClamp<int>(c.green() / v, 0, 255), piClamp<int>(c.blue() / v, 0, 255), piClamp<int>(c.alpha() / v, 0, 255));}
|
||||
|
||||
//extern __GLWidget__ * currentQGLView;
|
||||
|
||||
|
||||
@@ -153,15 +153,11 @@ QVector<Material> LoaderDAE::readMaterials(QDomElement le, QDomElement li, bool
|
||||
if (!text.isEmpty()) mat.map_normal.bitmap_path = text;
|
||||
|
||||
ret << mat;
|
||||
/*
|
||||
qDebug() << "** Material" << mat.name;
|
||||
qDebug() << " emission" << mat.color_self_illumination;
|
||||
qDebug() << " diffuse" << mat.color_diffuse;
|
||||
qDebug() << " diffuse" << mat.diffuse.bitmap_path;
|
||||
qDebug() << " specular" << mat.color_specular;
|
||||
qDebug() << " bump" << mat.bump.bitmap_path;
|
||||
qDebug() << " transparency" << mat.transparency;
|
||||
*/
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -318,7 +314,7 @@ GLObjectBase * loadFromDAEFile(const QString & filepath, float scale) {
|
||||
co->setName(name + "_" + QString::number(j));
|
||||
//co->setTransform(m);
|
||||
co->material() = LoaderDAE::materialByName(materials, matname);
|
||||
//qDebug() << " tri" << co->material().color_diffuse << matname;
|
||||
qDebug() << " tri" << co->material().name << matname;
|
||||
QVector<GLfloat> & vertices(co->VBO().vertices()), & normals(co->VBO().normals()), & uvs(co->VBO().texcoords());
|
||||
for (int k = 0; k < einp.count(); ++k) {
|
||||
QDomElement di = einp.at(k).toElement();
|
||||
@@ -366,6 +362,7 @@ GLObjectBase * loadFromDAEFile(const QString & filepath, float scale) {
|
||||
if (!ml.isEmpty()) lo->intensity = ml.at(0).firstChild().nodeValue().toFloat();
|
||||
ml = dn.elementsByTagName("intensity");
|
||||
if (!ml.isEmpty()) lo->intensity = ml.at(0).firstChild().nodeValue().toFloat();
|
||||
lo->setColor(lo->color() / lo->intensity);
|
||||
QString sv;
|
||||
sv = dl.firstChildElement("constant_attenuation").firstChild().nodeValue(); if (!sv.isEmpty()) lo->decay_const = sv.toFloat();
|
||||
sv = dl.firstChildElement("linear_attenuation").firstChild().nodeValue(); if (!sv.isEmpty()) lo->decay_linear = sv.toFloat();
|
||||
|
||||
@@ -23,7 +23,7 @@ OpenGLWindow::OpenGLWindow(QWindow *parent)
|
||||
}
|
||||
#endif
|
||||
format.setDepthBufferSize(24);
|
||||
// format.setSamples(4);
|
||||
format.setSamples(8);
|
||||
// format.setStencilBufferSize(8);
|
||||
setFormat(format);
|
||||
QSurfaceFormat::setDefaultFormat(format);
|
||||
|
||||
@@ -121,6 +121,7 @@ GLRendererBase * QGLView::renderer() {
|
||||
return renderer_;
|
||||
}
|
||||
|
||||
|
||||
void QGLView::setRenderer(GLRendererBase * r, GLRendererBase ** prev) {
|
||||
if (prev != nullptr) *prev = renderer_;
|
||||
renderer_ = r;
|
||||
@@ -235,9 +236,7 @@ void QGLView::selectObject(GLObjectBase * o) {
|
||||
|
||||
|
||||
void QGLView::resizeEvent(QResizeEvent * e) {
|
||||
// if (isExposed())
|
||||
// resizeGL(width(), height());
|
||||
/* QWindow::resizeEvent(e);*/
|
||||
renderLater();
|
||||
}
|
||||
|
||||
void QGLView::timerEvent(QTimerEvent *) {
|
||||
@@ -509,6 +508,8 @@ void QGLView::renderSingleSelection(GLObjectBase & o) {
|
||||
QMatrix4x4 curview = start_rp.view_matrix * start_rp.cam_offset_matrix * o.itransform_;
|
||||
uint id = qHash((quint64)&o);
|
||||
ids.insert(id, &o);
|
||||
glLineWidth(o.line_width > 0.f ? o.line_width : lineWidth_);
|
||||
glPointSize(o.line_width > 0.f ? o.line_width : lineWidth_);
|
||||
if (shaders_supported){
|
||||
if (shader_select) {
|
||||
if (shader_select->isLinked()) {
|
||||
@@ -620,11 +621,13 @@ void QGLView::applyFog() {
|
||||
void QGLView::resizeGL(int width, int height) {
|
||||
if (!is_init) return;
|
||||
if (width <= 0 || height <= 0) return;
|
||||
if (prev_size == QSize(width, height)) return;
|
||||
prev_size = QSize(width, height);
|
||||
aspect = float(width) / float(height);
|
||||
if (renderer_) renderer_->resize(width, height);
|
||||
mouse_first = true;
|
||||
//qDebug() << "resize" << width << height;
|
||||
fbo_selection.resize(width, height);
|
||||
mouse_first = true;
|
||||
iaspect = (aspect == 0.f) ? 0. : 1 / aspect;
|
||||
glViewport(0, 0, width, height);
|
||||
emit glResize(width, height);
|
||||
@@ -632,6 +635,7 @@ void QGLView::resizeGL(int width, int height) {
|
||||
|
||||
|
||||
void QGLView::mouseReleaseEvent(QMouseEvent * e) {
|
||||
// qDebug() << "mouseReleaseEvent" << e << isActive();
|
||||
// QGraphicsView::mouseReleaseEvent(e);
|
||||
//setCursor(QCursor(Qt::ArrowCursor));
|
||||
selecting_ = false;
|
||||
@@ -646,6 +650,7 @@ void QGLView::mouseReleaseEvent(QMouseEvent * e) {
|
||||
|
||||
|
||||
void QGLView::mousePressEvent(QMouseEvent * e) {
|
||||
// qDebug() << "mousePressEvent" << e << isActive();
|
||||
// QGraphicsView::mousePressEvent(e);
|
||||
// mouseThis_ = (scene()->itemAt(mapToScene(e->pos()) , QTransform() ) == 0);
|
||||
selecting_ = false;
|
||||
@@ -661,13 +666,13 @@ void QGLView::mousePressEvent(QMouseEvent * e) {
|
||||
|
||||
|
||||
void QGLView::mouseMoveEvent(QMouseEvent * e) {
|
||||
// qDebug() << e->pos();
|
||||
// qDebug() << "mouseMoveEvent" << e << isActive();
|
||||
// QGraphicsView::mouseMoveEvent(e);
|
||||
//lastPos = e->pos();
|
||||
if (selecting_) {
|
||||
|
||||
return;
|
||||
}
|
||||
// if (!QRect(QPoint(), size()).contains(e->pos())) return;
|
||||
//if (scene()->itemAt(mapToScene(e->pos())) != 0) return;
|
||||
///qDebug() << e->x() << e->y();
|
||||
QRect g_rect(QPoint(), size());
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
Q_ENUMS (SelectionMode)
|
||||
|
||||
void stop();
|
||||
void start(float freq = 40.);
|
||||
void start(float freq = 60.);
|
||||
|
||||
GLRendererBase * renderer();
|
||||
void setRenderer(GLRendererBase * r, GLRendererBase ** prev = nullptr);
|
||||
@@ -232,6 +232,7 @@ private:
|
||||
Qt::KeyboardModifier sel_mod;
|
||||
GLRendererBase::RenderingParameters start_rp;
|
||||
QHash<int, QVariant> features_;
|
||||
QSize prev_size;
|
||||
float lineWidth_;
|
||||
float fogDensity_, fogStart_, fogEnd_, fps_, fps_tm, hoverHaloFill_, selectionHaloFill_, m_motionBlurFactor;
|
||||
int timer, fps_cnt, sh_id_loc;
|
||||
|
||||
@@ -335,3 +335,4 @@ void QGLViewWindow::on_pushButton_3_clicked() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ private slots:
|
||||
void on_colorBack_colorChanged(QColor color) {view->view()->setBackColor(color);}
|
||||
void on_colorAmbient_colorChanged(QColor color) {view->view()->setAmbientColor(color);}
|
||||
void on_checkCameraOrbit_clicked(bool val) {view->view()->setCameraOrbit(val);}
|
||||
void on_spinViewLineWidth_valueChanged(double val) {view->view()->setLineWidth(val);}
|
||||
|
||||
void on_groupShadows_clicked(bool val) {view->view()->setFeature(QGLView::qglShadowsEnabled, val);}
|
||||
void on_groupEyeAccomodation_clicked(bool val) {view->view()->setFeature(QGLView::qglEyeAccomodationEnabled, val);}
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@@ -96,6 +96,56 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Depth</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="spinDepthStart">
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> - </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="spinDepthEnd">
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
@@ -154,6 +204,24 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Back color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="ColorButton" name="colorBack">
|
||||
<property name="color">
|
||||
<color>
|
||||
<red>10</red>
|
||||
<green>10</green>
|
||||
<blue>10</blue>
|
||||
</color>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
@@ -172,21 +240,21 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkMSAA">
|
||||
<property name="text">
|
||||
<string>MSAA</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkFXAA">
|
||||
<property name="text">
|
||||
<string>FXAA</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupHoverHalo">
|
||||
<property name="title">
|
||||
<string>Hover halo</string>
|
||||
@@ -241,7 +309,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="2">
|
||||
<item row="10" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupSelectionHalo">
|
||||
<property name="title">
|
||||
<string>Selection halo</string>
|
||||
@@ -296,7 +364,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="2">
|
||||
<item row="11" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupCamera">
|
||||
<property name="title">
|
||||
<string>Camera</string>
|
||||
@@ -322,71 +390,26 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Depth</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="spinDepthStart">
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
<item row="6" column="1">
|
||||
<widget class="QDoubleSpinBox" name="spinViewLineWidth">
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
<double>99999.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string> - </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="spinDepthEnd">
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Back color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="ColorButton" name="colorBack">
|
||||
<property name="color">
|
||||
<color>
|
||||
<red>10</red>
|
||||
<green>10</green>
|
||||
<blue>10</blue>
|
||||
</color>
|
||||
<string>Line width</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user