Showing the changes to interface/src/VoxelSystem.cpp (1 of 1 file). Show all
Unified · Split
| @@ -82,18 +82,20 @@ int VoxelSystem::treeToArrays(VoxelNode *currentNode) { · 81 unmodified lines | ||
| 82 | 82 | float * startVertex = firstVertexForCode(currentNode->octalCode); |
| 83 | 83 | float voxelScale = 1 / powf(2, *currentNode->octalCode); |
| 84 | 84 | |
| 85 | − // populate the array with points for the 8 vertices | |
| 86 | − // and RGB color for each added vertex | |
| 87 | − for (int j = 0; j < VERTEX_POINTS_PER_VOXEL; j++ ) { | |
| 88 | − *verticesEndPointer = startVertex[j % 3] + (identityVertices[j] * voxelScale); | |
| 89 | − *(colorsArray + (verticesEndPointer - verticesArray)) = currentNode->color[j % 3]; | |
| 85 | + if (currentNode->color[3] == 1) { | |
| 86 | + // populate the array with points for the 8 vertices | |
| 87 | + // and RGB color for each added vertex | |
| 88 | + for (int j = 0; j < VERTEX_POINTS_PER_VOXEL; j++ ) { | |
| 89 | + *verticesEndPointer = startVertex[j % 3] + (identityVertices[j] * voxelScale); | |
| 90 | + *(colorsArray + (verticesEndPointer - verticesArray)) = currentNode->color[j % 3]; | |
| 91 | + | |
| 92 | + verticesEndPointer++; | |
| 93 | + } | |
| 90 | 94 | |
| 91 | − verticesEndPointer++; | |
| 95 | + voxelsAdded++; | |
| 92 | 96 | } |
| 93 | − | |
| 97 | + | |
| 94 | 98 | delete [] startVertex; |
| 95 | − | |
| 96 | − voxelsAdded++; | |
| 97 | 99 | } |
| 98 | 100 | |
| 99 | 101 | return voxelsAdded; |