git-svn-id: svn://db.shs.com.ru/libs@46 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -242,14 +242,14 @@ void QGLView::paintGL() {
|
||||
}
|
||||
//if (so != 0) qDebug() << sel_obj->name() << cgid[3];
|
||||
}
|
||||
if (hoverHalo_) {
|
||||
fbo_selection.setWriteBuffer(1);
|
||||
renderHalo(so, iid, hoverHaloColor_, hoverHaloFill_);
|
||||
}
|
||||
if (selectionHalo_) {
|
||||
if (selectionHalo_ && sel_obj) {
|
||||
fbo_selection.setWriteBuffer(2);
|
||||
renderHalo(sel_obj, ids.key(sel_obj), selectionHaloColor_, selectionHaloFill_);
|
||||
}
|
||||
if (hoverHalo_ && hov_obj) {
|
||||
fbo_selection.setWriteBuffer(1);
|
||||
renderHalo(hov_obj, iid, hoverHaloColor_, hoverHaloFill_);
|
||||
}
|
||||
fbo_selection.release();
|
||||
glEnableDepth();
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
@@ -269,7 +269,11 @@ void QGLView::paintGL() {
|
||||
}
|
||||
}
|
||||
emit glBeginPaint();
|
||||
if (renderer_ != 0) renderer_->renderScene();
|
||||
if (renderer_ != 0) {
|
||||
renderer_->rp.prepare();
|
||||
renderer_->prepareScene();
|
||||
renderer_->renderScene();
|
||||
}
|
||||
if (selectionHalo_ || hoverHalo_) {
|
||||
glReleaseTextures();
|
||||
glReleaseShaders();
|
||||
@@ -281,12 +285,14 @@ void QGLView::paintGL() {
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisableDepth();
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
if (selectionHalo_) {
|
||||
if (selectionHalo_ && sel_obj) {
|
||||
glBindTexture(GL_TEXTURE_2D, fbo_selection.colorTexture(2));
|
||||
//qDebug() << "draw sel";
|
||||
glDrawQuad();
|
||||
}
|
||||
if (hoverHalo_) {
|
||||
if (hoverHalo_ && hov_obj) {
|
||||
glBindTexture(GL_TEXTURE_2D, fbo_selection.colorTexture(1));
|
||||
//qDebug() << "draw hover";
|
||||
glDrawQuad();
|
||||
}
|
||||
}
|
||||
@@ -346,12 +352,11 @@ void QGLView::paintGL() {
|
||||
|
||||
void QGLView::renderHalo(const GLObjectBase * obj, const int iid, const QColor & color, const double & fill) {
|
||||
if (!shaders_supported) return;
|
||||
if (obj == 0) {
|
||||
glClearFramebuffer(Qt::black, false);
|
||||
} else {
|
||||
if (obj) {
|
||||
shader_halo->bind();
|
||||
shader_halo->setUniformValue("qgl_ModelViewProjectionMatrix", QMatrix4x4());
|
||||
glActiveTextureChannel(0);
|
||||
glBindTexture(GL_TEXTURE_2D, fbo_selection.colorTexture());
|
||||
shader_halo->bind();
|
||||
shader_halo->setUniformValue("t0", 0);
|
||||
shader_halo->setUniformValue("dt", QVector2D(1. / viewport()->width(), 1. / viewport()->height()));
|
||||
shader_halo->setUniformValue("selected", QVector4D(float((iid >> 24) & 0xFF) / 255.f,
|
||||
@@ -360,11 +365,14 @@ void QGLView::renderHalo(const GLObjectBase * obj, const int iid, const QColor &
|
||||
float(iid & 0xFF) / 255.f));
|
||||
shader_halo->setUniformValue("color", color);
|
||||
shader_halo->setUniformValue("fill", GLfloat(fill));
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
glDrawQuad();
|
||||
//qDebug() << "render halo" << iid << shader_halo->log() << shader_halo->programId();
|
||||
glDisableDepth();
|
||||
glDrawQuad(shader_halo);
|
||||
glDepthMask(GL_TRUE);
|
||||
//glFlush();
|
||||
shader_halo->release();
|
||||
} else {
|
||||
glClearFramebuffer(Qt::black, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -609,6 +617,12 @@ void QGLView::wheelEvent(QWheelEvent * e) {
|
||||
}
|
||||
|
||||
|
||||
void QGLView::leaveEvent(QEvent * ) {
|
||||
lastPos = QPoint(-1, -1);
|
||||
//qDebug() << lastPos;
|
||||
}
|
||||
|
||||
|
||||
void QGLView::processKeys() {
|
||||
if (ktm_.elapsed() < QApplication::keyboardInputInterval()) return;
|
||||
Qt::KeyboardModifiers km = QApplication::keyboardModifiers();
|
||||
|
||||
Reference in New Issue
Block a user