Contents
Class MeshVoxelizer
java.lang.Object
com.hypixel.hytale.builtin.buildertools.objimport.MeshVoxelizer
Converts a triangle mesh to a solid voxel grid.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordResult of voxelization. -
Method Summary
Modifier and TypeMethodDescriptionstatic MeshVoxelizer.VoxelResultvoxelize(ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid) Voxelizes a mesh to fit within the specified height in blocks.static MeshVoxelizer.VoxelResultvoxelize(ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid, Map<String, BufferedImage> materialTextures, Map<String, Integer> materialToBlockId, BlockColorIndex colorIndex, int defaultBlockId) Voxelizes a mesh with full UV texture sampling support.static MeshVoxelizer.VoxelResultvoxelize(ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid, Map<String, BufferedImage> materialTextures, Map<String, Integer> materialToBlockId, BlockColorIndex colorIndex, int defaultBlockId, boolean preserveOrigin) Voxelizes a mesh with full UV texture sampling support and origin preservation option.static MeshVoxelizer.VoxelResultvoxelize(ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid, Map<String, Integer> materialToBlockId) Voxelizes a mesh to fit within the specified height in blocks, with material support.static MeshVoxelizer.VoxelResultvoxelize(ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid, Map<String, Integer> materialToBlockId, int defaultBlockId) Voxelizes a mesh to fit within the specified height in blocks, with material support.
-
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 voxelizetargetHeight- the desired height in blocksfillSolid- 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 voxelizetargetHeight- the desired height in blocksfillSolid- if true, fills interior via flood fill; if false, keeps only surface shellmaterialToBlockId- 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 voxelizetargetHeight- the desired height in blocksfillSolid- if true, fills interior via flood fill; if false, keeps only surface shellmaterialToBlockId- optional mapping of material names to block IDsdefaultBlockId- 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 voxelizetargetHeight- the desired height in blocksfillSolid- if true, fills interior via flood fill; if false, keeps only surface shellmaterialTextures- loaded textures per material namematerialToBlockId- fallback mapping of material names to block IDs (for non-textured materials)colorIndex- for mapping sampled colors to block IDsdefaultBlockId- 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 voxelizetargetHeight- the desired height in blocksfillSolid- if true, fills interior via flood fill; if false, keeps only surface shellmaterialTextures- loaded textures per material namematerialToBlockId- fallback mapping of material names to block IDs (for non-textured materials)colorIndex- for mapping sampled colors to block IDsdefaultBlockId- default block ID for faces without material assignmentspreserveOrigin- if true, keeps the OBJ origin; if false, normalizes to lower-left-front corner- Returns:
- voxel result with block IDs
-