VoxelVoxLoader
Utility class to load voxels from MagicaVoxel files
Utility class to load voxels from MagicaVoxel files
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
VoxelVoxLoaderConstructor
public VoxelVoxLoader();Methods1
LoadFromFileint
public static int LoadFromFile(string fpath, VoxelBuffer voxels, VoxelColorPalette palette, VoxelBuffer.ChannelId dstChannel = VoxelBuffer.ChannelId.ChannelColor);Loads voxels from the first model found in a vox file and stores it in a single VoxelBuffer. Other models that might be in the file are not loaded. Transform of the model is not considered.
Data will be stored in one channel of the provided buffer. 64-bit depth channel is not supported.
If palette is provided, it will also load the color palette from the file and voxels will be indices pointing into it. 8-bit channel depth is optimal (as MagicaVoxel voxels use 8-bit indices), but 16-bit and 32-bit are also supported.
If palette is not provided (null), the loader will attempt to store colors bit-packed directly into the voxels, according to the depth the provided buffer has (2-bit per component if 8-bit, 4-bit per component if 16-bit, 8-bit per component if 32-bit).
Returns an Error enum code to tell if loading succeeded or not.
Note: MagicaVoxel uses a different axis convention than Reckfell: X is right, Y is forwards and Z is up. Voxel coordinates will be the same when looked up in the buffer, but they mean different location in space.
| Name | Type | Default |
|---|---|---|
fpath | string | — |
voxels | VoxelBuffer | — |
palette | VoxelColorPalette | — |
dstChannel | VoxelBuffer.ChannelId | VoxelBuffer.ChannelId.ChannelColor |
int