git-svn-id: svn://db.shs.com.ru/libs@556 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -90,7 +90,7 @@ void GLFramebuffer::bind() {
|
|||||||
if (is_changed) resize(wid, hei);
|
if (is_changed) resize(wid, hei);
|
||||||
if (fbo == 0) return;
|
if (fbo == 0) return;
|
||||||
initializeOpenGLFunctions();
|
initializeOpenGLFunctions();
|
||||||
glFlush();
|
//glFlush();
|
||||||
glGetIntegerv(GL_VIEWPORT, prev_view);
|
glGetIntegerv(GL_VIEWPORT, prev_view);
|
||||||
//glClearError();
|
//glClearError();
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||||
@@ -108,7 +108,7 @@ void GLFramebuffer::bind() {
|
|||||||
void GLFramebuffer::release() {
|
void GLFramebuffer::release() {
|
||||||
is_changed = false;
|
is_changed = false;
|
||||||
if (fbo == 0) return;
|
if (fbo == 0) return;
|
||||||
glFlush();
|
//glFlush();
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
glViewport(prev_view[0], prev_view[1], prev_view[2], prev_view[3]);
|
glViewport(prev_view[0], prev_view[1], prev_view[2], prev_view[3]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ bool loadShaders(QOpenGLShaderProgram * prog, const QString & name, const QStrin
|
|||||||
//qDebug() << "[QGLView] Shader \"" + name + "\" load shaders from" << d.absolutePath();
|
//qDebug() << "[QGLView] Shader \"" + name + "\" load shaders from" << d.absolutePath();
|
||||||
sl = d.entryInfoList(QStringList(name + ".geom"), QDir::Files | QDir::NoDotAndDotDot);
|
sl = d.entryInfoList(QStringList(name + ".geom"), QDir::Files | QDir::NoDotAndDotDot);
|
||||||
foreach (const QFileInfo & i, sl) {
|
foreach (const QFileInfo & i, sl) {
|
||||||
qDebug() << "[QGLView] Shader \"" + name + "\" add geometry shader:" << i.fileName();
|
//qDebug() << "[QGLView] Shader \"" + name + "\" add geometry shader:" << i.fileName();
|
||||||
loadShaderFile(prog, QOpenGLShader::Geometry, i.absoluteFilePath());
|
loadShaderFile(prog, QOpenGLShader::Geometry, i.absoluteFilePath());
|
||||||
}
|
}
|
||||||
sl = d.entryInfoList(QStringList(name + ".vert"), QDir::Files | QDir::NoDotAndDotDot);
|
sl = d.entryInfoList(QStringList(name + ".vert"), QDir::Files | QDir::NoDotAndDotDot);
|
||||||
|
|||||||
@@ -62,11 +62,42 @@ void glDrawQuad(QOpenGLShaderProgram * prog, QVector4D * corner_dirs, GLfloat x,
|
|||||||
locc = prog ? prog->attributeLocation("view_corner") : 0;
|
locc = prog ? prog->attributeLocation("view_corner") : 0;
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
QOpenGLFunctions *glFuncs = QOpenGLContext::currentContext()->functions();
|
QOpenGLFunctions *glFuncs = QOpenGLContext::currentContext()->functions();
|
||||||
if (prog) {glFuncs->glVertexAttrib3f(loc, 1.f, 1.f, 1.f);} glColor3f(1.f, 1.f, 1.f);
|
if (prog) {
|
||||||
if (prog) {if (corner_dirs) prog->setAttributeValue(locc, corner_dirs[0]); glFuncs->glVertexAttrib2f(loct, 0.f, 0.f); glFuncs->glVertexAttrib2f(locv, x, y);} glTexCoord2f(0.f, 0.f); glVertex2f(x, y);
|
glFuncs->glVertexAttrib3f(loc, 1.f, 1.f, 1.f);
|
||||||
if (prog) {if (corner_dirs) prog->setAttributeValue(locc, corner_dirs[1]); glFuncs->glVertexAttrib2f(loct, 1.f, 0.f); glFuncs->glVertexAttrib2f(locv, x + w, y);} glTexCoord2f(1.f, 0.f); glVertex2f(x + w, y);
|
}
|
||||||
if (prog) {if (corner_dirs) prog->setAttributeValue(locc, corner_dirs[2]); glFuncs->glVertexAttrib2f(loct, 1.f, 1.f); glFuncs->glVertexAttrib2f(locv, x + w, y + h);} glTexCoord2f(1.f, 1.f); glVertex2f(x + w, y + h);
|
glColor3f(1.f, 1.f, 1.f);
|
||||||
if (prog) {if (corner_dirs) prog->setAttributeValue(locc, corner_dirs[3]); glFuncs->glVertexAttrib2f(loct, 0.f, 1.f); glFuncs->glVertexAttrib2f(locv, x, y + h);} glTexCoord2f(0.f, 1.f); glVertex2f(x, y + h);
|
if (prog) {
|
||||||
|
if (corner_dirs)
|
||||||
|
prog->setAttributeValue(locc, corner_dirs[0]);
|
||||||
|
glFuncs->glVertexAttrib2f(loct, 0.f, 0.f);
|
||||||
|
glFuncs->glVertexAttrib2f(locv, x, y);
|
||||||
|
}
|
||||||
|
glTexCoord2f(0.f, 0.f);
|
||||||
|
glVertex2f(x, y);
|
||||||
|
if (prog) {
|
||||||
|
if (corner_dirs)
|
||||||
|
prog->setAttributeValue(locc, corner_dirs[1]);
|
||||||
|
glFuncs->glVertexAttrib2f(loct, 1.f, 0.f);
|
||||||
|
glFuncs->glVertexAttrib2f(locv, x + w, y);
|
||||||
|
}
|
||||||
|
glTexCoord2f(1.f, 0.f);
|
||||||
|
glVertex2f(x + w, y);
|
||||||
|
if (prog) {
|
||||||
|
if (corner_dirs)
|
||||||
|
prog->setAttributeValue(locc, corner_dirs[2]);
|
||||||
|
glFuncs->glVertexAttrib2f(loct, 1.f, 1.f);
|
||||||
|
glFuncs->glVertexAttrib2f(locv, x + w, y + h);
|
||||||
|
}
|
||||||
|
glTexCoord2f(1.f, 1.f);
|
||||||
|
glVertex2f(x + w, y + h);
|
||||||
|
if (prog) {
|
||||||
|
if (corner_dirs)
|
||||||
|
prog->setAttributeValue(locc, corner_dirs[3]);
|
||||||
|
glFuncs->glVertexAttrib2f(loct, 0.f, 1.f);
|
||||||
|
glFuncs->glVertexAttrib2f(locv, x, y + h);
|
||||||
|
}
|
||||||
|
glTexCoord2f(0.f, 1.f);
|
||||||
|
glVertex2f(x, y + h);
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "glwidget.h"
|
#include "glwidget.h"
|
||||||
#include "qglview.h"
|
#include "renderer_simple.h"
|
||||||
|
#include "renderer_deferred_shading.h"
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
|
||||||
@@ -22,22 +23,22 @@ QColor GLWidget::backColor() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float GLWidget::lineWidth() const {
|
qreal GLWidget::lineWidth() const {
|
||||||
return view_->lineWidth();
|
return view_->lineWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float GLWidget::FOV() const {
|
qreal GLWidget::FOV() const {
|
||||||
return view_->FOV();
|
return view_->FOV();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float GLWidget::depthStart() const {
|
qreal GLWidget::depthStart() const {
|
||||||
return view_->depthStart();
|
return view_->depthStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float GLWidget::depthEnd() const {
|
qreal GLWidget::depthEnd() const {
|
||||||
return view_->depthEnd();
|
return view_->depthEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ QColor GLWidget::hoverHaloColor() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float GLWidget::hoverHaloFillAlpha() const {
|
qreal GLWidget::hoverHaloFillAlpha() const {
|
||||||
return view_->hoverHaloFillAlpha();
|
return view_->hoverHaloFillAlpha();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,18 +99,22 @@ QColor GLWidget::selectionHaloColor() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float GLWidget::selectionHaloFillAlpha() const {
|
qreal GLWidget::selectionHaloFillAlpha() const {
|
||||||
return view_->selectionHaloFillAlpha();
|
return view_->selectionHaloFillAlpha();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLWidget::stop() {
|
void GLWidget::stop() {
|
||||||
return view_->stop();
|
view_->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLWidget::start(float freq) {
|
void GLWidget::start(float freq, GLRendererBase * r) {
|
||||||
return view_->start(freq);
|
if (r == nullptr) r = new RendererSimple(view_);
|
||||||
|
GLRendererBase * pr = nullptr;
|
||||||
|
view_->setRenderer(r, &pr);
|
||||||
|
if (pr != nullptr) delete pr;
|
||||||
|
view_->start(freq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -118,22 +123,22 @@ void GLWidget::setBackColor(const QColor & c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLWidget::setLineWidth(const float & arg) {
|
void GLWidget::setLineWidth(const qreal & arg) {
|
||||||
view_->setLineWidth(arg);
|
view_->setLineWidth(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLWidget::setFOV(const float & arg) {
|
void GLWidget::setFOV(const qreal & arg) {
|
||||||
view_->setFOV(arg);
|
view_->setFOV(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLWidget::setDepthStart(const float & arg) {
|
void GLWidget::setDepthStart(const qreal & arg) {
|
||||||
view_->setDepthStart(arg);
|
view_->setDepthStart(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLWidget::setDepthEnd(const float & arg) {
|
void GLWidget::setDepthEnd(const qreal & arg) {
|
||||||
view_->setDepthEnd(arg);
|
view_->setDepthEnd(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,7 +183,7 @@ void GLWidget::setHoverHaloColor(const QColor & arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLWidget::setHoverHaloFillAlpha(const float & arg) {
|
void GLWidget::setHoverHaloFillAlpha(const qreal & arg) {
|
||||||
view_->setHoverHaloFillAlpha(arg);
|
view_->setHoverHaloFillAlpha(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,7 +198,7 @@ void GLWidget::setSelectionHaloColor(const QColor & arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLWidget::setSelectionHaloFillAlpha(const float & arg) {
|
void GLWidget::setSelectionHaloFillAlpha(const qreal & arg) {
|
||||||
view_->setSelectionHaloFillAlpha(arg);
|
view_->setSelectionHaloFillAlpha(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,15 +5,16 @@
|
|||||||
|
|
||||||
|
|
||||||
class QGLView;
|
class QGLView;
|
||||||
|
class GLRendererBase;
|
||||||
|
|
||||||
class GLWidget : public QWidget
|
class GLWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY (QColor backColor READ backColor WRITE setBackColor)
|
Q_PROPERTY (QColor backColor READ backColor WRITE setBackColor)
|
||||||
Q_PROPERTY (float lineWidth READ lineWidth WRITE setLineWidth)
|
Q_PROPERTY (qreal lineWidth READ lineWidth WRITE setLineWidth)
|
||||||
Q_PROPERTY (float FOV READ FOV WRITE setFOV)
|
Q_PROPERTY (qreal FOV READ FOV WRITE setFOV)
|
||||||
Q_PROPERTY (float depthStart READ depthStart WRITE setDepthStart)
|
Q_PROPERTY (qreal depthStart READ depthStart WRITE setDepthStart)
|
||||||
Q_PROPERTY (float depthEnd READ depthEnd WRITE setDepthEnd)
|
Q_PROPERTY (qreal depthEnd READ depthEnd WRITE setDepthEnd)
|
||||||
Q_PROPERTY (QColor ambientColor READ ambientColor WRITE setAmbientColor)
|
Q_PROPERTY (QColor ambientColor READ ambientColor WRITE setAmbientColor)
|
||||||
Q_PROPERTY (bool grabMouse READ isGrabMouseEnabled WRITE setGrabMouseEnabled)
|
Q_PROPERTY (bool grabMouse READ isGrabMouseEnabled WRITE setGrabMouseEnabled)
|
||||||
Q_PROPERTY (bool mouseRotate READ isMouseRotateEnabled WRITE setMouseRotateEnabled)
|
Q_PROPERTY (bool mouseRotate READ isMouseRotateEnabled WRITE setMouseRotateEnabled)
|
||||||
@@ -21,19 +22,19 @@ class GLWidget : public QWidget
|
|||||||
Q_PROPERTY (bool cameraOrbit READ isCameraOrbit WRITE setCameraOrbit)
|
Q_PROPERTY (bool cameraOrbit READ isCameraOrbit WRITE setCameraOrbit)
|
||||||
Q_PROPERTY (bool hoverHalo READ isHoverHaloEnabled WRITE setHoverHaloEnabled)
|
Q_PROPERTY (bool hoverHalo READ isHoverHaloEnabled WRITE setHoverHaloEnabled)
|
||||||
Q_PROPERTY (QColor hoverHaloColor READ hoverHaloColor WRITE setHoverHaloColor)
|
Q_PROPERTY (QColor hoverHaloColor READ hoverHaloColor WRITE setHoverHaloColor)
|
||||||
Q_PROPERTY (float hoverHaloFillAlpha READ hoverHaloFillAlpha WRITE setHoverHaloFillAlpha)
|
Q_PROPERTY (qreal hoverHaloFillAlpha READ hoverHaloFillAlpha WRITE setHoverHaloFillAlpha)
|
||||||
Q_PROPERTY (bool selectionHalo READ isSelectionHaloEnabled WRITE setSelectionHaloEnabled)
|
Q_PROPERTY (bool selectionHalo READ isSelectionHaloEnabled WRITE setSelectionHaloEnabled)
|
||||||
Q_PROPERTY (QColor selectionHaloColor READ selectionHaloColor WRITE setSelectionHaloColor)
|
Q_PROPERTY (QColor selectionHaloColor READ selectionHaloColor WRITE setSelectionHaloColor)
|
||||||
Q_PROPERTY (float selectionHaloFillAlpha READ selectionHaloFillAlpha WRITE setSelectionHaloFillAlpha)
|
Q_PROPERTY (qreal selectionHaloFillAlpha READ selectionHaloFillAlpha WRITE setSelectionHaloFillAlpha)
|
||||||
public:
|
public:
|
||||||
explicit GLWidget(QWidget *parent = nullptr);
|
explicit GLWidget(QWidget *parent = nullptr);
|
||||||
QGLView * view() {return view_;}
|
QGLView * view() {return view_;}
|
||||||
|
|
||||||
QColor backColor() const;
|
QColor backColor() const;
|
||||||
float lineWidth() const;
|
qreal lineWidth() const;
|
||||||
float FOV() const;
|
qreal FOV() const;
|
||||||
float depthStart() const;
|
qreal depthStart() const;
|
||||||
float depthEnd() const;
|
qreal depthEnd() const;
|
||||||
QColor ambientColor() const;
|
QColor ambientColor() const;
|
||||||
bool isLightEnabled() const;
|
bool isLightEnabled() const;
|
||||||
bool isGrabMouseEnabled() const;
|
bool isGrabMouseEnabled() const;
|
||||||
@@ -42,19 +43,19 @@ public:
|
|||||||
bool isCameraOrbit() const;
|
bool isCameraOrbit() const;
|
||||||
bool isHoverHaloEnabled() const;
|
bool isHoverHaloEnabled() const;
|
||||||
QColor hoverHaloColor() const;
|
QColor hoverHaloColor() const;
|
||||||
float hoverHaloFillAlpha() const;
|
qreal hoverHaloFillAlpha() const;
|
||||||
bool isSelectionHaloEnabled() const;
|
bool isSelectionHaloEnabled() const;
|
||||||
QColor selectionHaloColor() const;
|
QColor selectionHaloColor() const;
|
||||||
float selectionHaloFillAlpha() const;
|
qreal selectionHaloFillAlpha() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void stop();
|
void stop();
|
||||||
void start(float freq = 60.);
|
void start(float freq = 60.0, GLRendererBase * r = nullptr);
|
||||||
void setBackColor(const QColor & c);
|
void setBackColor(const QColor & c);
|
||||||
void setLineWidth(const float & arg);
|
void setLineWidth(const qreal & arg);
|
||||||
void setFOV(const float & arg);
|
void setFOV(const qreal & arg);
|
||||||
void setDepthStart(const float & arg);
|
void setDepthStart(const qreal & arg);
|
||||||
void setDepthEnd(const float & arg);
|
void setDepthEnd(const qreal & arg);
|
||||||
void setAmbientColor(const QColor & arg);
|
void setAmbientColor(const QColor & arg);
|
||||||
void setLightEnabled(const bool & arg);
|
void setLightEnabled(const bool & arg);
|
||||||
void setGrabMouseEnabled(const bool & arg);
|
void setGrabMouseEnabled(const bool & arg);
|
||||||
@@ -63,10 +64,10 @@ public slots:
|
|||||||
void setCameraOrbit(const bool & arg);
|
void setCameraOrbit(const bool & arg);
|
||||||
void setHoverHaloEnabled(const bool & arg);
|
void setHoverHaloEnabled(const bool & arg);
|
||||||
void setHoverHaloColor(const QColor & arg);
|
void setHoverHaloColor(const QColor & arg);
|
||||||
void setHoverHaloFillAlpha(const float & arg);
|
void setHoverHaloFillAlpha(const qreal & arg);
|
||||||
void setSelectionHaloEnabled(const bool & arg);
|
void setSelectionHaloEnabled(const bool & arg);
|
||||||
void setSelectionHaloColor(const QColor & arg);
|
void setSelectionHaloColor(const QColor & arg);
|
||||||
void setSelectionHaloFillAlpha(const float & arg);
|
void setSelectionHaloFillAlpha(const qreal & arg);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void viewDoubleClicked();
|
void viewDoubleClicked();
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "glwidget.h"
|
#include "glwidget.h"
|
||||||
#include "qglviewplugin.h"
|
#include "qglviewplugin.h"
|
||||||
#include <QtCore/QtPlugin>
|
#include <QtCore/QtPlugin>
|
||||||
|
#include "glprimitives.h"
|
||||||
|
#include "qglview.h"
|
||||||
|
|
||||||
|
|
||||||
QGLViewPlugin::QGLViewPlugin(QObject * parent): QObject(parent) {
|
QGLViewPlugin::QGLViewPlugin(QObject * parent): QObject(parent) {
|
||||||
@@ -25,7 +27,29 @@ bool QGLViewPlugin::isInitialized() const {
|
|||||||
|
|
||||||
QWidget * QGLViewPlugin::createWidget(QWidget * parent) {
|
QWidget * QGLViewPlugin::createWidget(QWidget * parent) {
|
||||||
GLWidget * w = new GLWidget(parent);
|
GLWidget * w = new GLWidget(parent);
|
||||||
//if (m_initialized) w->start();
|
if (m_initialized) {
|
||||||
|
auto axis = new GLObjectBase();
|
||||||
|
GLObjectBase * obj;
|
||||||
|
float al = 1.;
|
||||||
|
obj = new GLPrimitiveLine(QVector3D(0, 0, -al), QVector3D(0, 0, al));
|
||||||
|
obj->material().color_diffuse = Qt::darkBlue; obj->setAcceptLight(false);
|
||||||
|
obj->setSelectable(false);
|
||||||
|
axis->addChild(obj);
|
||||||
|
obj = new GLPrimitiveLine(QVector3D(-al, 0, 0), QVector3D(al, 0, 0));
|
||||||
|
obj->material().color_diffuse = Qt::darkRed; obj->setAcceptLight(false);
|
||||||
|
obj->setSelectable(false);
|
||||||
|
axis->addChild(obj);
|
||||||
|
obj = new GLPrimitiveLine(QVector3D(0, -al, 0), QVector3D(0, al, 0));
|
||||||
|
obj->material().color_diffuse = Qt::darkGreen; obj->setAcceptLight(false);
|
||||||
|
obj->setSelectable(false);
|
||||||
|
axis->addChild(obj);
|
||||||
|
w->view()->addObject(axis);
|
||||||
|
auto cam_light = new Light();
|
||||||
|
cam_light->intensity = 0.5;
|
||||||
|
cam_light->setName("Camera_Light");
|
||||||
|
w->view()->camera()->addChild(cam_light);
|
||||||
|
w->start();
|
||||||
|
}
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ QGLView::QGLView(): OpenGLWindow(), fbo_selection(3) {
|
|||||||
need_init_ = is_first_draw = true;
|
need_init_ = is_first_draw = true;
|
||||||
objects_.is_root = true;
|
objects_.is_root = true;
|
||||||
objects_.view_ = this;
|
objects_.view_ = this;
|
||||||
backColor_ = Qt::black;
|
backColor_ = Qt::darkGray;
|
||||||
hoverHaloColor_ = QColor(195, 140, 255, 96);
|
hoverHaloColor_ = QColor(195, 140, 255, 96);
|
||||||
selectionHaloColor_ = QColor(175, 255, 140);
|
selectionHaloColor_ = QColor(175, 255, 140);
|
||||||
ambientColor_ = QColor(10, 10, 10);
|
ambientColor_ = QColor(10, 10, 10);
|
||||||
@@ -86,13 +86,14 @@ QGLView::QGLView(): OpenGLWindow(), fbo_selection(3) {
|
|||||||
setFeature(qglDepthOfFieldFocus, 1.);
|
setFeature(qglDepthOfFieldFocus, 1.);
|
||||||
setFeature(qglDepthOfFieldDiaphragm, 8.);
|
setFeature(qglDepthOfFieldDiaphragm, 8.);
|
||||||
mouse_first = mouseSelect_ = hoverHalo_ = selectionHalo_ = true;
|
mouse_first = mouseSelect_ = hoverHalo_ = selectionHalo_ = true;
|
||||||
fogEnabled_ = is_init = grabMouse_ = mouseRotate_ = shaders_bind = changed_ = false;
|
mouseRotate_ = true;
|
||||||
|
fogEnabled_ = is_init = grabMouse_ = shaders_bind = changed_ = false;
|
||||||
rmode = GLObjectBase::Fill;
|
rmode = GLObjectBase::Fill;
|
||||||
sel_mode = QGLView::SingleSelection;
|
sel_mode = QGLView::SingleSelection;
|
||||||
// sel_pen = QPen(Qt::black, 1, Qt::DashLine);
|
// sel_pen = QPen(Qt::black, 1, Qt::DashLine);
|
||||||
// sel_brush = QBrush(QColor(170, 100, 255, 120));
|
// sel_brush = QBrush(QColor(170, 100, 255, 120));
|
||||||
camera()->setAim(QVector3D(0,0,5.5));
|
camera()->setAim(QVector3D());
|
||||||
camera()->setPos(QVector3D(10, 5, 5.5));
|
camera()->setPos(QVector3D(2, 2, 2));
|
||||||
camera()->setName("Camera");
|
camera()->setName("Camera");
|
||||||
addObject(camera());
|
addObject(camera());
|
||||||
emit cameraPosChanged(camera()->pos());
|
emit cameraPosChanged(camera()->pos());
|
||||||
|
|||||||
@@ -146,6 +146,12 @@ void RendererDeferredShading::renderScene() {
|
|||||||
l->shadow_map.release();
|
l->shadow_map.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// glUseProgram(0);
|
||||||
|
//// fbo_g.bindColorTextures();
|
||||||
|
// glBindTexture(GL_TEXTURE_2D, fbo_g.colorTexture(0));
|
||||||
|
// glActiveTexture(GL_TEXTURE0);
|
||||||
|
// glDrawQuad();
|
||||||
|
// return;
|
||||||
|
|
||||||
glResetAllTransforms();
|
glResetAllTransforms();
|
||||||
glSetLightEnabled(false);
|
glSetLightEnabled(false);
|
||||||
@@ -180,9 +186,9 @@ void RendererDeferredShading::renderScene() {
|
|||||||
//QVector<QVector4D> lpos;
|
//QVector<QVector4D> lpos;
|
||||||
//qDebug() << view_matrix;
|
//qDebug() << view_matrix;
|
||||||
shader_ds_1->setUniformValue("t_pp", 6);
|
shader_ds_1->setUniformValue("t_pp", 6);
|
||||||
//qDebug() << "render in" << passes << "passes (" << lights_per_pass << ")";
|
|
||||||
int passes = (view.lightsCount() - 1) / lights_per_pass + 1;
|
int passes = (view.lightsCount() - 1) / lights_per_pass + 1;
|
||||||
if (passes < 1) passes = 1;
|
if (passes < 1) passes = 1;
|
||||||
|
//qDebug() << "render in" << passes << "passes (" << lights_per_pass << ")";
|
||||||
int wi, ri;
|
int wi, ri;
|
||||||
for (int l = 0; l < passes; ++l) {
|
for (int l = 0; l < passes; ++l) {
|
||||||
wi = 1 - l % 2;
|
wi = 1 - l % 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user