mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 16:55:07 +02:00
fix conditional inclusion of voxel in vertices and color arrays
This commit is contained in:
parent
f8485ab5da
commit
f97932353b
1 changed files with 9 additions and 11 deletions
|
@ -78,22 +78,20 @@ int VoxelSystem::treeToArrays(VoxelNode *currentNode) {
|
|||
|
||||
// if we didn't get any voxels added then we're a leaf
|
||||
// add our vertex and color information to the interleaved array
|
||||
if (voxelsAdded == 0) {
|
||||
if (voxelsAdded == 0 && currentNode->color[3] == 1) {
|
||||
float * startVertex = firstVertexForCode(currentNode->octalCode);
|
||||
float voxelScale = 1 / powf(2, *currentNode->octalCode);
|
||||
|
||||
if (currentNode->color[3] == 1) {
|
||||
// populate the array with points for the 8 vertices
|
||||
// and RGB color for each added vertex
|
||||
for (int j = 0; j < VERTEX_POINTS_PER_VOXEL; j++ ) {
|
||||
*verticesEndPointer = startVertex[j % 3] + (identityVertices[j] * voxelScale);
|
||||
*(colorsArray + (verticesEndPointer - verticesArray)) = currentNode->color[j % 3];
|
||||
|
||||
verticesEndPointer++;
|
||||
}
|
||||
// populate the array with points for the 8 vertices
|
||||
// and RGB color for each added vertex
|
||||
for (int j = 0; j < VERTEX_POINTS_PER_VOXEL; j++ ) {
|
||||
*verticesEndPointer = startVertex[j % 3] + (identityVertices[j] * voxelScale);
|
||||
*(colorsArray + (verticesEndPointer - verticesArray)) = currentNode->color[j % 3];
|
||||
|
||||
voxelsAdded++;
|
||||
verticesEndPointer++;
|
||||
}
|
||||
|
||||
voxelsAdded++;
|
||||
|
||||
delete [] startVertex;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue