summaryrefslogtreecommitdiffstats
path: root/src/datavisualization/engine/surface3drenderer.cpp
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2014-04-15 10:32:03 +0300
committerTomi Korpipää <tomi.korpipaa@digia.com>2014-04-15 10:40:38 +0300
commita30c0c304e55ffe30545ab0838e4dbe11a99b8da (patch)
treece6ccc0e4de8e350aebec466ff0a70c0fd7710bc /src/datavisualization/engine/surface3drenderer.cpp
parent79646ac9664745701667104c19bbae8cba8fd2e3 (diff)
Add custom item support, part 1
Task-number: QTRD-2866 + Added API for adding and removing custom items + Added custom data and custom render items + Added shaders for textured objects + Added custom item rendering draft to scatter + Fixed some shaders - to be continued in part 2 Change-Id: I9735fd02fc9e86ae486cca4c06f6d7f2a4b0b7da Reviewed-by: Mika Salmela <mika.salmela@digia.com>
Diffstat (limited to 'src/datavisualization/engine/surface3drenderer.cpp')
-rw-r--r--src/datavisualization/engine/surface3drenderer.cpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp
index 0d5536e2..eeeaaf0d 100644
--- a/src/datavisualization/engine/surface3drenderer.cpp
+++ b/src/datavisualization/engine/surface3drenderer.cpp
@@ -41,8 +41,9 @@ QT_BEGIN_NAMESPACE_DATAVISUALIZATION
//#define SHOW_DEPTH_TEXTURE_SCENE
const GLfloat aspectRatio = 2.0f; // Forced ratio of x and z to y. Dynamic will make it look odd.
-const GLfloat backgroundMargin = 1.1f; // Margin for background (1.10 make it 10% larger to avoid
- // selection ball being drawn inside background)
+// Margin for background (1.10 make it 10% larger to avoid
+// selection ball being drawn inside background)
+const GLfloat backgroundMargin = 1.1f;
const GLfloat labelMargin = 0.05f;
const GLfloat gridLineWidth = 0.005f;
const GLfloat sliceZScale = 0.1f;
@@ -293,6 +294,11 @@ void Surface3DRenderer::updateSeries(const QList<QAbstract3DSeries *> &seriesLis
}
}
+void Surface3DRenderer::updateCustomData(const QList<CustomDataItem *> &customItems)
+{
+ // TODO
+}
+
SeriesRenderCache *Surface3DRenderer::createNewCache(QAbstract3DSeries *series)
{
m_selectionTexturesDirty = true;
@@ -1133,6 +1139,9 @@ void Surface3DRenderer::drawScene(GLuint defaultFboHandle)
glDisableVertexAttribArray(m_depthShader->posAtt());
+ drawCustomItems(RenderingDepth, m_depthShader, activeCamera, projectionMatrix,
+ depthProjectionMatrix);
+
// Disable drawing to depth framebuffer (= enable drawing to screen)
glBindFramebuffer(GL_FRAMEBUFFER, defaultFboHandle);
@@ -1180,6 +1189,8 @@ void Surface3DRenderer::drawScene(GLuint defaultFboHandle)
cache->selectionTexture());
}
}
+ drawCustomItems(RenderingSelection, m_selectionShader, activeCamera, projectionMatrix,
+ depthProjectionMatrix);
drawLabels(true, activeCamera, viewMatrix, projectionMatrix);
glEnable(GL_DITHER);
@@ -1310,6 +1321,9 @@ void Surface3DRenderer::drawScene(GLuint defaultFboHandle)
}
}
+ drawCustomItems(RenderingNormal, m_customItemShader, activeCamera, projectionMatrix,
+ depthProjectionMatrix);
+
// Bind background shader
m_backgroundShader->bind();
glCullFace(GL_BACK);
@@ -1753,6 +1767,14 @@ void Surface3DRenderer::drawScene(GLuint defaultFboHandle)
}
}
+void Surface3DRenderer::drawCustomItems(RenderingState state, ShaderHelper *shader,
+ const Q3DCamera *activeCamera,
+ const QMatrix4x4 &projectionMatrix,
+ const QMatrix4x4 &depthProjectionMatrix)
+{
+ // TODO
+}
+
void Surface3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCamera,
const QMatrix4x4 &viewMatrix,
const QMatrix4x4 &projectionMatrix) {
@@ -2235,7 +2257,7 @@ void Surface3DRenderer::updateSelectionPoint(SurfaceSeriesRenderCache *cache, co
QPoint Surface3DRenderer::selectionIdToSurfacePoint(uint id)
{
m_clickedType = QAbstract3DGraph::ElementNone;
- // Check for label selection
+ // Check for label and custom item selection
if (id / alphaMultiplier == labelRowAlpha) {
m_clickedType = QAbstract3DGraph::ElementAxisZLabel;
return Surface3DController::invalidSelectionPosition();
@@ -2245,6 +2267,10 @@ QPoint Surface3DRenderer::selectionIdToSurfacePoint(uint id)
} else if (id / alphaMultiplier == labelValueAlpha) {
m_clickedType = QAbstract3DGraph::ElementAxisYLabel;
return Surface3DController::invalidSelectionPosition();
+ } else if (id / alphaMultiplier == customItemAlpha) {
+ // Custom item selection
+ m_clickedType = QAbstract3DGraph::ElementCustomItem;
+ return Surface3DController::invalidSelectionPosition();
}
// Not a label selection