mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 07:57:30 +02:00
only add voxel to be drawn if not transparent
This commit is contained in:
parent
d2da9000f4
commit
1efbaef44b
1 changed files with 11 additions and 9 deletions
|
@ -82,18 +82,20 @@ int VoxelSystem::treeToArrays(VoxelNode *currentNode) {
|
||||||
float * startVertex = firstVertexForCode(currentNode->octalCode);
|
float * startVertex = firstVertexForCode(currentNode->octalCode);
|
||||||
float voxelScale = 1 / powf(2, *currentNode->octalCode);
|
float voxelScale = 1 / powf(2, *currentNode->octalCode);
|
||||||
|
|
||||||
// populate the array with points for the 8 vertices
|
if (currentNode->color[3] == 1) {
|
||||||
// and RGB color for each added vertex
|
// populate the array with points for the 8 vertices
|
||||||
for (int j = 0; j < VERTEX_POINTS_PER_VOXEL; j++ ) {
|
// and RGB color for each added vertex
|
||||||
*verticesEndPointer = startVertex[j % 3] + (identityVertices[j] * voxelScale);
|
for (int j = 0; j < VERTEX_POINTS_PER_VOXEL; j++ ) {
|
||||||
*(colorsArray + (verticesEndPointer - verticesArray)) = currentNode->color[j % 3];
|
*verticesEndPointer = startVertex[j % 3] + (identityVertices[j] * voxelScale);
|
||||||
|
*(colorsArray + (verticesEndPointer - verticesArray)) = currentNode->color[j % 3];
|
||||||
|
|
||||||
|
verticesEndPointer++;
|
||||||
|
}
|
||||||
|
|
||||||
verticesEndPointer++;
|
voxelsAdded++;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] startVertex;
|
delete [] startVertex;
|
||||||
|
|
||||||
voxelsAdded++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return voxelsAdded;
|
return voxelsAdded;
|
||||||
|
|
Loading…
Reference in a new issue