Closed BenMcLean closed 6 months ago
You can already iterate on all voxels with voxelData.Colors. This is a dictionary with contains all filled voxels inside a frame. The key is the index of the voxel inside the 3D array and the value is the color palette index. You can write something like this (pseudo code):
foreach (var voxel in voxelData.Colors)
voxelData.Get3DPos(voxel.Key, out int x, out int y, out int z) //to get the coordinate in X, Y, Z this[x, y, z] = voxel.Value;
That works. Thanks!
Currently, I have my app using FileToVoxCore inside a constructor like this:
But those nested for loops at the end are very inefficient. It is doing an exhaustive search of the 3D space, which wastes CPU on models that are mostly empty space.
It would be better to expose an iterator which returns all the filled voxels without having to check all the empty ones. And I mean in a way that increases efficiency, not just an iterator that checks all the empty spaces behind the scenes.