mirror of
https://github.com/overte-org/overte.git
synced 2025-04-24 03:33:35 +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 voxelScale = 1 / powf(2, *currentNode->octalCode);
|
||||
|
||||
// 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];
|
||||
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++;
|
||||
}
|
||||
|
||||
verticesEndPointer++;
|
||||
voxelsAdded++;
|
||||
}
|
||||
|
||||
|
||||
delete [] startVertex;
|
||||
|
||||
voxelsAdded++;
|
||||
}
|
||||
|
||||
return voxelsAdded;
|
||||
|
|
Loading…
Reference in a new issue