diff options
Diffstat (limited to 'src')
6 files changed, 56 insertions, 63 deletions
diff --git a/src/datavisualization/datavisualization.pro b/src/datavisualization/datavisualization.pro index 87857062..bfb07440 100644 --- a/src/datavisualization/datavisualization.pro +++ b/src/datavisualization/datavisualization.pro @@ -1,7 +1,10 @@ -TARGET = QtDataVisualization -QT = core gui +# Target can't start with 'Qt' as it gets major version number inserted into it in that case, +# which we don't want. +TARGET = DataVisualization +QT = core gui DEFINES += QT_DATAVISUALIZATION_LIBRARY +MODULE_INCNAME = QtDataVisualization QMAKE_DOCS = $$PWD/doc/qtdatavisualization.qdocconf diff --git a/src/datavisualization/doc/qtdatavisualization.qdocconf b/src/datavisualization/doc/qtdatavisualization.qdocconf index e3189604..82a5d8c4 100644 --- a/src/datavisualization/doc/qtdatavisualization.qdocconf +++ b/src/datavisualization/doc/qtdatavisualization.qdocconf @@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtDataVisualization description = Qt Data Visualization Reference Documentation -version = 1.0.0 +version = 0.1.0 exampledirs += ../../../examples \ snippets @@ -18,14 +18,14 @@ depends += qtcore \ qhp.projects = qtdatavisualization qhp.qtdatavisualization.file = qtdatavisualization.qhp -qhp.qtdatavisualization.namespace = org.qt-project.qtdatavisualization.1.0.0 +qhp.qtdatavisualization.namespace = org.qt-project.qtdatavisualization.0.1.0 qhp.qtdatavisualization.virtualFolder = qtdatavisualization qhp.qtdatavisualization.indexTitle = Qt Data Visualization qhp.qtdatavisualization.indexRoot = -qhp.qtdatavisualization.filterAttributes = qtdatavisualization 1.0.0 qtrefdoc -qhp.qtdatavisualization.customFilters.Qt.name = QtDataVisualization 1.0.0 -qhp.qtdatavisualization.customFilters.Qt.filterAttributes = qtdatavisualization 1.0.0 +qhp.qtdatavisualization.filterAttributes = qtdatavisualization 0.1.0 qtrefdoc +qhp.qtdatavisualization.customFilters.Qt.name = QtDataVisualization 0.1.0 +qhp.qtdatavisualization.customFilters.Qt.filterAttributes = qtdatavisualization 0.1.0 qhp.qtdatavisualization.subprojects = classes qhp.qtdatavisualization.subprojects.classes.title = C++ Classes qhp.qtdatavisualization.subprojects.classes.indexTitle = Qt Data Visualization C++ Classes diff --git a/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.cpp b/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.cpp index 2f3d6a98..d32bde0e 100644 --- a/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.cpp +++ b/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.cpp @@ -82,11 +82,13 @@ QItemModelSurfaceDataProxy *proxy = new QItemModelSurfaceDataProxy(customModel, //! [6] qmake make +make install //! [6] //! [7] qmake CONFIG+=static make +make install //! [7] //! [8] diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp index 74c1a99b..32a23da5 100644 --- a/src/datavisualization/engine/bars3drenderer.cpp +++ b/src/datavisualization/engine/bars3drenderer.cpp @@ -43,6 +43,7 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE const GLfloat labelMargin = 0.05f; const GLfloat gridLineWidth = 0.005f; static QVector3D selectionSkipColor = QVector3D(255, 255, 255); // Selection texture's background color +const int smallerVPSize = 5; Bars3DRenderer::Bars3DRenderer(Bars3DController *controller) : Abstract3DRenderer(controller), @@ -356,7 +357,6 @@ void Bars3DRenderer::drawSlicedScene(const LabelItem &xLabel, m_cachedTheme.m_ambientStrength * 2.0f); // Draw the object #if defined (Q_OS_MAC) - // Mac slice issue hack fix. TODO: Fix correctly m_drawer->drawObject(m_barShader, m_barObj, 0, -1); #else m_drawer->drawObject(m_barShader, m_barObj); @@ -481,7 +481,8 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle) QMatrix4x4 viewMatrix = m_cachedScene->activeCamera()->viewMatrix(); // Calculate drawing order - // Draw order is reversed to optimize amount of drawing (ie. draw front objects first, depth test handles not needing to draw objects behind them) + // Draw order is reversed to optimize amount of drawing (ie. draw front objects first, + // depth test handles not needing to draw objects behind them) if (viewMatrix.row(0).x() > 0) { startRow = 0; stopRow = m_cachedRowCount; @@ -530,7 +531,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle) QMatrix4x4 depthProjectionMatrix; #if !defined(QT_OPENGL_ES_2) - if (m_cachedShadowQuality > QDataVis::ShadowQualityNone && !m_cachedIsSlicingActivated) { + if (m_cachedShadowQuality > QDataVis::ShadowQualityNone) { // Render scene into a depth texture for using with shadow mapping // Enable drawing to depth framebuffer glBindFramebuffer(GL_FRAMEBUFFER, m_depthFrameBuffer); @@ -540,7 +541,8 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle) m_depthShader->bind(); // Set viewport for depth map rendering. Must match texture size. Larger values give smoother shadows. - glViewport(m_mainViewPort.x(), m_mainViewPort.y(), + // Depth viewport must always start from 0, 0, as it is rendered into a texture, not screen + glViewport(0, 0, m_mainViewPort.width() * m_shadowQualityMultiplier, m_mainViewPort.height() * m_shadowQualityMultiplier); @@ -688,8 +690,6 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle) MVPMatrix = projectionMatrix * viewMatrix * modelMatrix; - // TODO: Save position to qdataitem, so that we don't need to calculate it each time? - //#if !defined(QT_OPENGL_ES_2) // QVector3D barColor = QVector3D((GLdouble)row / 32767.0, // (GLdouble)bar / 32767.0, @@ -812,7 +812,8 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle) #if 0 QVector3D baseColor = Utils::vectorFromColor(m_cachedTheme.m_baseColor); - QVector3D heightColor = Utils::vectorFromColor(m_cachedTheme.m_heightColor) * item.height(); + QVector3D heightColor = Utils::vectorFromColor(m_cachedTheme.m_heightColor) + * item.height(); QVector3D depthColor = Utils::vectorFromColor(m_cachedTheme.m_depthColor) * (float(row) / GLfloat(m_cachedRowCount)); @@ -902,11 +903,11 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle) itModelMatrix.transposed().inverted()); m_barShader->setUniformValue(m_barShader->MVP(), MVPMatrix); m_barShader->setUniformValue(m_barShader->color(), barColor); - m_barShader->setUniformValue(m_barShader->ambientS(), m_cachedTheme.m_ambientStrength); + m_barShader->setUniformValue(m_barShader->ambientS(), + m_cachedTheme.m_ambientStrength); #if !defined(QT_OPENGL_ES_2) - if (m_cachedShadowQuality > QDataVis::ShadowQualityNone - && !m_cachedIsSlicingActivated) { + if (m_cachedShadowQuality > QDataVis::ShadowQualityNone) { // Set shadow shader bindings m_barShader->setUniformValue(m_barShader->shadowQ(), m_shadowQualityToShader); m_barShader->setUniformValue(m_barShader->depth(), depthMVPMatrix); @@ -921,12 +922,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle) m_barShader->setUniformValue(m_barShader->lightS(), lightStrength); // Draw the object -#if defined (Q_OS_MAC) - // Mac slice issue hack fix. TODO: Fix correctly - m_drawer->drawObject(m_barShader, m_barObj, 0, -1); -#else m_drawer->drawObject(m_barShader, m_barObj); -#endif } } } @@ -1286,8 +1282,8 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle) QVector3D(0.0f, m_yAdjustment, zComp), QVector3D(rotLabelX, rotLabelY, rotLabelZ), 0, m_cachedSelectionMode, - m_labelShader, m_labelObj, m_cachedScene->activeCamera(), true, true, Drawer::LabelMid, - alignment); + m_labelShader, m_labelObj, m_cachedScene->activeCamera(), + true, true, Drawer::LabelMid, alignment); } } for (int column = 0; column != m_cachedColumnCount; column += 1) { @@ -1324,8 +1320,8 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle) QVector3D(0.0f, m_yAdjustment, zComp), QVector3D(rotLabelX, rotLabelY, rotLabelZ), 0, m_cachedSelectionMode, - m_labelShader, m_labelObj, m_cachedScene->activeCamera(), true, true, Drawer::LabelMid, - alignment); + m_labelShader, m_labelObj, m_cachedScene->activeCamera(), + true, true, Drawer::LabelMid, alignment); } } @@ -1373,8 +1369,8 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle) QVector3D(0.0f, m_yAdjustment, zComp), QVector3D(rotLabelX, rotLabelY, rotLabelZ), 0, m_cachedSelectionMode, - m_labelShader, m_labelObj, m_cachedScene->activeCamera(), true, true, Drawer::LabelMid, - alignment); + m_labelShader, m_labelObj, m_cachedScene->activeCamera(), + true, true, Drawer::LabelMid, alignment); // Side wall if (m_xFlipped) @@ -1394,8 +1390,8 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle) QVector3D(0.0f, m_yAdjustment, zComp), QVector3D(rotLabelX, rotLabelY, rotLabelZ), 0, m_cachedSelectionMode, - m_labelShader, m_labelObj, m_cachedScene->activeCamera(), true, true, Drawer::LabelMid, - alignment); + m_labelShader, m_labelObj, m_cachedScene->activeCamera(), + true, true, Drawer::LabelMid, alignment); } labelNbr++; labelPos += heightStep; @@ -1498,9 +1494,10 @@ void Bars3DRenderer::handleResize() // Set view port if (m_cachedIsSlicingActivated) { m_mainViewPort = QRect(0, - m_cachedBoundingRect.height() - m_cachedBoundingRect.height() / 5, - m_cachedBoundingRect.width() / 5, - m_cachedBoundingRect.height() / 5); + m_cachedBoundingRect.height() + - (m_cachedBoundingRect.height() / smallerVPSize), + m_cachedBoundingRect.width() / smallerVPSize, + m_cachedBoundingRect.height() / smallerVPSize); m_sliceViewPort = QRect(0, 0, m_cachedBoundingRect.width(), m_cachedBoundingRect.height()); } else { m_mainViewPort = QRect(0, 0, m_cachedBoundingRect.width(), m_cachedBoundingRect.height()); @@ -1722,14 +1719,16 @@ Bars3DController::SelectionType Bars3DRenderer::isSelected(GLint row, GLint bar) if (current == m_selection) { isSelectedType = Bars3DController::SelectionItem; } - else if (current.y() == m_selection.y() && (m_cachedSelectionMode == QDataVis::SelectionModeItemAndColumn - || m_cachedSelectionMode == QDataVis::SelectionModeItemRowAndColumn - || m_cachedSelectionMode == QDataVis::SelectionModeSliceColumn)) { + else if (current.y() == m_selection.y() + && (m_cachedSelectionMode == QDataVis::SelectionModeItemAndColumn + || m_cachedSelectionMode == QDataVis::SelectionModeItemRowAndColumn + || m_cachedSelectionMode == QDataVis::SelectionModeSliceColumn)) { isSelectedType = Bars3DController::SelectionColumn; } - else if (current.x() == m_selection.x() && (m_cachedSelectionMode == QDataVis::SelectionModeItemAndRow - || m_cachedSelectionMode == QDataVis::SelectionModeItemRowAndColumn - || m_cachedSelectionMode == QDataVis::SelectionModeSliceRow)) { + else if (current.x() == m_selection.x() + && (m_cachedSelectionMode == QDataVis::SelectionModeItemAndRow + || m_cachedSelectionMode == QDataVis::SelectionModeItemRowAndColumn + || m_cachedSelectionMode == QDataVis::SelectionModeSliceRow)) { isSelectedType = Bars3DController::SelectionRow; } return isSelectedType; @@ -1742,22 +1741,20 @@ void Bars3DRenderer::updateSlicingActive(bool isSlicing) m_cachedIsSlicingActivated = isSlicing; if (isSlicing) { - m_mainViewPort = QRect(0, m_cachedBoundingRect.height() - m_cachedBoundingRect.height() / 5, - m_cachedBoundingRect.width() / 5, m_cachedBoundingRect.height() / 5); + m_mainViewPort = QRect(0, + m_cachedBoundingRect.height() + - (m_cachedBoundingRect.height() / smallerVPSize), + m_cachedBoundingRect.width() / smallerVPSize, + m_cachedBoundingRect.height() / smallerVPSize); m_sliceViewPort = QRect(0, 0, m_cachedBoundingRect.width(), m_cachedBoundingRect.height()); - if (m_depthTexture) { - m_textureHelper->deleteTexture(&m_depthTexture); - m_depthTexture = 0; - } } else { - m_mainViewPort = QRect(0, 0, this->m_cachedBoundingRect.width(), - this->m_cachedBoundingRect.height()); + m_mainViewPort = QRect(0, 0, m_cachedBoundingRect.width(), m_cachedBoundingRect.height()); m_sliceViewPort = QRect(0, 0, 0, 0); initSelectionBuffer(); // We need to re-init selection buffer in case there has been a resize + } #if !defined(QT_OPENGL_ES_2) - updateDepthBuffer(); // Re-init depth buffer as well + updateDepthBuffer(); // Re-init depth buffer as well #endif - } } QRect Bars3DRenderer::mainViewPort() @@ -1807,9 +1804,6 @@ void Bars3DRenderer::initDepthShader() void Bars3DRenderer::updateDepthBuffer() { - if (m_cachedIsSlicingActivated) - return; - if (m_depthTexture) { m_textureHelper->deleteTexture(&m_depthTexture); m_depthTexture = 0; diff --git a/src/datavisualization/engine/drawer.cpp b/src/datavisualization/engine/drawer.cpp index 9d50186d..b3b0fe99 100644 --- a/src/datavisualization/engine/drawer.cpp +++ b/src/datavisualization/engine/drawer.cpp @@ -93,12 +93,6 @@ void Drawer::setStyle(QDataVis::LabelStyle style) void Drawer::drawObject(ShaderHelper *shader, AbstractObjectHelper *object, GLuint textureId, GLuint depthTextureId) { - // Store the GL state before changing - GLint oldActiveTex[1]; - glGetIntegerv(GL_ACTIVE_TEXTURE, oldActiveTex); - GLint oldTexId[1]; - glGetIntegerv(GL_TEXTURE_BINDING_2D, oldTexId); - if (textureId) { // Activate texture glActiveTexture(GL_TEXTURE0); @@ -147,8 +141,8 @@ void Drawer::drawObject(ShaderHelper *shader, AbstractObjectHelper *object, GLui glDisableVertexAttribArray(shader->posAtt()); // Restore the GL state - glActiveTexture(*oldActiveTex); - glBindTexture(GL_TEXTURE_2D, *oldTexId); + glActiveTexture(0); + glBindTexture(GL_TEXTURE_2D, 0); } void Drawer::drawSurfaceGrid(ShaderHelper *shader, SurfaceObject *object) diff --git a/src/datavisualization/global/qdatavisualizationglobal.h b/src/datavisualization/global/qdatavisualizationglobal.h index ac734960..eefa2888 100644 --- a/src/datavisualization/global/qdatavisualizationglobal.h +++ b/src/datavisualization/global/qdatavisualizationglobal.h @@ -21,13 +21,13 @@ #include <qglobal.h> -#define QT_DATAVISUALIZATION_VERSION_STR "0.0.1" +#define QT_DATAVISUALIZATION_VERSION_STR "0.1.0" /* QT_DATAVISUALIZATION_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_DATAVISUALIZATION_VERSION 0x000001 +#define QT_DATAVISUALIZATION_VERSION 0x000100 /* - can be used like #if (QT_DATAVISUALIZATION_VERSION >= QT_DATAVISUALIZATION_VERSION_CHECK(1, 1, 0)) + can be used like #if (QT_DATAVISUALIZATION_VERSION >= QT_DATAVISUALIZATION_VERSION_CHECK(1, 0, 0)) */ #define QT_DATAVISUALIZATION_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) |