diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-07-08 15:11:06 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-07-09 07:40:05 +0300 |
commit | 24275c551f0a10df022f037962d1678b7213ef09 (patch) | |
tree | 310a339c2c1582d68618881c905fd32dd64f2f5e /src/datavis3d/engine/drawer.cpp | |
parent | d9267977b3f5bb8ab5573c29f0721a07397e5b82 (diff) |
Refactor data item
Data items do not need to know about rendering related stuff,
so separated that to render items. Renderer will maintain
array of render items equal to the sample space.
Change-Id: I61c0db96f115b7c667e37ea92aa5ae6b8583c61a
Reviewed-by: Mika Salmela <mika.salmela@digia.com>
Diffstat (limited to 'src/datavis3d/engine/drawer.cpp')
-rw-r--r-- | src/datavis3d/engine/drawer.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/datavis3d/engine/drawer.cpp b/src/datavis3d/engine/drawer.cpp index b5a59607..675848b0 100644 --- a/src/datavis3d/engine/drawer.cpp +++ b/src/datavis3d/engine/drawer.cpp @@ -46,7 +46,6 @@ #include "camerahelper_p.h" #include "utils_p.h" #include "texturehelper_p.h" -#include "qabstractdataitem_p.h" #include <QMatrix4x4> #include <qmath.h> @@ -162,7 +161,7 @@ void Drawer::drawObject(ShaderHelper *shader, ObjectHelper *object, GLuint textu glBindTexture(GL_TEXTURE_2D, *oldTexId); } -void Drawer::drawLabel(const QAbstractDataItem &item, const LabelItem &labelItem, +void Drawer::drawLabel(const AbstractRenderItem &item, const LabelItem &labelItem, const QMatrix4x4 &viewmatrix, const QMatrix4x4 &projectionmatrix, const QVector3D &positionComp, const QVector3D &rotation, GLfloat itemHeight, SelectionMode mode, @@ -193,19 +192,19 @@ void Drawer::drawLabel(const QAbstractDataItem &item, const LabelItem &labelItem } case LabelMid: { // Use this for positioning with absolute item y position value - yPosition = item.d_ptr->translation().y(); + yPosition = item.translation().y(); break; } case LabelHigh: { // TODO: Fix this. Can't seem to get it right (if ok with positive-only bars, doesn't look good on +- and vice versa) - yPosition = item.d_ptr->translation().y() + itemHeight / 2.0f; + yPosition = item.translation().y() + itemHeight / 2.0f; break; } case LabelOver: { float mod = 0.1f; if (itemHeight < 0) mod = -0.1f; - yPosition = item.d_ptr->translation().y() - (positionComp.y() / 2.0f - 0.2f) + yPosition = item.translation().y() - (positionComp.y() / 2.0f - 0.2f) + itemHeight + mod; break; } @@ -259,11 +258,11 @@ void Drawer::drawLabel(const QAbstractDataItem &item, const LabelItem &labelItem } if (position < LabelBottom) { - xPosition = item.d_ptr->translation().x(); + xPosition = item.translation().x(); if (useDepth) - zPosition = item.d_ptr->translation().z(); + zPosition = item.translation().z(); else if (ModeZoomColumn == mode) - xPosition = -(item.d_ptr->translation().z()) + positionComp.z(); // flip first to left + xPosition = -(item.translation().z()) + positionComp.z(); // flip first to left } // Position label @@ -295,9 +294,9 @@ void Drawer::drawLabel(const QAbstractDataItem &item, const LabelItem &labelItem drawObject(shader, object, labelItem.textureId()); } -void Drawer::generateLabelTexture(QAbstractDataItem *item) +void Drawer::generateLabelTexture(AbstractRenderItem *item) { - LabelItem &labelItem = item->d_ptr->labelItem(); + LabelItem &labelItem = item->labelItem(); generateLabelItem(labelItem, item->label()); } |