diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-09-13 12:55:47 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-09-13 13:23:18 +0300 |
commit | a196030e162090ea2c2eecc0396863a53d06db90 (patch) | |
tree | 0378cefeaf64c5067f61ef79030682e81eb9898e /src | |
parent | b29a2d2b581151634afe81e5f6408a6918295ea5 (diff) |
Slice view shadow issue fixed
Task-number: QTRD-2257
Change-Id: If5d0b2ceb9fcc2d740835371604f680fd2da65aa
Change-Id: If5d0b2ceb9fcc2d740835371604f680fd2da65aa
Reviewed-by: Mika Salmela <mika.salmela@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/datavisualization/engine/bars3drenderer.cpp | 25 | ||||
-rw-r--r-- | src/datavisualization/global/datavisualizationglobal_p.h | 2 |
2 files changed, 9 insertions, 18 deletions
diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp index 558eb48e..4b224900 100644 --- a/src/datavisualization/engine/bars3drenderer.cpp +++ b/src/datavisualization/engine/bars3drenderer.cpp @@ -234,16 +234,6 @@ void Bars3DRenderer::drawSlicedScene(const LabelItem &xLabel, projectionMatrix.perspective(45.0f, (GLfloat)m_sliceViewPort.width() / (GLfloat)m_sliceViewPort.height(), 0.1f, 100.0f); -#ifdef ROTATE_ZOOM_SELECTION - // Get light position (rotate light with camera, a bit above it (as set in defaultLightPos)) - lightPos = m_cachedScene->light()->position(); - - if (viewMatrix.row(0).z() <= 0) { - startBar = m_sliceSelection->size() - 1; - stopBar = -1; - stepBar = -1; - } -#else // Set view matrix QMatrix4x4 viewMatrix; @@ -256,7 +246,6 @@ void Bars3DRenderer::drawSlicedScene(const LabelItem &xLabel, // Set light position lightPos = QVector3D(0.0f, -m_yAdjustment, zComp); -#endif // Bind bar shader m_barShader->bind(); @@ -310,9 +299,9 @@ void Bars3DRenderer::drawSlicedScene(const LabelItem &xLabel, itModelMatrix.inverted().transposed()); m_barShader->setUniformValue(m_barShader->MVP(), MVPMatrix); m_barShader->setUniformValue(m_barShader->color(), barColor); - m_barShader->setUniformValue(m_barShader->lightS(), 0.25f); + m_barShader->setUniformValue(m_barShader->lightS(), 0.5f); m_barShader->setUniformValue(m_barShader->ambientS(), - m_cachedTheme.m_ambientStrength * 1.5f); + m_cachedTheme.m_ambientStrength * 2.0f); // Draw the object m_drawer->drawObject(m_barShader, m_barObj); @@ -472,13 +461,12 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle) QVector3D lightPos = m_cachedScene->light()->position(); // Skip depth rendering if we're in slice mode - // TODO: Fix this, causes problems if depth rendering is off in slice mode // Introduce regardless of shadow quality to simplify logic QMatrix4x4 depthViewMatrix; QMatrix4x4 depthProjectionMatrix; #if !defined(QT_OPENGL_ES_2) - if (m_cachedShadowQuality > QDataVis::ShadowNone /*&& !m_cachedIsSlicingActivated*/) { + if (m_cachedShadowQuality > QDataVis::ShadowNone && !m_cachedIsSlicingActivated) { // Render scene into a depth texture for using with shadow mapping // Enable drawing to depth framebuffer glBindFramebuffer(GL_FRAMEBUFFER, m_depthFrameBuffer); @@ -777,7 +765,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle) barColor = Utils::vectorFromColor(m_cachedTheme.m_highlightBarColor); lightStrength = m_cachedTheme.m_highlightLightStrength; // Insert position data into render item. We have no ownership, don't delete the previous one - if (selectionDirty) { + if (!m_cachedIsSlicingActivated) { selectedBar = &item; selectedBar->setPosition(QPoint(row, bar)); item.setTranslation(modelMatrix.column(3).toVector3D()); @@ -785,6 +773,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle) } if (selectionDirty && m_cachedSelectionMode >= QDataVis::ModeSliceRow) { item.setTranslation(modelMatrix.column(3).toVector3D()); + item.setPosition(QPoint(row, bar)); m_sliceSelection->append(&item); barSelectionFound = true; if (m_cachedSelectionMode == QDataVis::ModeSliceRow) { @@ -1701,6 +1690,10 @@ void Bars3DRenderer::updateSlicingActive(bool isSlicing) if (isSlicing) { m_mainViewPort = QRect(0, m_cachedBoundingRect.height() - m_cachedBoundingRect.height() / 5, m_cachedBoundingRect.width() / 5, m_cachedBoundingRect.height() / 5); + if (m_depthTexture) { + m_textureHelper->deleteTexture(&m_depthTexture); + m_depthTexture = 0; + } } else { m_mainViewPort = QRect(0, 0, this->m_cachedBoundingRect.width(), this->m_cachedBoundingRect.height()); diff --git a/src/datavisualization/global/datavisualizationglobal_p.h b/src/datavisualization/global/datavisualizationglobal_p.h index 4d6f1b33..29fcc532 100644 --- a/src/datavisualization/global/datavisualizationglobal_p.h +++ b/src/datavisualization/global/datavisualizationglobal_p.h @@ -35,8 +35,6 @@ #include <QVector3D> #include <QDebug> -//#define ROTATE_ZOOM_SELECTION - QT_DATAVISUALIZATION_BEGIN_NAMESPACE // Constants used in several files |