Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 1 file). Show all
Unified · Split
| @@ -1491,11 +1491,14 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) { · 1490 unmodified lines | ||
| 1491 | 1491 | quadIndices.insert(qRgb(x, y - 1, z - 1), indices.size()); |
| 1492 | 1492 | quadIndices.insert(qRgb(x, y, z - 1), indices.size()); |
| 1493 | 1493 | |
| 1494 | − glm::vec3 normal(1.0f, 0.0f, 0.0f); | |
| 1495 | − | |
| 1496 | 1494 | const NormalIndex& index1 = lastLineIndices.at(x); |
| 1497 | 1495 | const NormalIndex& index2 = lastPlaneIndices.at((y - 1) * expanded + x); |
| 1498 | 1496 | const NormalIndex& index3 = lastPlaneIndices.at(y * expanded + x); |
| 1497 | + | |
| 1498 | + const glm::vec3& first = vertices.at(index.indices[0]).vertex; | |
| 1499 | + glm::vec3 normal = glm::cross(vertices.at(index1.indices[0]).vertex - first, | |
| 1500 | + vertices.at(index3.indices[0]).vertex - first); | |
| 1501 | + | |
| 1499 | 1502 | if (alpha0 == 0) { // quad faces negative x |
| 1500 | 1503 | indices.append(index3.getClosestIndex(normal = -normal, vertices)); |
| 1501 | 1504 | indices.append(index2.getClosestIndex(normal, vertices)); |
| @@ -1514,11 +1517,14 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) { · 12 unmodified lines | ||
| 1514 | 1517 | quadIndices.insert(qRgb(x - 1, y, z - 1), indices.size()); |
| 1515 | 1518 | quadIndices.insert(qRgb(x, y, z - 1), indices.size()); |
| 1516 | 1519 | |
| 1517 | − glm::vec3 normal(0.0f, 1.0f, 0.0f); | |
| 1518 | − | |
| 1519 | 1520 | const NormalIndex& index1 = lastIndex; |
| 1520 | 1521 | const NormalIndex& index2 = lastPlaneIndices.at(y * expanded + x - 1); |
| 1521 | 1522 | const NormalIndex& index3 = lastPlaneIndices.at(y * expanded + x); |
| 1523 | + | |
| 1524 | + const glm::vec3& first = vertices.at(index.indices[0]).vertex; | |
| 1525 | + glm::vec3 normal = glm::cross(vertices.at(index3.indices[0]).vertex - first, | |
| 1526 | + vertices.at(index1.indices[0]).vertex - first); | |
| 1527 | + | |
| 1522 | 1528 | if (alpha0 == 0) { // quad faces negative y |
| 1523 | 1529 | indices.append(index1.getClosestIndex(normal = -normal, vertices)); |
| 1524 | 1530 | indices.append(index2.getClosestIndex(normal, vertices)); |
| @@ -1537,11 +1543,14 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) { · 12 unmodified lines | ||
| 1537 | 1543 | quadIndices.insert(qRgb(x - 1, y - 1, z), indices.size()); |
| 1538 | 1544 | quadIndices.insert(qRgb(x, y - 1, z), indices.size()); |
| 1539 | 1545 | |
| 1540 | − glm::vec3 normal(0.0f, 0.0f, 1.0f); | |
| 1541 | − | |
| 1542 | 1546 | const NormalIndex& index1 = lastIndex; |
| 1543 | 1547 | const NormalIndex& index2 = lastLineIndices.at(x - 1); |
| 1544 | 1548 | const NormalIndex& index3 = lastLineIndices.at(x); |
| 1549 | + | |
| 1550 | + const glm::vec3& first = vertices.at(index.indices[0]).vertex; | |
| 1551 | + glm::vec3 normal = glm::cross(vertices.at(index1.indices[0]).vertex - first, | |
| 1552 | + vertices.at(index3.indices[0]).vertex - first); | |
| 1553 | + | |
| 1545 | 1554 | if (alpha0 == 0) { // quad faces negative z |
| 1546 | 1555 | indices.append(index3.getClosestIndex(normal = -normal, vertices)); |
| 1547 | 1556 | indices.append(index2.getClosestIndex(normal, vertices)); |