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 | quadIndices.insert(qRgb(x, y - 1, z - 1), indices.size()); | 1491 | quadIndices.insert(qRgb(x, y - 1, z - 1), indices.size()); |
| 1492 | quadIndices.insert(qRgb(x, y, z - 1), indices.size()); | 1492 | quadIndices.insert(qRgb(x, y, z - 1), indices.size()); |
| 1493 | 1493 | ||
| 1494 | glm::vec3 normal(1.0f, 0.0f, 0.0f); | ||
| 1495 | |||
| 1496 | const NormalIndex& index1 = lastLineIndices.at(x); | 1494 | const NormalIndex& index1 = lastLineIndices.at(x); |
| 1497 | const NormalIndex& index2 = lastPlaneIndices.at((y - 1) * expanded + x); | 1495 | const NormalIndex& index2 = lastPlaneIndices.at((y - 1) * expanded + x); |
| 1498 | const NormalIndex& index3 = lastPlaneIndices.at(y * expanded + x); | 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 | if (alpha0 == 0) { // quad faces negative x | 1502 | if (alpha0 == 0) { // quad faces negative x |
| 1500 | indices.append(index3.getClosestIndex(normal = -normal, vertices)); | 1503 | indices.append(index3.getClosestIndex(normal = -normal, vertices)); |
| 1501 | indices.append(index2.getClosestIndex(normal, vertices)); | 1504 | indices.append(index2.getClosestIndex(normal, vertices)); |
| @@ -1514,11 +1517,14 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) { · 12 unmodified lines | |||
| 1514 | quadIndices.insert(qRgb(x - 1, y, z - 1), indices.size()); | 1517 | quadIndices.insert(qRgb(x - 1, y, z - 1), indices.size()); |
| 1515 | quadIndices.insert(qRgb(x, y, z - 1), indices.size()); | 1518 | quadIndices.insert(qRgb(x, y, z - 1), indices.size()); |
| 1516 | 1519 | ||
| 1517 | glm::vec3 normal(0.0f, 1.0f, 0.0f); | ||
| 1518 | |||
| 1519 | const NormalIndex& index1 = lastIndex; | 1520 | const NormalIndex& index1 = lastIndex; |
| 1520 | const NormalIndex& index2 = lastPlaneIndices.at(y * expanded + x - 1); | 1521 | const NormalIndex& index2 = lastPlaneIndices.at(y * expanded + x - 1); |
| 1521 | const NormalIndex& index3 = lastPlaneIndices.at(y * expanded + x); | 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 | if (alpha0 == 0) { // quad faces negative y | 1528 | if (alpha0 == 0) { // quad faces negative y |
| 1523 | indices.append(index1.getClosestIndex(normal = -normal, vertices)); | 1529 | indices.append(index1.getClosestIndex(normal = -normal, vertices)); |
| 1524 | indices.append(index2.getClosestIndex(normal, vertices)); | 1530 | indices.append(index2.getClosestIndex(normal, vertices)); |
| @@ -1537,11 +1543,14 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) { · 12 unmodified lines | |||
| 1537 | quadIndices.insert(qRgb(x - 1, y - 1, z), indices.size()); | 1543 | quadIndices.insert(qRgb(x - 1, y - 1, z), indices.size()); |
| 1538 | quadIndices.insert(qRgb(x, y - 1, z), indices.size()); | 1544 | quadIndices.insert(qRgb(x, y - 1, z), indices.size()); |
| 1539 | 1545 | ||
| 1540 | glm::vec3 normal(0.0f, 0.0f, 1.0f); | ||
| 1541 | |||
| 1542 | const NormalIndex& index1 = lastIndex; | 1546 | const NormalIndex& index1 = lastIndex; |
| 1543 | const NormalIndex& index2 = lastLineIndices.at(x - 1); | 1547 | const NormalIndex& index2 = lastLineIndices.at(x - 1); |
| 1544 | const NormalIndex& index3 = lastLineIndices.at(x); | 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 | if (alpha0 == 0) { // quad faces negative z | 1554 | if (alpha0 == 0) { // quad faces negative z |
| 1546 | indices.append(index3.getClosestIndex(normal = -normal, vertices)); | 1555 | indices.append(index3.getClosestIndex(normal = -normal, vertices)); |
| 1547 | indices.append(index2.getClosestIndex(normal, vertices)); | 1556 | indices.append(index2.getClosestIndex(normal, vertices)); |