summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2014-06-05 14:35:03 +0300
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2014-06-05 15:05:11 +0300
commit8f5bea298260a3e7d91a850f0ad2add53b00e54d (patch)
tree816a72ec9f8240ecaccfdf8b6e6c2a354beba16d
parent133838d7440bbafe25a9cbdee581547f14013894 (diff)
Change label polygon offset to follow draw order
Change-Id: I6b0bbb458fe9eae9664cd50f9b20f672b08cf4b9 Reviewed-by: Mika Salmela <mika.salmela@digia.com>
-rw-r--r--src/datavisualization/engine/bars3drenderer.cpp9
-rw-r--r--src/datavisualization/engine/scatter3drenderer.cpp9
-rw-r--r--src/datavisualization/engine/surface3drenderer.cpp9
3 files changed, 18 insertions, 9 deletions
diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp
index 3805e760..04b7f18f 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);
@@ -2079,6 +2080,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 +2090,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"
@@ -2197,6 +2199,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 +2209,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..a6c8e004 100644
--- a/src/datavisualization/engine/scatter3drenderer.cpp
+++ b/src/datavisualization/engine/scatter3drenderer.cpp
@@ -1606,10 +1606,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);
@@ -1731,10 +1732,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 +1838,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..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,