diff options
author | Mika Salmela <mika.salmela@digia.com> | 2013-09-27 15:31:37 +0300 |
---|---|---|
committer | Mika Salmela <mika.salmela@digia.com> | 2013-09-30 09:56:25 +0300 |
commit | 08e4b647650294d2d365f23b3620019472d8cec1 (patch) | |
tree | 5bba67bd4f6f6a72ca54dbbea689f14d1a312d1a /src/datavisualization/engine | |
parent | 3cba32ca2e0ec2d60b0bc330a3284f646bda8a83 (diff) |
Surface shader changed on smooth update if no object yet
setSmoothSurfaceEnabled not effective if no object, ie. if setting the
status before setting the model.
Task-number: QTRD-2342
Change-Id: I6087bfc208cd5ebbc58071fbeabcf9b825629abd
Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'src/datavisualization/engine')
-rw-r--r-- | src/datavisualization/engine/surface3drenderer.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp index 25a6a519..e3e89b14 100644 --- a/src/datavisualization/engine/surface3drenderer.cpp +++ b/src/datavisualization/engine/surface3drenderer.cpp @@ -1732,29 +1732,34 @@ void Surface3DRenderer::calculateSceneScalingFactors() bool Surface3DRenderer::updateSmoothStatus(bool enable) { - m_cachedSmoothSurface = enable; - if (!m_cachedSmoothSurface && !m_flatSupported) { + if (!enable && !m_flatSupported) { qWarning() << "Warning: Flat qualifier not supported on your platform's GLSL language." " Requires at least GLSL version 1.5."; - m_cachedSmoothSurface = true; + enable = true; } - if (!m_surfaceObj) - return m_cachedSmoothSurface; + bool changed = false; + if (enable != m_cachedSmoothSurface) { + m_cachedSmoothSurface = enable; + changed = true; + } - if (m_cachedSmoothSurface == false && !m_flatSupported) - m_cachedSmoothSurface = true; + if (changed) + initSurfaceShaders(); - if (m_cachedSmoothSurface) { - m_surfaceObj->setUpSmoothData(m_dataArray, m_sampleSpace, m_heightNormalizer, true, - m_cachedSelectionMode != QDataVis::ModeNone); + // If no surface object created yet, don't try to update the object, instead return + if (!m_surfaceObj || !changed) { + return m_cachedSmoothSurface; } else { - m_surfaceObj->setUpData(m_dataArray, m_sampleSpace, m_heightNormalizer, true, - m_cachedSelectionMode != QDataVis::ModeNone); + if (m_cachedSmoothSurface) { + m_surfaceObj->setUpSmoothData(m_dataArray, m_sampleSpace, m_heightNormalizer, true, + m_cachedSelectionMode != QDataVis::ModeNone); + } else { + m_surfaceObj->setUpData(m_dataArray, m_sampleSpace, m_heightNormalizer, true, + m_cachedSelectionMode != QDataVis::ModeNone); + } } - initSurfaceShaders(); - return m_cachedSmoothSurface; } |