diff options
author | Mika Salmela <mika.salmela@digia.com> | 2014-10-14 17:04:47 +0300 |
---|---|---|
committer | Mika Salmela <mika.salmela@digia.com> | 2014-10-15 09:55:37 +0300 |
commit | f5ee23bb1ff27dbd3cfaa714bfd907e8b9e17d2b (patch) | |
tree | bc7360d05ce1a011f18d2f76a3534d0df3dba9ea /src | |
parent | 733bff1b086e182dba5f9713fefa8995852f0c0e (diff) |
Small cleanups for surface
Unnecessary modelMatrix multiplications removed. Intentional whitespace
removal.
Change-Id: I78b8e6f984d44baf7015c9551701b04cb869fc8b
Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/datavisualization/engine/surface3drenderer.cpp | 19 | ||||
-rw-r--r-- | src/datavisualization/utils/surfaceobject.cpp | 2 |
2 files changed, 7 insertions, 14 deletions
diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp index efecb0e1..e39c986c 100644 --- a/src/datavisualization/engine/surface3drenderer.cpp +++ b/src/datavisualization/engine/surface3drenderer.cpp @@ -1210,12 +1210,9 @@ void Surface3DRenderer::drawScene(GLuint defaultFboHandle) SurfaceObject *object = cache->surfaceObject(); if (object->indexCount() && cache->surfaceVisible() && cache->isVisible() && cache->sampleSpace().width() >= 2 && cache->sampleSpace().height() >= 2) { - QMatrix4x4 modelMatrix; - QMatrix4x4 MVPMatrix; - - MVPMatrix = depthProjectionViewMatrix * modelMatrix; - cache->setMVPMatrix(MVPMatrix); - m_depthShader->setUniformValue(m_depthShader->MVP(), MVPMatrix); + // No translation nor scaling for surfaces, therefore no modelMatrix + // Use directly projectionViewMatrix + m_depthShader->setUniformValue(m_depthShader->MVP(), depthProjectionViewMatrix); // 1st attribute buffer : vertices glEnableVertexAttribArray(m_depthShader->posAtt()); @@ -1291,11 +1288,7 @@ void Surface3DRenderer::drawScene(GLuint defaultFboHandle) foreach (SeriesRenderCache *baseCache, m_renderCacheList) { SurfaceSeriesRenderCache *cache = static_cast<SurfaceSeriesRenderCache *>(baseCache); if (cache->surfaceObject()->indexCount() && cache->renderable()) { - QMatrix4x4 modelMatrix; - QMatrix4x4 MVPMatrix; - - MVPMatrix = projectionViewMatrix * modelMatrix; - m_selectionShader->setUniformValue(m_selectionShader->MVP(), MVPMatrix); + m_selectionShader->setUniformValue(m_selectionShader->MVP(), projectionViewMatrix); cache->surfaceObject()->activateSurfaceTexture(false); @@ -1348,9 +1341,9 @@ void Surface3DRenderer::drawScene(GLuint defaultFboHandle) QMatrix4x4 itModelMatrix; #ifdef SHOW_DEPTH_TEXTURE_SCENE - MVPMatrix = depthProjectionViewMatrix * modelMatrix; + MVPMatrix = depthProjectionViewMatrix; #else - MVPMatrix = projectionViewMatrix * modelMatrix; + MVPMatrix = projectionViewMatrix; #endif cache->setMVPMatrix(MVPMatrix); diff --git a/src/datavisualization/utils/surfaceobject.cpp b/src/datavisualization/utils/surfaceobject.cpp index 86cd2789..5498c8b3 100644 --- a/src/datavisualization/utils/surfaceobject.cpp +++ b/src/datavisualization/utils/surfaceobject.cpp @@ -110,7 +110,7 @@ void SurfaceObject::setUpSmoothData(const QSurfaceDataArray &dataArray, const QR totalIndex = 0; if ((m_dataDimension == BothAscending) || (m_dataDimension == XDescending)) { - for (int row = 0; row < rowLimit; row ++) + for (int row = 0; row < rowLimit; row++) createSmoothNormalBodyLine(totalIndex, row * m_columns); createSmoothNormalUpperLine(totalIndex); } else { // BothDescending || ZDescending |