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 | float * startVertex = firstVertexForCode(currentNode->octalCode); | 82 | float * startVertex = firstVertexForCode(currentNode->octalCode); |
| 83 | float voxelScale = 1 / powf(2, *currentNode->octalCode); | 83 | float voxelScale = 1 / powf(2, *currentNode->octalCode); |
| 84 | 84 | ||
| 85 | // populate the array with points for the 8 vertices | 85 | if (currentNode->color[3] == 1) { |
| 86 | // and RGB color for each added vertex | 86 | // populate the array with points for the 8 vertices |
| 87 | for (int j = 0; j < VERTEX_POINTS_PER_VOXEL; j++ ) { | 87 | // and RGB color for each added vertex |
| 88 | *verticesEndPointer = startVertex[j % 3] + (identityVertices[j] * voxelScale); | 88 | for (int j = 0; j < VERTEX_POINTS_PER_VOXEL; j++ ) { |
| 89 | *(colorsArray + (verticesEndPointer - verticesArray)) = currentNode->color[j % 3]; | 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 | delete [] startVertex; | 98 | delete [] startVertex; |
| 95 | |||
| 96 | voxelsAdded++; | ||
| 97 | } | 99 | } |
| 98 | 100 | ||
| 99 | return voxelsAdded; | 101 | return voxelsAdded; |