Class MeshVoxelizer

java.lang.Object
com.hypixel.hytale.builtin.buildertools.objimport.MeshVoxelizer

public final class MeshVoxelizer extends Object
Converts a triangle mesh to a solid voxel grid.
  • Method Details

    • voxelize

      @Nonnull public static MeshVoxelizer.VoxelResult voxelize(@Nonnull ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid)
      Voxelizes a mesh to fit within the specified height in blocks.
      Parameters:
      mesh - the mesh to voxelize
      targetHeight - the desired height in blocks
      fillSolid - if true, fills interior via flood fill; if false, keeps only surface shell
      Returns:
      a 3D boolean array where true = solid voxel
    • voxelize

      @Nonnull public static MeshVoxelizer.VoxelResult voxelize(@Nonnull ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid, @Nullable Map<String,Integer> materialToBlockId)
      Voxelizes a mesh to fit within the specified height in blocks, with material support.
      Parameters:
      mesh - the mesh to voxelize
      targetHeight - the desired height in blocks
      fillSolid - if true, fills interior via flood fill; if false, keeps only surface shell
      materialToBlockId - optional mapping of material names to block IDs
      Returns:
      voxel result with block IDs if materials provided, otherwise just solid/empty
    • voxelize

      @Nonnull public static MeshVoxelizer.VoxelResult voxelize(@Nonnull ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid, @Nullable Map<String,Integer> materialToBlockId, int defaultBlockId)
      Voxelizes a mesh to fit within the specified height in blocks, with material support.
      Parameters:
      mesh - the mesh to voxelize
      targetHeight - the desired height in blocks
      fillSolid - if true, fills interior via flood fill; if false, keeps only surface shell
      materialToBlockId - optional mapping of material names to block IDs
      defaultBlockId - default block ID for faces without material assignments
      Returns:
      voxel result with block IDs if materials provided, otherwise just solid/empty
    • voxelize

      @Nonnull public static MeshVoxelizer.VoxelResult voxelize(@Nonnull ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid, @Nullable Map<String, BufferedImage> materialTextures, @Nullable Map<String,Integer> materialToBlockId, @Nullable BlockColorIndex colorIndex, int defaultBlockId)
      Voxelizes a mesh with full UV texture sampling support.
      Parameters:
      mesh - the mesh to voxelize
      targetHeight - the desired height in blocks
      fillSolid - if true, fills interior via flood fill; if false, keeps only surface shell
      materialTextures - loaded textures per material name
      materialToBlockId - fallback mapping of material names to block IDs (for non-textured materials)
      colorIndex - for mapping sampled colors to block IDs
      defaultBlockId - default block ID for faces without material assignments
      Returns:
      voxel result with block IDs
    • voxelize

      @Nonnull public static MeshVoxelizer.VoxelResult voxelize(@Nonnull ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid, @Nullable Map<String, BufferedImage> materialTextures, @Nullable Map<String,Integer> materialToBlockId, @Nullable BlockColorIndex colorIndex, int defaultBlockId, boolean preserveOrigin)
      Voxelizes a mesh with full UV texture sampling support and origin preservation option.
      Parameters:
      mesh - the mesh to voxelize
      targetHeight - the desired height in blocks
      fillSolid - if true, fills interior via flood fill; if false, keeps only surface shell
      materialTextures - loaded textures per material name
      materialToBlockId - fallback mapping of material names to block IDs (for non-textured materials)
      colorIndex - for mapping sampled colors to block IDs
      defaultBlockId - default block ID for faces without material assignments
      preserveOrigin - if true, keeps the OBJ origin; if false, normalizes to lower-left-front corner
      Returns:
      voxel result with block IDs