for (unsigned i = 0; i < octree[size-3].voxels.size(); i++) // Fisrts For
{
if (octree[size-3].voxels[i].active)
{
unsigned childPos = octree[size-3].voxels[i].pos * 8;
for (unsigned i = childPos; i < childPos + 8; i++) // Second For
{
if (octree[size-2].voxels[i].active)
{
unsigned childPos = octree[size-2].voxels[i].pos * 8;
for (unsigned i = childPos; i < childPos + 8; i++) // Third For
{
if (octree[size-1].voxels[i].active)
{
octree[size-1].voxels[i].Draw();
}
}
}
}
}
}
Note: the the second and third for loop are near identical.
However I don't want this to be limited to just three loops. I need it to be dynamic. There must be a way I can have a dynamic number of nested for loops.