History

Another tweak.

Andrzej Kapolka committed 11 years ago

Commit b8a15f01 parent c124dff1 file · +12 −4Browse files

Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 1 file). Show all

Unified · Split

interface/src/MetavoxelSystem.cpp+12−4
@@ -1542,13 +1542,21 @@ static inline void appendTriangle(const EdgeCrossing& e0, const EdgeCrossing& e1 · 1541 unmodified lines
15421542
15431543 const int CORNER_COUNT = 4;
15441544
1545−static inline StackArray::Entry getEntry(const StackArray* lineSrc, int stackWidth, int y, float heightfieldHeight,
1545+static StackArray::Entry getEntry(const StackArray* lineSrc, int stackWidth, int y, float heightfieldHeight,
15461546 EdgeCrossing cornerCrossings[CORNER_COUNT], int cornerIndex) {
1547+ int offsetX = (cornerIndex & X_MAXIMUM_FLAG) ? 1 : 0;
1548+ int offsetZ = (cornerIndex & Y_MAXIMUM_FLAG) ? 1 : 0;
1549+ const StackArray& src = lineSrc[offsetZ * stackWidth + offsetX];
1550+ int count = src.getEntryCount();
1551+ if (count > 0) {
1552+ int relative = y - src.getPosition();
1553+ if (relative < count && (relative >= 0 || heightfieldHeight == 0.0f)) {
1554+ return src.getEntry(y, heightfieldHeight);
1555+ }
1556+ }
15471557 const EdgeCrossing& cornerCrossing = cornerCrossings[cornerIndex];
15481558 if (cornerCrossing.point.y == 0.0f) {
1549− int offsetX = (cornerIndex & X_MAXIMUM_FLAG) ? 1 : 0;
1550− int offsetZ = (cornerIndex & Y_MAXIMUM_FLAG) ? 1 : 0;
1551− return lineSrc[offsetZ * stackWidth + offsetX].getEntry(y, heightfieldHeight);
1559+ return src.getEntry(y, heightfieldHeight);
15521560 }
15531561 StackArray::Entry entry;
15541562 bool set = false;