From 79e18b161d823ebe9f13247310eef2f0cd8c0f5e Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Tue, 20 Jan 2015 18:42:40 -0800 Subject: [PATCH] Simplification. --- interface/src/MetavoxelSystem.cpp | 54 ------------------------------- 1 file changed, 54 deletions(-) diff --git a/interface/src/MetavoxelSystem.cpp b/interface/src/MetavoxelSystem.cpp index b9cce33828..dd67f27d79 100644 --- a/interface/src/MetavoxelSystem.cpp +++ b/interface/src/MetavoxelSystem.cpp @@ -1490,7 +1490,6 @@ public: void swap(IndexVector& other) { QVector::swap(other); qSwap(position, other.position); } const NormalIndex& get(int y) const; - const NormalIndex& getClosest(int y) const; }; const NormalIndex& IndexVector::get(int y) const { @@ -1499,56 +1498,6 @@ const NormalIndex& IndexVector::get(int y) const { return (relative >= 0 && relative < size()) ? at(relative) : invalidIndex; } -const NormalIndex& IndexVector::getClosest(int y) const { - static NormalIndex invalidIndex = { { -1, -1, -1, -1 } }; - int relative = y - position; - if (relative < 0 || relative >= size()) { - return invalidIndex; - } - const NormalIndex& first = at(relative); - if (first.isValid()) { - return first; - } - for (int distance = 1; relative - distance >= 0 || relative + distance < size(); distance++) { - int previous = relative - distance; - if (previous >= 0) { - const NormalIndex& previousIndex = at(previous); - if (previousIndex.isValid()) { - return previousIndex; - } - } - int next = relative + distance; - if (next < size()) { - const NormalIndex& nextIndex = at(next); - if (nextIndex.isValid()) { - return nextIndex; - } - } - } - return invalidIndex; -} - -static inline void appendIndices(QVector& indices, QMultiHash& quadIndices, - const QVector& vertices, float step, int i0, int i1, int i2, int i3) { - int newIndices[] = { i0, i1, i2, i3 }; - glm::vec3 minima(FLT_MAX, FLT_MAX, FLT_MAX), maxima(-FLT_MAX, -FLT_MAX, -FLT_MAX); - int indexIndex = indices.size(); - for (unsigned int i = 0; i < sizeof(newIndices) / sizeof(newIndices[0]); i++) { - int index = newIndices[i]; - indices.append(index); - const glm::vec3& vertex = vertices.at(index).vertex; - minima = glm::min(vertex, minima); - maxima = glm::max(vertex, maxima); - } - for (int z = (int)minima.z, endZ = (int)glm::ceil(maxima.z); z < endZ; z++) { - for (int y = (int)minima.x, endY = (int)glm::ceil(maxima.y); y < endY; y++) { - for (int x = (int)minima.x, endX = (int)glm::ceil(maxima.x); x < endX; x++) { - quadIndices.insert(qRgb(x, y, z), indexIndex); - } - } - } -} - void HeightfieldNodeRenderer::render(const HeightfieldNodePointer& node, const glm::vec3& translation, const glm::quat& rotation, const glm::vec3& scale, bool cursor) { if (!node->getHeight()) { @@ -1941,9 +1890,6 @@ void HeightfieldNodeRenderer::render(const HeightfieldNodePointer& node, const g int offsetZ = (i & Y_MAXIMUM_FLAG) ? 1 : 0; const quint16* height = heightLineSrc + offsetZ * width + offsetX; float heightValue = *height * voxelScale; - if (heightValue >= y && heightValue < y + 1) { - crossings[crossingCount++] = cornerCrossings[i]; - } int nextIndex = NEXT_CORNERS[i]; if (!(corners & (1 << nextIndex))) { continue;