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

public final class MeshVoxelizer extends Object
  • Constructor Details

    • MeshVoxelizer

      private MeshVoxelizer()
  • Method Details

    • voxelize

      @Nonnull public static MeshVoxelizer.VoxelResult voxelize(@Nonnull ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid)
    • voxelize

      @Nonnull public static MeshVoxelizer.VoxelResult voxelize(@Nonnull ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid, @Nullable Map<String,Integer> materialToBlockId)
    • voxelize

      @Nonnull public static MeshVoxelizer.VoxelResult voxelize(@Nonnull ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid, @Nullable Map<String,Integer> materialToBlockId, int defaultBlockId)
    • 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)
    • 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)
    • resolveIndex

      private static int resolveIndex(int index, int count)
    • rasterizeSurface

      private static void rasterizeSurface(boolean[][][] voxels, @Nullable int[][][] blockIds, float[][] vertices, ObjParser.ObjMesh mesh, @Nullable Map<String,BufferedImage> materialTextures, @Nullable Map<String,Integer> materialToBlockId, @Nullable BlockColorIndex colorIndex, int defaultBlockId, int sizeX, int sizeY, int sizeZ)
    • rasterizeLine

      private static void rasterizeLine(boolean[][][] voxels, @Nullable int[][][] blockIds, float[] a, float[] b, @Nullable float[] uvA, @Nullable float[] uvB, @Nullable BufferedImage texture, @Nullable BlockColorIndex colorIndex, int fallbackBlockId, int sizeX, int sizeY, int sizeZ)
    • interpolateUv

      @Nullable private static float[] interpolateUv(@Nullable float[] uvA, @Nullable float[] uvB, float t)
    • sampleBlockId

      private static int sampleBlockId(@Nullable float[] uv, @Nullable BufferedImage texture, @Nullable BlockColorIndex colorIndex, int fallbackBlockId)
    • setVoxel

      private static void setVoxel(boolean[][][] voxels, @Nullable int[][][] blockIds, int x, int y, int z, int blockId, int sizeX, int sizeY, int sizeZ)
    • rasterizeTriangle

      private static void rasterizeTriangle(boolean[][][] voxels, @Nullable int[][][] blockIds, float[] v0, float[] v1, float[] v2, @Nullable float[] uv0, @Nullable float[] uv1, @Nullable float[] uv2, @Nullable BufferedImage texture, @Nullable BlockColorIndex colorIndex, int fallbackBlockId, int sizeX, int sizeY, int sizeZ)
    • barycentric

      @Nullable private static float[] barycentric(float px, float py, float pz, float[] v0, float[] v1, float[] v2)
    • pointNearTriangle

      private static boolean pointNearTriangle(float px, float py, float pz, float[] v0, float[] v1, float[] v2, float threshold)
    • pointInTriangleWithTolerance

      private static boolean pointInTriangleWithTolerance(float px, float py, float pz, float[] v0, float[] v1, float[] v2, float tolerance)
    • floodFillSolid

      private static boolean[][][] floodFillSolid(boolean[][][] shell, int sizeX, int sizeY, int sizeZ)
    • tryEnqueue

      private static boolean tryEnqueue(boolean[][][] shell, int sizeX, int sizeY, int sizeZ, boolean[] visited, int[] queue, int ex, int ey, int ez, int dx, int plane, int writeIndex)
    • cropToSolidBounds

      private static MeshVoxelizer.VoxelResult cropToSolidBounds(boolean[][][] voxels, @Nullable int[][][] blockIds, int sizeX, int sizeY, int sizeZ)
    • fillInteriorBlockIds

      private static void fillInteriorBlockIds(boolean[][][] solid, boolean[][][] shell, int[][][] blockIds, int defaultBlockId, int sizeX, int sizeY, int sizeZ)
    • findNearestSurfaceBlockId

      private static int findNearestSurfaceBlockId(int[][][] blockIds, boolean[][][] shell, int cx, int cy, int cz, int sizeX, int sizeY, int sizeZ)