Showing the changes to interface/src/VoxelSystem.cpp (1 of 1 file). Show all
Unified · Split
| @@ -78,22 +78,20 @@ int VoxelSystem::treeToArrays(VoxelNode *currentNode) { · 77 unmodified lines | |||
| 78 | 78 | ||
| 79 | // if we didn't get any voxels added then we're a leaf | 79 | // if we didn't get any voxels added then we're a leaf |
| 80 | // add our vertex and color information to the interleaved array | 80 | // add our vertex and color information to the interleaved array |
| 81 | if (voxelsAdded == 0) { | 81 | if (voxelsAdded == 0 && currentNode->color[3] == 1) { |
| 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 | if (currentNode->color[3] == 1) { | 85 | // populate the array with points for the 8 vertices |
| 86 | // populate the array with points for the 8 vertices | 86 | // and RGB color for each added vertex |
| 87 | // and RGB color for each added vertex | 87 | for (int j = 0; j < VERTEX_POINTS_PER_VOXEL; j++ ) { |
| 88 | for (int j = 0; j < VERTEX_POINTS_PER_VOXEL; j++ ) { | 88 | *verticesEndPointer = startVertex[j % 3] + (identityVertices[j] * voxelScale); |
| 89 | *verticesEndPointer = startVertex[j % 3] + (identityVertices[j] * voxelScale); | 89 | *(colorsArray + (verticesEndPointer - verticesArray)) = currentNode->color[j % 3]; |
| 90 | *(colorsArray + (verticesEndPointer - verticesArray)) = currentNode->color[j % 3]; | ||
| 91 | |||
| 92 | verticesEndPointer++; | ||
| 93 | } | ||
| 94 | 90 | ||
| 95 | voxelsAdded++; | 91 | verticesEndPointer++; |
| 96 | } | 92 | } |
| 93 | |||
| 94 | voxelsAdded++; | ||
| 97 | 95 | ||
| 98 | delete [] startVertex; | 96 | delete [] startVertex; |
| 99 | } | 97 | } |