Class MeshVoxelizer
java.lang.Object
com.hypixel.hytale.builtin.buildertools.objimport.MeshVoxelizer
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static float[]barycentric(float px, float py, float pz, float[] v0, float[] v1, float[] v2) private static MeshVoxelizer.VoxelResultcropToSolidBounds(boolean[][][] voxels, int[][][] blockIds, int sizeX, int sizeY, int sizeZ) private static voidfillInteriorBlockIds(boolean[][][] solid, boolean[][][] shell, int[][][] blockIds, int defaultBlockId, int sizeX, int sizeY, int sizeZ) private static intfindNearestSurfaceBlockId(int[][][] blockIds, boolean[][][] shell, int cx, int cy, int cz, int sizeX, int sizeY, int sizeZ) private static boolean[][][]floodFillSolid(boolean[][][] shell, int sizeX, int sizeY, int sizeZ) private static float[]interpolateUv(float[] uvA, float[] uvB, float t) private static booleanpointInTriangleWithTolerance(float px, float py, float pz, float[] v0, float[] v1, float[] v2, float tolerance) private static booleanpointNearTriangle(float px, float py, float pz, float[] v0, float[] v1, float[] v2, float threshold) private static voidrasterizeLine(boolean[][][] voxels, int[][][] blockIds, float[] a, float[] b, float[] uvA, float[] uvB, BufferedImage texture, BlockColorIndex colorIndex, int fallbackBlockId, int sizeX, int sizeY, int sizeZ) private static voidrasterizeSurface(boolean[][][] voxels, int[][][] blockIds, float[][] vertices, ObjParser.ObjMesh mesh, Map<String, BufferedImage> materialTextures, Map<String, Integer> materialToBlockId, BlockColorIndex colorIndex, int defaultBlockId, int sizeX, int sizeY, int sizeZ) private static voidrasterizeTriangle(boolean[][][] voxels, int[][][] blockIds, float[] v0, float[] v1, float[] v2, float[] uv0, float[] uv1, float[] uv2, BufferedImage texture, BlockColorIndex colorIndex, int fallbackBlockId, int sizeX, int sizeY, int sizeZ) private static intresolveIndex(int index, int count) private static intsampleBlockId(float[] uv, BufferedImage texture, BlockColorIndex colorIndex, int fallbackBlockId) private static voidsetVoxel(boolean[][][] voxels, int[][][] blockIds, int x, int y, int z, int blockId, int sizeX, int sizeY, int sizeZ) private static booleantryEnqueue(boolean[][][] shell, int sizeX, int sizeY, int sizeZ, boolean[] visited, int[] queue, int ex, int ey, int ez, int dx, int plane, int writeIndex) static MeshVoxelizer.VoxelResultvoxelize(ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid) static MeshVoxelizer.VoxelResultvoxelize(ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid, Map<String, BufferedImage> materialTextures, Map<String, Integer> materialToBlockId, BlockColorIndex colorIndex, int defaultBlockId) static MeshVoxelizer.VoxelResultvoxelize(ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid, Map<String, BufferedImage> materialTextures, Map<String, Integer> materialToBlockId, BlockColorIndex colorIndex, int defaultBlockId, boolean preserveOrigin) static MeshVoxelizer.VoxelResultvoxelize(ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid, Map<String, Integer> materialToBlockId) static MeshVoxelizer.VoxelResultvoxelize(ObjParser.ObjMesh mesh, int targetHeight, boolean fillSolid, Map<String, Integer> materialToBlockId, int defaultBlockId)
-
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)
-