Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 1 file). Show all
Unified · Split
| @@ -1542,13 +1542,21 @@ static inline void appendTriangle(const EdgeCrossing& e0, const EdgeCrossing& e1 · 1541 unmodified lines | ||
| 1542 | 1542 | |
| 1543 | 1543 | const int CORNER_COUNT = 4; |
| 1544 | 1544 | |
| 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, | |
| 1546 | 1546 | 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 | + } | |
| 1547 | 1557 | const EdgeCrossing& cornerCrossing = cornerCrossings[cornerIndex]; |
| 1548 | 1558 | 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); | |
| 1552 | 1560 | } |
| 1553 | 1561 | StackArray::Entry entry; |
| 1554 | 1562 | bool set = false; |