From 10fdb01436b6e870f93f2257833149e9fda98752 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Mon, 29 Dec 2014 15:16:40 -0800 Subject: [PATCH] Fix for toggling Hermite display. --- interface/src/MetavoxelSystem.cpp | 8 +++++--- interface/src/MetavoxelSystem.h | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/interface/src/MetavoxelSystem.cpp b/interface/src/MetavoxelSystem.cpp index eaad7b8de0..d9be17a260 100644 --- a/interface/src/MetavoxelSystem.cpp +++ b/interface/src/MetavoxelSystem.cpp @@ -579,7 +579,8 @@ bool MetavoxelSystem::findFirstRayVoxelIntersection(const glm::vec3& origin, con } void MetavoxelSystem::paintHeightfieldColor(const glm::vec3& position, float radius, const QColor& color) { - MetavoxelEditMessage edit = { QVariant::fromValue(PaintHeightfieldMaterialEdit(position, radius, SharedObjectPointer(), color)) }; + MetavoxelEditMessage edit = { QVariant::fromValue(PaintHeightfieldMaterialEdit(position, radius, + SharedObjectPointer(), color)) }; applyEdit(edit, true); } @@ -1106,6 +1107,7 @@ VoxelBuffer::VoxelBuffer(const QVector& vertices, const QVector _vertices(vertices), _indices(indices), _hermite(hermite), + _hermiteEnabled(Menu::getInstance()->isOptionChecked(MenuOption::DisplayHermiteData)), _quadIndices(quadIndices), _size(size), _vertexCount(vertices.size()), @@ -2292,7 +2294,8 @@ void HeightfieldNodeRenderer::render(const HeightfieldNodePointer& node, const g // restore the default alignment; it's what Qt uses for image storage glPixelStorei(GL_UNPACK_ALIGNMENT, 4); } - if (!_voxels && node->getStack()) { + bool displayHermite = Menu::getInstance()->isOptionChecked(MenuOption::DisplayHermiteData); + if ((!_voxels || (displayHermite && !static_cast(_voxels.data())->isHermiteEnabled())) && node->getStack()) { QVector vertices; QVector indices; QVector hermiteSegments; @@ -2306,7 +2309,6 @@ void HeightfieldNodeRenderer::render(const HeightfieldNodePointer& node, const g glm::vec3 pos; glm::vec3 step(1.0f / innerStackWidth, scale.x / (innerStackWidth * scale.y), 1.0f / innerStackHeight); - bool displayHermite = Menu::getInstance()->isOptionChecked(MenuOption::DisplayHermiteData); for (int z = 0; z < stackHeight; z++, pos.z += step.z) { pos.x = 0.0f; diff --git a/interface/src/MetavoxelSystem.h b/interface/src/MetavoxelSystem.h index af6480c034..51424be930 100644 --- a/interface/src/MetavoxelSystem.h +++ b/interface/src/MetavoxelSystem.h @@ -331,6 +331,8 @@ public: const QMultiHash& quadIndices, int size, const QVector& materials = QVector()); + bool isHermiteEnabled() const { return _hermiteEnabled; } + /// Finds the first intersection between the described ray and the voxel data. /// \param entry the entry point of the ray in relative coordinates, from (0, 0, 0) to (1, 1, 1) bool findFirstRayIntersection(const glm::vec3& entry, const glm::vec3& origin, @@ -344,6 +346,7 @@ private: QVector _vertices; QVector _indices; QVector _hermite; + bool _hermiteEnabled; QMultiHash _quadIndices; int _size; int _vertexCount;