EVERYTHING

This commit is contained in:
niko
2026-06-01 17:19:55 +02:00
parent d063b81359
commit b62bac090b
1081 changed files with 1716544 additions and 0 deletions
@@ -0,0 +1,40 @@
namespace BlockSpace.Voxels
{
public static class PackedVoxel
{
public const byte Air = 0;
public static byte Create(byte colorIndex, VoxelMaterial material)
{
colorIndex &= 0x3F;
if (material == VoxelMaterial.Invisible && colorIndex == 63)
{
colorIndex = 62;
}
return (byte)((byte)(((uint)material << 6) | colorIndex) + 1);
}
public static bool IsAir(byte voxel)
{
return voxel == 0;
}
public static byte GetColorIndex(byte voxel)
{
if (voxel != 0)
{
return (byte)((voxel - 1) & 0x3F);
}
return 0;
}
public static VoxelMaterial GetMaterial(byte voxel)
{
if (voxel != 0)
{
return (VoxelMaterial)((voxel - 1 >> 6) & 3);
}
return VoxelMaterial.Lit;
}
}
}