diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/BufferQuad.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/BufferQuad.java index 23393fb4b..7c96ef1ea 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/BufferQuad.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/BufferQuad.java @@ -20,8 +20,8 @@ package com.seibel.distanthorizons.core.dataObjects.render.bufferBuilding; import com.seibel.distanthorizons.core.config.Config; +import com.seibel.distanthorizons.core.enums.EDhDirection; import com.seibel.distanthorizons.core.util.LodUtil; -import com.seibel.distanthorizons.core.enums.ELodDirection; /** Represents a render-able quad. */ public final class BufferQuad @@ -56,7 +56,7 @@ public final class BufferQuad public final byte skyLight; public final byte blockLight; - public final ELodDirection direction; + public final EDhDirection direction; public boolean hasError = false; @@ -64,7 +64,7 @@ public final class BufferQuad BufferQuad(short x, short y, short z, short widthEastWest, short widthNorthSouthOrUpDown, int color, byte skylight, byte blockLight, - ELodDirection direction) + EDhDirection direction) { if (widthEastWest == 0 || widthNorthSouthOrUpDown == 0) throw new IllegalArgumentException("Size 0 quad!"); diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnBox.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnBox.java index 9fb300909..17ce6c588 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnBox.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnBox.java @@ -20,12 +20,12 @@ package com.seibel.distanthorizons.core.dataObjects.render.bufferBuilding; import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; +import com.seibel.distanthorizons.core.enums.EDhDirection; import com.seibel.distanthorizons.core.util.ColorUtil; import com.seibel.distanthorizons.core.util.RenderDataPointUtil; import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; import com.seibel.distanthorizons.core.dataObjects.render.columnViews.ColumnArrayView; import com.seibel.distanthorizons.core.render.renderer.LodRenderer; -import com.seibel.distanthorizons.core.enums.ELodDirection; import com.seibel.distanthorizons.coreapi.util.MathUtil; public class ColumnBox @@ -100,13 +100,13 @@ public class ColumnBox boolean skipTop = RenderDataPointUtil.doesDataPointExist(topData) && (RenderDataPointUtil.getYMin(topData) == maxY) && !isTopTransparent; if (!skipTop) { - builder.addQuadUp(x, maxY, z, xSize, zSize, ColorUtil.applyShade(color, MC.getShade(ELodDirection.UP)), skyLightTop, blockLight); + builder.addQuadUp(x, maxY, z, xSize, zSize, ColorUtil.applyShade(color, MC.getShade(EDhDirection.UP)), skyLightTop, blockLight); } boolean skipBottom = RenderDataPointUtil.doesDataPointExist(bottomData) && (RenderDataPointUtil.getYMax(bottomData) == minY) && !isBottomTransparent; if (!skipBottom) { - builder.addQuadDown(x, minY, z, xSize, zSize, ColorUtil.applyShade(color, MC.getShade(ELodDirection.DOWN)), skyLightBot, blockLight); + builder.addQuadDown(x, minY, z, xSize, zSize, ColorUtil.applyShade(color, MC.getShade(EDhDirection.DOWN)), skyLightBot, blockLight); } @@ -115,28 +115,28 @@ public class ColumnBox // TODO merge duplicate code //NORTH face vertex creation { - ColumnArrayView[] adjDataNorth = adjData[ELodDirection.NORTH.ordinal() - 2]; // TODO can we use something other than ordinal-2? + ColumnArrayView[] adjDataNorth = adjData[EDhDirection.NORTH.ordinal() - 2]; // TODO can we use something other than ordinal-2? int adjOverlapNorth = ColorUtil.INVISIBLE; if (adjDataNorth == null) { // add an adjacent face if this is opaque face or transparent over the void if (!isTransparent || overVoid) { - builder.addQuadAdj(ELodDirection.NORTH, x, minY, z, xSize, ySize, color, (byte) 15, blockLight); + builder.addQuadAdj(EDhDirection.NORTH, x, minY, z, xSize, ySize, color, (byte) 15, blockLight); } } else if (adjDataNorth.length == 1) { - makeAdjVerticalQuad(builder, adjDataNorth[0], ELodDirection.NORTH, x, minY, z, xSize, ySize, + makeAdjVerticalQuad(builder, adjDataNorth[0], EDhDirection.NORTH, x, minY, z, xSize, ySize, color, adjOverlapNorth, skyLightTop, blockLight, topData, bottomData); } else { - makeAdjVerticalQuad(builder, adjDataNorth[0], ELodDirection.NORTH, x, minY, z, (short) (xSize / 2), ySize, + makeAdjVerticalQuad(builder, adjDataNorth[0], EDhDirection.NORTH, x, minY, z, (short) (xSize / 2), ySize, color, adjOverlapNorth, skyLightTop, blockLight, topData, bottomData); - makeAdjVerticalQuad(builder, adjDataNorth[1], ELodDirection.NORTH, (short) (x + xSize / 2), minY, z, (short) (xSize / 2), ySize, + makeAdjVerticalQuad(builder, adjDataNorth[1], EDhDirection.NORTH, (short) (x + xSize / 2), minY, z, (short) (xSize / 2), ySize, color, adjOverlapNorth, skyLightTop, blockLight, topData, bottomData); } @@ -144,26 +144,26 @@ public class ColumnBox //SOUTH face vertex creation { - ColumnArrayView[] adjDataSouth = adjData[ELodDirection.SOUTH.ordinal() - 2]; + ColumnArrayView[] adjDataSouth = adjData[EDhDirection.SOUTH.ordinal() - 2]; int adjOverlapSouth = ColorUtil.INVISIBLE; if (adjDataSouth == null) { if (!isTransparent || overVoid) - builder.addQuadAdj(ELodDirection.SOUTH, x, minY, maxZ, xSize, ySize, color, (byte) 15, blockLight); + builder.addQuadAdj(EDhDirection.SOUTH, x, minY, maxZ, xSize, ySize, color, (byte) 15, blockLight); } else if (adjDataSouth.length == 1) { - makeAdjVerticalQuad(builder, adjDataSouth[0], ELodDirection.SOUTH, x, minY, maxZ, xSize, ySize, + makeAdjVerticalQuad(builder, adjDataSouth[0], EDhDirection.SOUTH, x, minY, maxZ, xSize, ySize, color, adjOverlapSouth, skyLightTop, blockLight, topData, bottomData); } else { - makeAdjVerticalQuad(builder, adjDataSouth[0], ELodDirection.SOUTH, x, minY, maxZ, (short) (xSize / 2), ySize, + makeAdjVerticalQuad(builder, adjDataSouth[0], EDhDirection.SOUTH, x, minY, maxZ, (short) (xSize / 2), ySize, color, adjOverlapSouth, skyLightTop, blockLight, topData, bottomData); - makeAdjVerticalQuad(builder, adjDataSouth[1], ELodDirection.SOUTH, (short) (x + xSize / 2), minY, maxZ, (short) (xSize / 2), ySize, + makeAdjVerticalQuad(builder, adjDataSouth[1], EDhDirection.SOUTH, (short) (x + xSize / 2), minY, maxZ, (short) (xSize / 2), ySize, color, adjOverlapSouth, skyLightTop, blockLight, topData, bottomData); } @@ -171,25 +171,25 @@ public class ColumnBox //WEST face vertex creation { - ColumnArrayView[] adjDataWest = adjData[ELodDirection.WEST.ordinal() - 2]; + ColumnArrayView[] adjDataWest = adjData[EDhDirection.WEST.ordinal() - 2]; int adjOverlapWest = ColorUtil.INVISIBLE; if (adjDataWest == null) { if (!isTransparent || overVoid) - builder.addQuadAdj(ELodDirection.WEST, x, minY, z, zSize, ySize, color, (byte) 15, blockLight); + builder.addQuadAdj(EDhDirection.WEST, x, minY, z, zSize, ySize, color, (byte) 15, blockLight); } else if (adjDataWest.length == 1) { - makeAdjVerticalQuad(builder, adjDataWest[0], ELodDirection.WEST, x, minY, z, zSize, ySize, + makeAdjVerticalQuad(builder, adjDataWest[0], EDhDirection.WEST, x, minY, z, zSize, ySize, color, adjOverlapWest, skyLightTop, blockLight, topData, bottomData); } else { - makeAdjVerticalQuad(builder, adjDataWest[0], ELodDirection.WEST, x, minY, z, (short) (zSize / 2), ySize, + makeAdjVerticalQuad(builder, adjDataWest[0], EDhDirection.WEST, x, minY, z, (short) (zSize / 2), ySize, color, adjOverlapWest, skyLightTop, blockLight, topData, bottomData); - makeAdjVerticalQuad(builder, adjDataWest[1], ELodDirection.WEST, x, minY, (short) (z + zSize / 2), (short) (zSize / 2), ySize, + makeAdjVerticalQuad(builder, adjDataWest[1], EDhDirection.WEST, x, minY, (short) (z + zSize / 2), (short) (zSize / 2), ySize, color, adjOverlapWest, skyLightTop, blockLight, topData, bottomData); } @@ -197,25 +197,25 @@ public class ColumnBox //EAST face vertex creation { - ColumnArrayView[] adjDataEast = adjData[ELodDirection.EAST.ordinal() - 2]; + ColumnArrayView[] adjDataEast = adjData[EDhDirection.EAST.ordinal() - 2]; int adjOverlapEast = ColorUtil.INVISIBLE; - if (adjData[ELodDirection.EAST.ordinal() - 2] == null) + if (adjData[EDhDirection.EAST.ordinal() - 2] == null) { if (!isTransparent || overVoid) - builder.addQuadAdj(ELodDirection.EAST, maxX, minY, z, zSize, ySize, color, (byte) 15, blockLight); + builder.addQuadAdj(EDhDirection.EAST, maxX, minY, z, zSize, ySize, color, (byte) 15, blockLight); } else if (adjDataEast.length == 1) { - makeAdjVerticalQuad(builder, adjDataEast[0], ELodDirection.EAST, maxX, minY, z, zSize, ySize, + makeAdjVerticalQuad(builder, adjDataEast[0], EDhDirection.EAST, maxX, minY, z, zSize, ySize, color, adjOverlapEast, skyLightTop, blockLight, topData, bottomData); } else { - makeAdjVerticalQuad(builder, adjDataEast[0], ELodDirection.EAST, maxX, minY, z, (short) (zSize / 2), ySize, + makeAdjVerticalQuad(builder, adjDataEast[0], EDhDirection.EAST, maxX, minY, z, (short) (zSize / 2), ySize, color, adjOverlapEast, skyLightTop, blockLight, topData, bottomData); - makeAdjVerticalQuad(builder, adjDataEast[1], ELodDirection.EAST, maxX, minY, (short) (z + zSize / 2), (short) (zSize / 2), ySize, + makeAdjVerticalQuad(builder, adjDataEast[1], EDhDirection.EAST, maxX, minY, (short) (z + zSize / 2), (short) (zSize / 2), ySize, color, adjOverlapEast, skyLightTop, blockLight, topData, bottomData); } @@ -224,7 +224,7 @@ public class ColumnBox // the overlap color can be used to see faces that shouldn't be rendered private static void makeAdjVerticalQuad( - LodQuadBuilder builder, ColumnArrayView adjColumnView, ELodDirection direction, + LodQuadBuilder builder, ColumnArrayView adjColumnView, EDhDirection direction, short x, short yMin, short z, short horizontalWidth, short ySize, int color, int debugOverlapColor, byte skyLightTop, byte blockLight, long topData, long bottomData) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java index d90cbec5e..bf3652f13 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java @@ -2,6 +2,7 @@ package com.seibel.distanthorizons.core.dataObjects.render.bufferBuilding; import com.seibel.distanthorizons.api.enums.config.EGpuUploadMethod; import com.seibel.distanthorizons.api.enums.rendering.EDebugRendering; +import com.seibel.distanthorizons.core.enums.EDhDirection; import com.seibel.distanthorizons.core.enums.EGLProxyContext; import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.config.listeners.ConfigChangeListener; @@ -18,7 +19,6 @@ import com.seibel.distanthorizons.core.util.ThreadUtil; import com.seibel.distanthorizons.core.util.objects.Reference; import com.seibel.distanthorizons.core.util.objects.UncheckedInterruptedException; import com.seibel.distanthorizons.core.dataObjects.render.columnViews.ColumnArrayView; -import com.seibel.distanthorizons.core.enums.ELodDirection; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -215,7 +215,7 @@ public class ColumnRenderBufferBuilder // We avoid cases where the adjPosition is in player chunk while the position is // not // to always have a wall underwater - for (ELodDirection lodDirection : ELodDirection.ADJ_DIRECTIONS) + for (EDhDirection lodDirection : EDhDirection.ADJ_DIRECTIONS) { try { @@ -280,8 +280,8 @@ public class ColumnRenderBufferBuilder adjColumnViews[lodDirection.ordinal() - 2] = new ColumnArrayView[2]; adjColumnViews[lodDirection.ordinal() - 2][0] = adjRenderSource.getVerticalDataPointView(xAdj, zAdj); adjColumnViews[lodDirection.ordinal() - 2][1] = adjRenderSource.getVerticalDataPointView( - xAdj + (lodDirection.getAxis() == ELodDirection.Axis.X ? 0 : 1), - zAdj + (lodDirection.getAxis() == ELodDirection.Axis.Z ? 0 : 1)); + xAdj + (lodDirection.getAxis() == EDhDirection.Axis.X ? 0 : 1), + zAdj + (lodDirection.getAxis() == EDhDirection.Axis.Z ? 0 : 1)); } } catch (RuntimeException e) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/LodQuadBuilder.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/LodQuadBuilder.java index 90027c8a7..2b23b4a62 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/LodQuadBuilder.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/LodQuadBuilder.java @@ -23,7 +23,7 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.*; -import com.seibel.distanthorizons.core.enums.ELodDirection; +import com.seibel.distanthorizons.core.enums.EDhDirection; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.pos.Pos2D; import com.seibel.distanthorizons.core.render.AbstractRenderBuffer; @@ -136,11 +136,11 @@ public class LodQuadBuilder // add quads // //===========// - public void addQuadAdj(ELodDirection dir, short x, short y, short z, + public void addQuadAdj(EDhDirection dir, short x, short y, short z, short widthEastWest, short widthNorthSouthOrUpDown, int color, byte skyLight, byte blockLight) { - if (dir == ELodDirection.DOWN) + if (dir == EDhDirection.DOWN) { throw new IllegalArgumentException("addQuadAdj() is only for adj direction! Not UP or Down!"); } @@ -174,9 +174,9 @@ public class LodQuadBuilder return; } - BufferQuad quad = new BufferQuad(x, y, z, widthEastWest, widthNorthSouthOrUpDown, color, skylight, blocklight, ELodDirection.UP); + BufferQuad quad = new BufferQuad(x, y, z, widthEastWest, widthNorthSouthOrUpDown, color, skylight, blocklight, EDhDirection.UP); boolean isTransparent = (this.doTransparency && ColorUtil.getAlpha(color) < 255); - ArrayList quadList = isTransparent ? this.transparentQuads[ELodDirection.UP.ordinal()] : this.opaqueQuads[ELodDirection.UP.ordinal()]; + ArrayList quadList = isTransparent ? this.transparentQuads[EDhDirection.UP.ordinal()] : this.opaqueQuads[EDhDirection.UP.ordinal()]; // update the minimum relative height for this quad's positions @@ -214,9 +214,9 @@ public class LodQuadBuilder { if (skipQuadsWithZeroSkylight && skylight == 0 && y < skyLightCullingBelow) return; - BufferQuad quad = new BufferQuad(x, y, z, width, wz, color, skylight, blocklight, ELodDirection.DOWN); + BufferQuad quad = new BufferQuad(x, y, z, width, wz, color, skylight, blocklight, EDhDirection.DOWN); ArrayList qs = (doTransparency && ColorUtil.getAlpha(color) < 255) - ? transparentQuads[ELodDirection.DOWN.ordinal()] : opaqueQuads[ELodDirection.DOWN.ordinal()]; + ? transparentQuads[EDhDirection.DOWN.ordinal()] : opaqueQuads[EDhDirection.DOWN.ordinal()]; if (!qs.isEmpty() && (qs.get(qs.size()-1).tryMerge(quad, BufferMergeDirectionEnum.EastWest) || qs.get(qs.size()-1).tryMerge(quad, BufferMergeDirectionEnum.NorthSouthOrUpDown)) @@ -238,7 +238,7 @@ public class LodQuadBuilder int[][] quadBase = DIRECTION_VERTEX_IBO_QUAD[quad.direction.ordinal()]; short widthEastWest = quad.widthEastWest; short widthNorthSouth = quad.widthNorthSouthOrUpDown; - ELodDirection.Axis axis = quad.direction.getAxis(); + EDhDirection.Axis axis = quad.direction.getAxis(); for (int i = 0; i < quadBase.length; i++) { short dx, dy, dz; @@ -349,7 +349,7 @@ public class LodQuadBuilder // only run the second merge if the face is the top or bottom - if (directionIndex == ELodDirection.UP.ordinal() || directionIndex == ELodDirection.DOWN.ordinal()) + if (directionIndex == EDhDirection.UP.ordinal() || directionIndex == EDhDirection.DOWN.ordinal()) { mergeCount += mergeQuadsInternal(this.opaqueQuads, directionIndex, BufferMergeDirectionEnum.NorthSouthOrUpDown); if (this.doTransparency) @@ -400,7 +400,7 @@ public class LodQuadBuilder public void fixTransparencyOverVoid() { // make transparent LODs opaque if they are over the void - ListIterator iter = this.transparentQuads[ELodDirection.UP.ordinal()].listIterator(); + ListIterator iter = this.transparentQuads[EDhDirection.UP.ordinal()].listIterator(); if (iter.hasNext()) { BufferQuad currentQuad = iter.next(); @@ -422,7 +422,7 @@ public class LodQuadBuilder // move the now-opaque quad into the opaque list (if not done the quads may render on top of other transparent quads) iter.remove(); - this.opaqueQuads[ELodDirection.UP.ordinal()].add(currentQuad); + this.opaqueQuads[EDhDirection.UP.ordinal()].add(currentQuad); } currentQuad = iter.next(); diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/FullDataToRenderDataTransformer.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/FullDataToRenderDataTransformer.java index 0334f09ef..a9b0663a5 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/FullDataToRenderDataTransformer.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/FullDataToRenderDataTransformer.java @@ -397,18 +397,18 @@ public class FullDataToRenderDataTransformer // System.arraycopy(result, 0, data, dataOffset, maxVerticalData); // } // -// public static final ELodDirection[] DIRECTIONS = new ELodDirection[] { -// ELodDirection.UP, -// ELodDirection.DOWN, -// ELodDirection.WEST, -// ELodDirection.EAST, -// ELodDirection.NORTH, -// ELodDirection.SOUTH }; +// public static final EDhDirection[] DIRECTIONS = new EDhDirection[] { +// EDhDirection.UP, +// EDhDirection.DOWN, +// EDhDirection.WEST, +// EDhDirection.EAST, +// EDhDirection.NORTH, +// EDhDirection.SOUTH }; // // private boolean hasCliffFace(IChunkWrapper chunk, int x, int y, int z) { -// for (ELodDirection dir : DIRECTIONS) { +// for (EDhDirection dir : DIRECTIONS) { // IBlockDetailWrapper block = chunk.getBlockDetailAtFace(x, y, z, dir); -// if (block == null || !block.hasFaceCullingFor(ELodDirection.OPPOSITE_DIRECTIONS[dir.ordinal()])) +// if (block == null || !block.hasFaceCullingFor(EDhDirection.OPPOSITE_DIRECTIONS[dir.ordinal()])) // return true; // } // return false; diff --git a/core/src/main/java/com/seibel/distanthorizons/core/enums/ELodDirection.java b/core/src/main/java/com/seibel/distanthorizons/core/enums/EDhDirection.java similarity index 79% rename from core/src/main/java/com/seibel/distanthorizons/core/enums/ELodDirection.java rename to core/src/main/java/com/seibel/distanthorizons/core/enums/EDhDirection.java index 2c62dbd1d..6a7f920a0 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/enums/ELodDirection.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/enums/EDhDirection.java @@ -41,57 +41,57 @@ import com.seibel.distanthorizons.coreapi.util.math.Vec3i; * @author James Seibel * @version 2021-11-13 */ -public enum ELodDirection +public enum EDhDirection { - DOWN(0, 1, -1, "down", ELodDirection.AxisDirection.NEGATIVE, ELodDirection.Axis.Y, new Vec3i(0, -1, 0)), - UP(1, 0, -1, "up", ELodDirection.AxisDirection.POSITIVE, ELodDirection.Axis.Y, new Vec3i(0, 1, 0)), - NORTH(2, 3, 2, "north", ELodDirection.AxisDirection.NEGATIVE, ELodDirection.Axis.Z, new Vec3i(0, 0, -1)), - SOUTH(3, 2, 0, "south", ELodDirection.AxisDirection.POSITIVE, ELodDirection.Axis.Z, new Vec3i(0, 0, 1)), - WEST(4, 5, 1, "west", ELodDirection.AxisDirection.NEGATIVE, ELodDirection.Axis.X, new Vec3i(-1, 0, 0)), - EAST(5, 4, 3, "east", ELodDirection.AxisDirection.POSITIVE, ELodDirection.Axis.X, new Vec3i(1, 0, 0)); + DOWN(0, 1, -1, "down", EDhDirection.AxisDirection.NEGATIVE, EDhDirection.Axis.Y, new Vec3i(0, -1, 0)), + UP(1, 0, -1, "up", EDhDirection.AxisDirection.POSITIVE, EDhDirection.Axis.Y, new Vec3i(0, 1, 0)), + NORTH(2, 3, 2, "north", EDhDirection.AxisDirection.NEGATIVE, EDhDirection.Axis.Z, new Vec3i(0, 0, -1)), + SOUTH(3, 2, 0, "south", EDhDirection.AxisDirection.POSITIVE, EDhDirection.Axis.Z, new Vec3i(0, 0, 1)), + WEST(4, 5, 1, "west", EDhDirection.AxisDirection.NEGATIVE, EDhDirection.Axis.X, new Vec3i(-1, 0, 0)), + EAST(5, 4, 3, "east", EDhDirection.AxisDirection.POSITIVE, EDhDirection.Axis.X, new Vec3i(1, 0, 0)); /** * Up, Down, West, East, North, South
- * Similar to {@link ELodDirection#OPPOSITE_DIRECTIONS}, just with a different order + * Similar to {@link EDhDirection#OPPOSITE_DIRECTIONS}, just with a different order */ - public static final ELodDirection[] CARDINAL_DIRECTIONS = new ELodDirection[] { - ELodDirection.UP, - ELodDirection.DOWN, - ELodDirection.WEST, - ELodDirection.EAST, - ELodDirection.NORTH, - ELodDirection.SOUTH }; + public static final EDhDirection[] CARDINAL_DIRECTIONS = new EDhDirection[] { + EDhDirection.UP, + EDhDirection.DOWN, + EDhDirection.WEST, + EDhDirection.EAST, + EDhDirection.NORTH, + EDhDirection.SOUTH }; /** * Up, Down, South, North, East, West
- * Similar to {@link ELodDirection#CARDINAL_DIRECTIONS}, just with a different order + * Similar to {@link EDhDirection#CARDINAL_DIRECTIONS}, just with a different order */ - public static final ELodDirection[] OPPOSITE_DIRECTIONS = new ELodDirection[] { - ELodDirection.UP, - ELodDirection.DOWN, - ELodDirection.SOUTH, - ELodDirection.NORTH, - ELodDirection.EAST, - ELodDirection.WEST }; + public static final EDhDirection[] OPPOSITE_DIRECTIONS = new EDhDirection[] { + EDhDirection.UP, + EDhDirection.DOWN, + EDhDirection.SOUTH, + EDhDirection.NORTH, + EDhDirection.EAST, + EDhDirection.WEST }; /** North, South, East, West */ // TODO rename to state this is just X/Z or flat directions - public static final ELodDirection[] ADJ_DIRECTIONS = new ELodDirection[] { - ELodDirection.EAST, - ELodDirection.WEST, - ELodDirection.SOUTH, - ELodDirection.NORTH }; + public static final EDhDirection[] ADJ_DIRECTIONS = new EDhDirection[] { + EDhDirection.EAST, + EDhDirection.WEST, + EDhDirection.SOUTH, + EDhDirection.NORTH }; // private final int data3d; // private final int oppositeIndex; // private final int data2d; private final String name; - private final ELodDirection.Axis axis; - private final ELodDirection.AxisDirection axisDirection; + private final EDhDirection.Axis axis; + private final EDhDirection.AxisDirection axisDirection; private final Vec3i normal; - private static final ELodDirection[] VALUES = values(); + private static final EDhDirection[] VALUES = values(); - private static final Map BY_NAME = Arrays.stream(VALUES).collect(Collectors.toMap(ELodDirection::getName, (p_199787_0_) -> + private static final Map BY_NAME = Arrays.stream(VALUES).collect(Collectors.toMap(EDhDirection::getName, (p_199787_0_) -> { return p_199787_0_; })); @@ -128,7 +128,7 @@ public enum ELodDirection - ELodDirection(int p_i46016_3_, int p_i46016_4_, int p_i46016_5_, String p_i46016_6_, ELodDirection.AxisDirection p_i46016_7_, ELodDirection.Axis p_i46016_8_, Vec3i p_i46016_9_) + EDhDirection(int p_i46016_3_, int p_i46016_4_, int p_i46016_5_, String p_i46016_6_, EDhDirection.AxisDirection p_i46016_7_, EDhDirection.Axis p_i46016_8_, Vec3i p_i46016_9_) { // this.data3d = p_i46016_3_; // this.data2d = p_i46016_5_; @@ -229,7 +229,7 @@ public enum ELodDirection // return this.data2d; // } - public ELodDirection.AxisDirection getAxisDirection() + public EDhDirection.AxisDirection getAxisDirection() { return this.axisDirection; } @@ -239,7 +239,7 @@ public enum ELodDirection // return from3DDataValue(this.oppositeIndex); // } - public ELodDirection getClockWise() + public EDhDirection getClockWise() { switch (this) { @@ -256,7 +256,7 @@ public enum ELodDirection } } - public ELodDirection getCounterClockWise() + public EDhDirection getCounterClockWise() { switch (this) { @@ -278,12 +278,12 @@ public enum ELodDirection return this.name; } - public ELodDirection.Axis getAxis() + public EDhDirection.Axis getAxis() { return this.axis; } - public static ELodDirection byName(String name) + public static EDhDirection byName(String name) { return name == null ? null : BY_NAME.get(name.toLowerCase(Locale.ROOT)); } @@ -309,17 +309,17 @@ public enum ELodDirection // return from2DDataValue(MathHelper.floor(p_176733_0_ / 90.0D + 0.5D) & 3); // } - public static ELodDirection fromAxisAndDirection(ELodDirection.Axis p_211699_0_, ELodDirection.AxisDirection p_211699_1_) + public static EDhDirection fromAxisAndDirection(EDhDirection.Axis p_211699_0_, EDhDirection.AxisDirection p_211699_1_) { switch (p_211699_0_) { case X: - return p_211699_1_ == ELodDirection.AxisDirection.POSITIVE ? EAST : WEST; + return p_211699_1_ == EDhDirection.AxisDirection.POSITIVE ? EAST : WEST; case Y: - return p_211699_1_ == ELodDirection.AxisDirection.POSITIVE ? UP : DOWN; + return p_211699_1_ == EDhDirection.AxisDirection.POSITIVE ? UP : DOWN; case Z: default: - return p_211699_1_ == ELodDirection.AxisDirection.POSITIVE ? SOUTH : NORTH; + return p_211699_1_ == EDhDirection.AxisDirection.POSITIVE ? SOUTH : NORTH; } } @@ -356,9 +356,9 @@ public enum ELodDirection // return lodDirection; // } - public static ELodDirection get(ELodDirection.AxisDirection p_181076_0_, ELodDirection.Axis p_181076_1_) + public static EDhDirection get(EDhDirection.AxisDirection p_181076_0_, EDhDirection.Axis p_181076_1_) { - for (ELodDirection lodDirection : VALUES) + for (EDhDirection lodDirection : VALUES) { if (lodDirection.getAxisDirection() == p_181076_0_ && lodDirection.getAxis() == p_181076_1_) { @@ -382,7 +382,7 @@ public enum ELodDirection // return this.normal.getX() * f1 + this.normal.getZ() * f2 > 0.0F; // } - public enum Axis implements Predicate + public enum Axis implements Predicate { X("x") { @@ -427,9 +427,9 @@ public enum ELodDirection } }; - private static final ELodDirection.Axis[] VALUES = values(); + private static final EDhDirection.Axis[] VALUES = values(); - private static final Map BY_NAME = Arrays.stream(VALUES).collect(Collectors.toMap(ELodDirection.Axis::getName, (p_199785_0_) -> + private static final Map BY_NAME = Arrays.stream(VALUES).collect(Collectors.toMap(EDhDirection.Axis::getName, (p_199785_0_) -> { return p_199785_0_; })); @@ -440,7 +440,7 @@ public enum ELodDirection this.name = name; } - public static ELodDirection.Axis byName(String name) + public static EDhDirection.Axis byName(String name) { return BY_NAME.get(name.toLowerCase(Locale.ROOT)); } @@ -472,7 +472,7 @@ public enum ELodDirection // } @Override - public boolean test(ELodDirection p_test_1_) + public boolean test(EDhDirection p_test_1_) { return p_test_1_ != null && p_test_1_.getAxis() == this; } @@ -521,7 +521,7 @@ public enum ELodDirection return this.name; } - public ELodDirection.AxisDirection opposite() + public EDhDirection.AxisDirection opposite() { return this == POSITIVE ? NEGATIVE : POSITIVE; } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java b/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java index 6ea2d2380..8fccf1cd7 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java @@ -1,6 +1,6 @@ package com.seibel.distanthorizons.core.generation; -import com.seibel.distanthorizons.core.enums.ELodDirection; +import com.seibel.distanthorizons.core.enums.EDhDirection; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.pos.DhBlockPos; import com.seibel.distanthorizons.core.pos.DhChunkPos; @@ -100,7 +100,7 @@ public class DhLightingEngine { // get the light int maxY = chunk.getLightBlockingHeightMapValue(relX, relZ); - DhBlockPos skyLightPos = new DhBlockPos(chunk.getMinX() + relX, maxY, chunk.getMinZ() + relZ); + DhBlockPos skyLightPos = new DhBlockPos(chunk.getMinBlockX() + relX, maxY, chunk.getMinBlockZ() + relZ); skyLightPosQueue.add(new LightPos(skyLightPos, maxSkyLight)); // set the light @@ -155,7 +155,7 @@ public class DhLightingEngine int lightValue = lightPos.lightValue; // propagate the lighting in each cardinal direction, IE: -x, +x, -y, +y, -z, +z - for (ELodDirection direction : ELodDirection.CARDINAL_DIRECTIONS) + for (EDhDirection direction : EDhDirection.CARDINAL_DIRECTIONS) { DhBlockPos neighbourBlockPos = pos.offset(direction); DhChunkPos neighbourChunkPos = new DhChunkPos(neighbourBlockPos); diff --git a/core/src/main/java/com/seibel/distanthorizons/core/pos/DhBlockPos.java b/core/src/main/java/com/seibel/distanthorizons/core/pos/DhBlockPos.java index 4e9caee13..a60618e12 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/pos/DhBlockPos.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/pos/DhBlockPos.java @@ -19,7 +19,7 @@ package com.seibel.distanthorizons.core.pos; -import com.seibel.distanthorizons.core.enums.ELodDirection; +import com.seibel.distanthorizons.core.enums.EDhDirection; import com.seibel.distanthorizons.core.util.LodUtil; import java.util.Objects; @@ -113,7 +113,7 @@ public class DhBlockPos { return asLong(x, y, z); } - public DhBlockPos offset(ELodDirection direction) { return this.offset(direction.getNormal().x, direction.getNormal().y, direction.getNormal().z); } + public DhBlockPos offset(EDhDirection direction) { return this.offset(direction.getNormal().x, direction.getNormal().y, direction.getNormal().z); } public DhBlockPos offset(int x, int y, int z) { return new DhBlockPos(this.x + x, this.y + y, this.z + z); } /** Limits the block position to a value between 0 and 15 (inclusive) */ diff --git a/core/src/main/java/com/seibel/distanthorizons/core/pos/DhSectionPos.java b/core/src/main/java/com/seibel/distanthorizons/core/pos/DhSectionPos.java index ae9edde62..b0d7bfdf2 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/pos/DhSectionPos.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/pos/DhSectionPos.java @@ -1,6 +1,6 @@ package com.seibel.distanthorizons.core.pos; -import com.seibel.distanthorizons.core.enums.ELodDirection; +import com.seibel.distanthorizons.core.enums.EDhDirection; import com.seibel.distanthorizons.coreapi.util.BitShiftUtil; import com.seibel.distanthorizons.core.util.LodUtil; import org.jetbrains.annotations.Nullable; @@ -184,7 +184,7 @@ public class DhSectionPos public DhSectionPos getParentPos() { return new DhSectionPos((byte) (this.sectionDetailLevel + 1), BitShiftUtil.half(this.sectionX), BitShiftUtil.half(this.sectionZ)); } - public DhSectionPos getAdjacentPos(ELodDirection dir) + public DhSectionPos getAdjacentPos(EDhDirection dir) { return new DhSectionPos(this.sectionDetailLevel, this.sectionX + dir.getNormal().x, diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/LodRenderSection.java b/core/src/main/java/com/seibel/distanthorizons/core/render/LodRenderSection.java index 7675cbf2e..3a85d2dec 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/render/LodRenderSection.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/render/LodRenderSection.java @@ -2,6 +2,7 @@ package com.seibel.distanthorizons.core.render; import com.seibel.distanthorizons.core.dataObjects.render.ColumnRenderSource; import com.seibel.distanthorizons.core.dataObjects.render.bufferBuilding.ColumnRenderBufferBuilder; +import com.seibel.distanthorizons.core.enums.EDhDirection; import com.seibel.distanthorizons.core.file.renderfile.ILodRenderSourceProvider; import com.seibel.distanthorizons.core.level.IDhClientLevel; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; @@ -11,7 +12,6 @@ import com.seibel.distanthorizons.core.util.LodUtil; import com.seibel.distanthorizons.core.util.objects.Reference; import com.seibel.distanthorizons.core.util.objects.quadTree.QuadTree; import com.seibel.distanthorizons.core.dataObjects.render.bufferBuilding.ColumnRenderBuffer; -import com.seibel.distanthorizons.core.enums.ELodDirection; import com.seibel.distanthorizons.core.render.renderer.DebugRenderer; import org.apache.logging.log4j.Logger; @@ -20,7 +20,6 @@ import java.util.Objects; import java.util.concurrent.CancellationException; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; /** @@ -224,8 +223,8 @@ public class LodRenderSection implements IDebugRenderable private LodRenderSection[] getNeighbors() { - LodRenderSection[] adjacents = new LodRenderSection[ELodDirection.ADJ_DIRECTIONS.length]; - for (ELodDirection direction : ELodDirection.ADJ_DIRECTIONS) { + LodRenderSection[] adjacents = new LodRenderSection[EDhDirection.ADJ_DIRECTIONS.length]; + for (EDhDirection direction : EDhDirection.ADJ_DIRECTIONS) { try { DhSectionPos adjPos = pos.getAdjacentPos(direction); LodRenderSection adjRenderSection = parentQuadTree.getValue(adjPos); @@ -285,8 +284,8 @@ public class LodRenderSection implements IDebugRenderable tellNeighborsUpdated(); } LodRenderSection[] adjacents = getNeighbors(); - ColumnRenderSource[] adjacentSources = new ColumnRenderSource[ELodDirection.ADJ_DIRECTIONS.length]; - for (int i = 0; i < ELodDirection.ADJ_DIRECTIONS.length; i++) { + ColumnRenderSource[] adjacentSources = new ColumnRenderSource[EDhDirection.ADJ_DIRECTIONS.length]; + for (int i = 0; i < EDhDirection.ADJ_DIRECTIONS.length; i++) { LodRenderSection adj = adjacents[i]; if (adj != null) { adjacentSources[i] = adj.getRenderSource(); diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/RenderBufferHandler.java b/core/src/main/java/com/seibel/distanthorizons/core/render/RenderBufferHandler.java index d21feac49..eed83d04f 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/render/RenderBufferHandler.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/render/RenderBufferHandler.java @@ -1,11 +1,11 @@ package com.seibel.distanthorizons.core.render; +import com.seibel.distanthorizons.core.enums.EDhDirection; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.pos.DhSectionPos; import com.seibel.distanthorizons.core.pos.Pos2D; import com.seibel.distanthorizons.core.util.objects.SortedArraySet; import com.seibel.distanthorizons.core.util.objects.quadTree.QuadNode; -import com.seibel.distanthorizons.core.enums.ELodDirection; import com.seibel.distanthorizons.core.render.renderer.LodRenderer; import com.seibel.distanthorizons.coreapi.util.math.Vec3f; import org.apache.logging.log4j.Logger; @@ -45,16 +45,16 @@ public class RenderBufferHandler */ public void buildRenderListAndUpdateSections(Vec3f lookForwardVector) { - ELodDirection[] axisDirections = new ELodDirection[3]; + EDhDirection[] axisDirections = new EDhDirection[3]; // Do the axis that are the longest first (i.e. the largest absolute value of the lookForwardVector), // with the sign being the opposite of the respective lookForwardVector component's sign float absX = Math.abs(lookForwardVector.x); float absY = Math.abs(lookForwardVector.y); float absZ = Math.abs(lookForwardVector.z); - ELodDirection xDir = lookForwardVector.x < 0 ? ELodDirection.EAST : ELodDirection.WEST; - ELodDirection yDir = lookForwardVector.y < 0 ? ELodDirection.UP : ELodDirection.DOWN; - ELodDirection zDir = lookForwardVector.z < 0 ? ELodDirection.SOUTH : ELodDirection.NORTH; + EDhDirection xDir = lookForwardVector.x < 0 ? EDhDirection.EAST : EDhDirection.WEST; + EDhDirection yDir = lookForwardVector.y < 0 ? EDhDirection.UP : EDhDirection.DOWN; + EDhDirection zDir = lookForwardVector.z < 0 ? EDhDirection.SOUTH : EDhDirection.NORTH; if (absX >= absY && absX >= absZ) { @@ -112,7 +112,7 @@ public class RenderBufferHandler return bManhattanDistance - aManhattanDistance; } - for (ELodDirection axisDirection : axisDirections) + for (EDhDirection axisDirection : axisDirections) { if (axisDirection.getAxis().isVertical()) { @@ -120,7 +120,7 @@ public class RenderBufferHandler } int abPosDifference; - if (axisDirection.getAxis().equals(ELodDirection.Axis.X)) + if (axisDirection.getAxis().equals(EDhDirection.Axis.X)) { abPosDifference = aPos.x - bPos.x; } @@ -134,7 +134,7 @@ public class RenderBufferHandler continue; } - if (axisDirection.getAxisDirection().equals(ELodDirection.AxisDirection.NEGATIVE)) + if (axisDirection.getAxisDirection().equals(EDhDirection.AxisDirection.NEGATIVE)) { abPosDifference = -abPosDifference; // Reverse the sign } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/chunk/IChunkWrapper.java b/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/chunk/IChunkWrapper.java index d2b68252f..f699a174f 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/chunk/IChunkWrapper.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/chunk/IChunkWrapper.java @@ -45,10 +45,10 @@ public interface IChunkWrapper extends IBindable */ int getLightBlockingHeightMapValue(int xRel, int zRel); - int getMaxX(); - int getMaxZ(); - int getMinX(); - int getMinZ(); + int getMaxBlockX(); + int getMaxBlockZ(); + int getMinBlockX(); + int getMinBlockZ(); long getLongChunkPos(); @@ -72,17 +72,17 @@ public interface IChunkWrapper extends IBindable default boolean blockPosInsideChunk(DhBlockPos blockPos) { return this.blockPosInsideChunk(blockPos.x, blockPos.y, blockPos.z); } default boolean blockPosInsideChunk(int x, int y, int z) { - return (x >= this.getMinX() && x <= this.getMaxX() + return (x >= this.getMinBlockX() && x <= this.getMaxBlockX() && y >= this.getMinBuildHeight() && y < this.getMaxBuildHeight() - && z >= this.getMinZ() && z <= this.getMaxZ()); + && z >= this.getMinBlockZ() && z <= this.getMaxBlockZ()); } default boolean blockPosInsideChunk(DhBlockPos2D blockPos) { - return (blockPos.x >= this.getMinX() && blockPos.x <= this.getMaxX() - && blockPos.z >= this.getMinZ() && blockPos.z <= this.getMaxZ()); + return (blockPos.x >= this.getMinBlockX() && blockPos.x <= this.getMaxBlockX() + && blockPos.z >= this.getMinBlockZ() && blockPos.z <= this.getMaxBlockZ()); } - boolean doesNearbyChunksExist(); + boolean doNearbyChunksExist(); String toString(); /** This is a bad hash algorithm, but can be used for rough debugging. */ diff --git a/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/minecraft/IMinecraftClientWrapper.java b/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/minecraft/IMinecraftClientWrapper.java index d96e144cc..b9aec9bd1 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/minecraft/IMinecraftClientWrapper.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/minecraft/IMinecraftClientWrapper.java @@ -23,10 +23,10 @@ import java.io.File; import java.util.ArrayList; import java.util.UUID; +import com.seibel.distanthorizons.core.enums.EDhDirection; import com.seibel.distanthorizons.core.pos.DhBlockPos; import com.seibel.distanthorizons.core.pos.DhChunkPos; import com.seibel.distanthorizons.coreapi.ModInfo; -import com.seibel.distanthorizons.core.enums.ELodDirection; import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IBindable; import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; import org.apache.logging.log4j.Level; @@ -57,7 +57,7 @@ public interface IMinecraftClientWrapper extends IBindable // method wrappers // //=================// - float getShade(ELodDirection lodDirection); + float getShade(EDhDirection lodDirection); boolean hasSinglePlayerServer(); boolean clientConnectedToDedicatedServer();