diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2014-06-06 10:24:20 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2014-06-06 10:24:20 +0300 |
commit | ee94aedb7447ddf7a779f7188fd1cd2ae44d675e (patch) | |
tree | e92e222e7df5e5ce773756ff1d037088c5a61325 /src/datavisualization/engine | |
parent | 05364a4204a5ec4c16156ebcad12dd8944c48155 (diff) | |
parent | e8e5286ff5c5e5ba822e798dc0c1f8270817a562 (diff) |
Merge remote-tracking branch 'origin/develop'
Change-Id: I6daaea503f62b0f1e9af56ce3bd5931d5e4afc45
Diffstat (limited to 'src/datavisualization/engine')
-rw-r--r-- | src/datavisualization/engine/abstract3drenderer.cpp | 3 | ||||
-rw-r--r-- | src/datavisualization/engine/bars3drenderer.cpp | 24 | ||||
-rw-r--r-- | src/datavisualization/engine/scatter3drenderer.cpp | 38 | ||||
-rw-r--r-- | src/datavisualization/engine/surface3drenderer.cpp | 24 |
4 files changed, 56 insertions, 33 deletions
diff --git a/src/datavisualization/engine/abstract3drenderer.cpp b/src/datavisualization/engine/abstract3drenderer.cpp index 5d97a6ca..04ede782 100644 --- a/src/datavisualization/engine/abstract3drenderer.cpp +++ b/src/datavisualization/engine/abstract3drenderer.cpp @@ -640,8 +640,8 @@ void Abstract3DRenderer::drawAxisTitleX(const QVector3D &labelRotation, Qt::AlignmentFlag alignment = Qt::AlignTop; if (m_yFlipped) { alignment = Qt::AlignBottom; + zRotation = 180.0f; if (m_zFlipped) { - zRotation = 180.0f; titleOffset = -titleOffset; if (m_xFlipped) { offsetRotation = -offsetRotation; @@ -650,7 +650,6 @@ void Abstract3DRenderer::drawAxisTitleX(const QVector3D &labelRotation, xRotation = -90.0f - labelRotation.z(); } } else { - zRotation = 180.0f; yRotation = 180.0f; if (m_xFlipped) { offsetRotation = -offsetRotation; diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp index 3805e760..689f3f5d 100644 --- a/src/datavisualization/engine/bars3drenderer.cpp +++ b/src/datavisualization/engine/bars3drenderer.cpp @@ -1951,11 +1951,12 @@ void Bars3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCamer endIndex = labelCount; indexStep = 1; } + float offsetValue = 0.0f; for (int i = startIndex; i != endIndex; i = i + indexStep) { backLabelTrans.setY(m_axisCacheY.labelPosition(i)); sideLabelTrans.setY(backLabelTrans.y()); - glPolygonOffset(GLfloat(i) / -10.0f, 1.0f); + glPolygonOffset(offsetValue++ / -10.0f, 1.0f); const LabelItem &axisLabelItem = *m_axisCacheY.labelItems().at(i); @@ -2008,15 +2009,16 @@ void Bars3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCamer QVector3D labelRotation; if (labelAutoAngle == 0.0f) { - labelRotation.setX(-90.0f); if (m_zFlipped) labelRotation.setY(180.0f); if (m_yFlipped) { if (m_zFlipped) - labelRotation.setY(0.0f); - else labelRotation.setY(180.0f); - labelRotation.setZ(180.0f); + else + labelRotation.setY(0.0f); + labelRotation.setX(90.0f); + } else { + labelRotation.setX(-90.0f); } } else { if (m_zFlipped) @@ -2079,6 +2081,7 @@ void Bars3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCamer endIndex = -1; indexStep = -1; } + offsetValue = 0.0f; for (int row = startIndex; row != endIndex; row = row + indexStep) { // Go through all rows and get position of max+1 or min-1 column, depending on x flip // We need only positions for them, labels have already been generated @@ -2088,7 +2091,7 @@ void Bars3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCamer else colPos = colPosValue; - glPolygonOffset(GLfloat(row) / -10.0f, 1.0f); + glPolygonOffset(offsetValue++ / -10.0f, 1.0f); QVector3D labelPos = QVector3D(colPos, labelYAdjustment, // raise a bit over background to avoid depth "glimmering" @@ -2129,10 +2132,10 @@ void Bars3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCamer labelRotation.setY(-90.0f); if (m_yFlipped) { if (m_xFlipped) - labelRotation.setY(90.0f); - else labelRotation.setY(-90.0f); - labelRotation.setZ(180.0f); + else + labelRotation.setY(90.0f); + labelRotation.setX(90.0f); } } else { if (m_xFlipped) @@ -2197,6 +2200,7 @@ void Bars3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCamer endIndex = labelCount; indexStep = 1; } + offsetValue = 0.0f; for (int column = startIndex; column != endIndex; column = column + indexStep) { // Go through all columns and get position of max+1 or min-1 row, depending on z flip // We need only positions for them, labels have already been generated @@ -2206,7 +2210,7 @@ void Bars3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCamer else rowPos = rowPosValue; - glPolygonOffset(GLfloat(column) / -10.0f, 1.0f); + glPolygonOffset(offsetValue++ / -10.0f, 1.0f); QVector3D labelPos = QVector3D((colPos - m_rowWidth) / m_scaleFactor, labelYAdjustment, // raise a bit over background to avoid depth "glimmering" diff --git a/src/datavisualization/engine/scatter3drenderer.cpp b/src/datavisualization/engine/scatter3drenderer.cpp index 21d86d03..dd50188b 100644 --- a/src/datavisualization/engine/scatter3drenderer.cpp +++ b/src/datavisualization/engine/scatter3drenderer.cpp @@ -444,6 +444,12 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle) } QVector3D modelScaler(itemSize, itemSize, itemSize); + if (!optimizationDefault + && ((drawingPoints && cache->bufferPoints()->indexCount() == 0) + || (!drawingPoints && cache->bufferObject()->indexCount() == 0))) { + continue; + } + int loopCount = 1; if (optimizationDefault) loopCount = renderArraySize; @@ -709,6 +715,12 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle) #endif QVector3D modelScaler(itemSize, itemSize, itemSize); + if (!optimizationDefault + && ((drawingPoints && cache->bufferPoints()->indexCount() == 0) + || (!drawingPoints && cache->bufferObject()->indexCount() == 0))) { + continue; + } + // Rebind shader if it has changed if (drawingPoints != previousDrawingPoints || (!drawingPoints && @@ -920,7 +932,7 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle) if (!drawingPoints) { glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(-0.5f, 1.0f); + glPolygonOffset(-1.0f, 1.0f); } #if !defined(QT_OPENGL_ES_2) @@ -1536,15 +1548,16 @@ void Scatter3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCa if (m_yFlipped) labelYTrans = -labelYTrans; if (labelAutoAngle == 0.0f) { - labelRotation.setX(-90.0f); if (m_zFlipped) labelRotation.setY(180.0f); if (m_yFlipped) { if (m_zFlipped) - labelRotation.setY(0.0f); - else labelRotation.setY(180.0f); - labelRotation.setZ(180.0f); + else + labelRotation.setY(0.0f); + labelRotation.setX(90.0f); + } else { + labelRotation.setX(-90.0f); } } else { if (m_zFlipped) @@ -1606,10 +1619,11 @@ void Scatter3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCa endIndex = -1; indexStep = -1; } + float offsetValue = 0.0f; for (int label = startIndex; label != endIndex; label = label + indexStep) { labelTrans.setZ(m_axisCacheZ.labelPosition(label)); - glPolygonOffset(GLfloat(label) / -10.0f, 1.0f); + glPolygonOffset(offsetValue++ / -10.0f, 1.0f); // Draw the label here m_dummyRenderItem.setTranslation(labelTrans); @@ -1663,10 +1677,10 @@ void Scatter3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCa labelRotation.setY(-90.0f); if (m_yFlipped) { if (m_xFlipped) - labelRotation.setY(90.0f); - else labelRotation.setY(-90.0f); - labelRotation.setZ(180.0f); + else + labelRotation.setY(90.0f); + labelRotation.setX(90.0f); } } else { if (m_xFlipped) @@ -1731,10 +1745,11 @@ void Scatter3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCa endIndex = labelCount; indexStep = 1; } + float offsetValue = 0.0f; for (int label = startIndex; label != endIndex; label = label + indexStep) { labelTrans.setX(m_axisCacheX.labelPosition(label)); - glPolygonOffset(GLfloat(label) / -10.0f, 1.0f); + glPolygonOffset(offsetValue++ / -10.0f, 1.0f); // Draw the label here m_dummyRenderItem.setTranslation(labelTrans); @@ -1836,11 +1851,12 @@ void Scatter3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCa endIndex = labelCount; indexStep = 1; } + float offsetValue = 0.0f; for (int label = startIndex; label != endIndex; label = label + indexStep) { const LabelItem &axisLabelItem = *m_axisCacheY.labelItems().at(label); const GLfloat labelYTrans = m_axisCacheY.labelPosition(label); - glPolygonOffset(GLfloat(label) / -10.0f, 1.0f); + glPolygonOffset(offsetValue++ / -10.0f, 1.0f); if (drawSelection) { QVector4D labelColor = QVector4D(0.0f, 0.0f, label / 255.0f, diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp index 12627966..e4dfebfc 100644 --- a/src/datavisualization/engine/surface3drenderer.cpp +++ b/src/datavisualization/engine/surface3drenderer.cpp @@ -1838,15 +1838,16 @@ void Surface3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCa if (m_yFlipped) labelYTrans = -labelYTrans; if (labelAutoAngle == 0.0f) { - labelRotation.setX(-90.0f); if (m_zFlipped) labelRotation.setY(180.0f); if (m_yFlipped) { if (m_zFlipped) - labelRotation.setY(0.0f); - else labelRotation.setY(180.0f); - labelRotation.setZ(180.0f); + else + labelRotation.setY(0.0f); + labelRotation.setX(90.0f); + } else { + labelRotation.setX(-90.0f); } } else { if (m_zFlipped) @@ -1913,8 +1914,9 @@ void Surface3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCa endIndex = -1; indexStep = -1; } + float offsetValue = 0.0f; for (int label = startIndex; label != endIndex; label = label + indexStep) { - glPolygonOffset(GLfloat(label) / -10.0f, 1.0f); + glPolygonOffset(offsetValue++ / -10.0f, 1.0f); // Draw the label here labelTrans.setZ(m_axisCacheZ.labelPosition(label)); m_dummyRenderItem.setTranslation(labelTrans); @@ -1961,10 +1963,10 @@ void Surface3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCa labelRotation.setY(-90.0f); if (m_yFlipped) { if (m_xFlipped) - labelRotation.setY(90.0f); - else labelRotation.setY(-90.0f); - labelRotation.setZ(180.0f); + else + labelRotation.setY(90.0f); + labelRotation.setX(90.0f); } } else { if (m_xFlipped) @@ -2032,8 +2034,9 @@ void Surface3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCa endIndex = labelCount; indexStep = 1; } + float offsetValue = 0.0f; for (int label = startIndex; label != endIndex; label = label + indexStep) { - glPolygonOffset(GLfloat(label) / -10.0f, 1.0f); + glPolygonOffset(offsetValue++ / -10.0f, 1.0f); // Draw the label here labelTrans.setX(m_axisCacheX.labelPosition(label)); m_dummyRenderItem.setTranslation(labelTrans); @@ -2125,11 +2128,12 @@ void Surface3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCa endIndex = labelCount; indexStep = 1; } + float offsetValue = 0.0f; for (int label = startIndex; label != endIndex; label = label + indexStep) { const LabelItem &axisLabelItem = *m_axisCacheY.labelItems().at(label); const GLfloat labelYTrans = m_axisCacheY.labelPosition(label); - glPolygonOffset(GLfloat(label) / -10.0f, 1.0f); + glPolygonOffset(offsetValue++ / -10.0f, 1.0f); if (drawSelection) { QVector4D labelColor = QVector4D(0.0f, 0.0f, label / 255.0f, |