From 8f5bea298260a3e7d91a850f0ad2add53b00e54d Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 5 Jun 2014 14:35:03 +0300 Subject: Change label polygon offset to follow draw order Change-Id: I6b0bbb458fe9eae9664cd50f9b20f672b08cf4b9 Reviewed-by: Mika Salmela --- src/datavisualization/engine/surface3drenderer.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/datavisualization/engine/surface3drenderer.cpp') diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp index 12627966..858f0283 100644 --- a/src/datavisualization/engine/surface3drenderer.cpp +++ b/src/datavisualization/engine/surface3drenderer.cpp @@ -1913,8 +1913,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); @@ -2032,8 +2033,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 +2127,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, -- cgit v1.2.3 From 96a5733e6c75646e83f9c9a2012e486fbe6d0d96 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 6 Jun 2014 08:58:13 +0300 Subject: Fix missing axis titles with zero rotation and fixed titles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I026578b224772fe9d96f6f7789e253d433690091 Reviewed-by: Tomi Korpipää --- src/datavisualization/engine/surface3drenderer.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/datavisualization/engine/surface3drenderer.cpp') diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp index 858f0283..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) @@ -1962,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) -- cgit v1.2.3