History

only add voxel to be drawn if not transparent

Stephen Birarda committed 13 years ago

Commit 1efbaef1 parent d2da9001 file · +11 −9Browse files

Showing the changes to interface/src/VoxelSystem.cpp (1 of 1 file). Show all

Unified · Split

interface/src/VoxelSystem.cpp+11−9
@@ -82,18 +82,20 @@ int VoxelSystem::treeToArrays(VoxelNode *currentNode) { · 81 unmodified lines
8282 float * startVertex = firstVertexForCode(currentNode->octalCode);
8383 float voxelScale = 1 / powf(2, *currentNode->octalCode);
8484
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+ }
9094
91− verticesEndPointer++;
95+ voxelsAdded++;
9296 }
93−
97+
9498 delete [] startVertex;
95−
96− voxelsAdded++;
9799 }
98100
99101 return voxelsAdded;