summaryrefslogtreecommitdiffstats
path: root/src/datavisualization/engine/bars3drenderer.cpp
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2014-04-16 12:25:14 +0300
committerTomi Korpipää <tomi.korpipaa@digia.com>2014-04-16 12:26:06 +0300
commitbf8ed99fb5a474aa6a56d61c9e3a1b5e44d6b6cf (patch)
treebf0e9956fbad9c689e58f4c33eafbd286185a587 /src/datavisualization/engine/bars3drenderer.cpp
parenta30c0c304e55ffe30545ab0838e4dbe11a99b8da (diff)
Add custom item support, part 2
Task-number: QTRD-2866 + Added custom item rendering Change-Id: If24400fed7c0467d8ebbd554d6e4df3ec5a205f3 Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'src/datavisualization/engine/bars3drenderer.cpp')
-rw-r--r--src/datavisualization/engine/bars3drenderer.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp
index f02b9910..e2feefac 100644
--- a/src/datavisualization/engine/bars3drenderer.cpp
+++ b/src/datavisualization/engine/bars3drenderer.cpp
@@ -299,11 +299,6 @@ void Bars3DRenderer::updateSeries(const QList<QAbstract3DSeries *> &seriesList)
m_selectionLabelDirty = true;
}
-void Bars3DRenderer::updateCustomData(const QList<CustomDataItem *> &customItems)
-{
- // TODO
-}
-
SeriesRenderCache *Bars3DRenderer::createNewCache(QAbstract3DSeries *series)
{
return new BarSeriesRenderCache(series, this);
@@ -575,7 +570,6 @@ void Bars3DRenderer::drawSlicedScene()
else
barShader = m_barGradientShader;
barShader->bind();
-
}
if (!colorStyleIsUniform && (previousColorStyle != colorStyle)
@@ -992,8 +986,9 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
}
}
- drawCustomItems(RenderingDepth, m_depthShader, activeCamera, projectionMatrix,
- depthProjectionMatrix);
+ Abstract3DRenderer::drawCustomItems(RenderingDepth, m_depthShader, viewMatrix,
+ projectionViewMatrix, depthProjectionViewMatrix,
+ m_depthTexture, m_shadowQualityToShader);
// Disable drawing to depth framebuffer (= enable drawing to screen)
glBindFramebuffer(GL_FRAMEBUFFER, defaultFboHandle);
@@ -1011,7 +1006,8 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
// Skip selection mode drawing if we're slicing or have no selection mode
if (!m_cachedIsSlicingActivated && m_cachedSelectionMode > QAbstract3DGraph::SelectionNone
- && m_selectionState == SelectOnScene && m_visibleSeriesCount > 0) {
+ && m_selectionState == SelectOnScene
+ && (m_visibleSeriesCount > 0 || !m_customRenderCache.isEmpty())) {
// Bind selection shader
m_selectionShader->bind();
@@ -1075,8 +1071,9 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
}
}
glCullFace(GL_BACK);
- drawCustomItems(RenderingSelection, m_selectionShader, activeCamera, projectionMatrix,
- depthProjectionMatrix);
+ Abstract3DRenderer::drawCustomItems(RenderingSelection, m_selectionShader, viewMatrix,
+ projectionViewMatrix, depthProjectionViewMatrix,
+ m_depthTexture, m_shadowQualityToShader);
drawLabels(true, activeCamera, viewMatrix, projectionMatrix, rowScaleFactor,
columnScaleFactor);
glEnable(GL_DITHER);
@@ -1373,15 +1370,16 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
glDisable(GL_POLYGON_OFFSET_FILL);
- drawCustomItems(RenderingNormal, m_customItemShader, activeCamera, projectionMatrix,
- depthProjectionMatrix);
+ // Reset culling
+ glCullFace(GL_BACK);
+
+ Abstract3DRenderer::drawCustomItems(RenderingNormal, m_customItemShader, viewMatrix,
+ projectionViewMatrix, depthProjectionViewMatrix,
+ m_depthTexture, m_shadowQualityToShader);
// Bind background shader
m_backgroundShader->bind();
- // Reset culling
- glCullFace(GL_BACK);
-
// Draw background
if (m_cachedTheme->isBackgroundEnabled() && m_backgroundObj) {
QMatrix4x4 modelMatrix;
@@ -1745,14 +1743,6 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
m_selectionDirty = false;
}
-void Bars3DRenderer::drawCustomItems(RenderingState state, ShaderHelper *shader,
- const Q3DCamera *activeCamera,
- const QMatrix4x4 &projectionMatrix,
- const QMatrix4x4 &depthProjectionMatrix)
-{
- // TODO
-}
-
void Bars3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCamera,
const QMatrix4x4 &viewMatrix, const QMatrix4x4 &projectionMatrix,
GLfloat rowScaleFactor, GLfloat columnScaleFactor) {
@@ -2337,4 +2327,14 @@ void Bars3DRenderer::initLabelShaders(const QString &vertexShader, const QString
m_labelShader->initialize();
}
+QVector3D Bars3DRenderer::convertPositionToTranslation(const QVector3D &position) {
+ // Convert row and column to translation on graph
+ float xTrans = (((position.x() + 0.5f) * m_cachedBarSpacing.width()) - m_rowWidth)
+ / m_scaleFactor;
+ float zTrans = (m_columnDepth - ((position.z() + 0.5f) * m_cachedBarSpacing.height()))
+ / m_scaleFactor;
+ float yTrans = m_axisCacheY.positionAt(position.y());
+ return QVector3D(xTrans, yTrans, zTrans);
+}
+
QT_END_NAMESPACE_DATAVISUALIZATION