From 44aed79e78722a53f88adfc13458679a7507bb67 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 1 Jun 2026 22:07:03 -0500 Subject: [PATCH] add Dh prefix to DH math objects --- .../methods/data/DhApiTerrainDataRepo.java | 39 +++++++--------- .../core/api/internal/ClientApi.java | 6 +-- .../api/internal/rendering/DhRenderState.java | 6 +-- .../core/enums/EDhDirection.java | 18 ++++---- .../core/level/AbstractDhServerLevel.java | 9 ++-- .../core/level/ClientLevelModule.java | 4 +- .../distanthorizons/core/pos/DhChunkPos.java | 4 +- .../core/render/RenderBufferHandler.java | 10 ++--- .../core/render/RenderParams.java | 15 +++---- .../AbstractDebugWireframeRenderer.java | 30 ++++++------- .../render/renderer/BeaconRenderHandler.java | 6 +-- .../render/renderer/CloudRenderHandler.java | 26 +++++------ .../cullingFrustum/DhFrustumBounds.java | 4 +- .../util/math/{Mat4f.java => DhMat4f.java} | 26 +++++------ .../util/math/{Vec3d.java => DhVec3d.java} | 45 +++++++++---------- .../util/math/{Vec3f.java => DhVec3f.java} | 20 ++++----- .../util/math/{Vec3i.java => DhVec3i.java} | 36 +++++++-------- .../minecraft/IMinecraftRenderWrapper.java | 9 ++-- .../misc/IServerPlayerWrapper.java | 6 +-- .../IImmersivePortalsAccessor.java | 4 +- .../renderPass/IDhVanillaFadeRenderer.java | 2 - 21 files changed, 153 insertions(+), 172 deletions(-) rename core/src/main/java/com/seibel/distanthorizons/core/util/math/{Mat4f.java => DhMat4f.java} (86%) rename core/src/main/java/com/seibel/distanthorizons/core/util/math/{Vec3d.java => DhVec3d.java} (74%) rename core/src/main/java/com/seibel/distanthorizons/core/util/math/{Vec3f.java => DhVec3f.java} (86%) rename core/src/main/java/com/seibel/distanthorizons/core/util/math/{Vec3i.java => DhVec3i.java} (78%) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/api/external/methods/data/DhApiTerrainDataRepo.java b/core/src/main/java/com/seibel/distanthorizons/core/api/external/methods/data/DhApiTerrainDataRepo.java index c871a2bae..7a02895bc 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/api/external/methods/data/DhApiTerrainDataRepo.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/api/external/methods/data/DhApiTerrainDataRepo.java @@ -19,15 +19,12 @@ package com.seibel.distanthorizons.core.api.external.methods.data; -import com.seibel.distanthorizons.api.interfaces.block.IDhApiBiomeWrapper; -import com.seibel.distanthorizons.api.interfaces.block.IDhApiBlockStateWrapper; import com.seibel.distanthorizons.api.interfaces.data.IDhApiTerrainDataCache; import com.seibel.distanthorizons.api.interfaces.world.IDhApiLevelWrapper; import com.seibel.distanthorizons.api.objects.DhApiResult; import com.seibel.distanthorizons.api.objects.data.DhApiRaycastResult; import com.seibel.distanthorizons.api.objects.data.DhApiTerrainDataPoint; import com.seibel.distanthorizons.api.interfaces.data.IDhApiTerrainDataRepo; -import com.seibel.distanthorizons.api.objects.data.IDhApiFullDataSource; import com.seibel.distanthorizons.api.objects.math.DhApiVec3i; import com.seibel.distanthorizons.core.api.internal.SharedApi; import com.seibel.distanthorizons.core.dataObjects.fullData.FullDataPointIdMap; @@ -37,26 +34,20 @@ import com.seibel.distanthorizons.core.level.IDhLevel; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.pos.DhChunkPos; import com.seibel.distanthorizons.core.pos.DhSectionPos; -import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos; -import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPosMutable; import com.seibel.distanthorizons.core.render.renderer.AbstractDebugWireframeRenderer; import com.seibel.distanthorizons.core.util.DhApiTerrainDataPointUtil; import com.seibel.distanthorizons.core.util.FullDataPointUtil; import com.seibel.distanthorizons.core.util.LodUtil; import com.seibel.distanthorizons.core.util.RayCastUtil; -import com.seibel.distanthorizons.core.util.math.Vec3f; +import com.seibel.distanthorizons.core.util.math.DhVec3f; import com.seibel.distanthorizons.core.world.AbstractDhWorld; import com.seibel.distanthorizons.core.wrapperInterfaces.IWrapperFactory; -import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper; -import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper; -import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; import com.seibel.distanthorizons.coreapi.util.BitShiftUtil; -import com.seibel.distanthorizons.core.util.math.Vec3d; -import com.seibel.distanthorizons.core.util.math.Vec3i; -import com.seibel.distanthorizons.coreapi.util.ColorUtil; +import com.seibel.distanthorizons.core.util.math.DhVec3d; +import com.seibel.distanthorizons.core.util.math.DhVec3i; import it.unimi.dsi.fastutil.longs.LongArrayList; import com.seibel.distanthorizons.core.logging.DhLogger; import org.jetbrains.annotations.Nullable; @@ -80,7 +71,7 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo // debugging values private static volatile boolean debugThreadRunning = false; private static DhApiTerrainDataCache debugDataCache = new DhApiTerrainDataCache(); - private static DhApiVec3i currentDebugVec3i = new Vec3i(); + private static DhApiVec3i currentDebugVec3i = new DhVec3i(); @@ -375,8 +366,8 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo IDhApiTerrainDataCache dataCache) { return this.raycastLodData(levelWrapper, - new Vec3d(rayOriginX, rayOriginY, rayOriginZ), - new Vec3f(rayDirectionX, rayDirectionY, rayDirectionZ), + new DhVec3d(rayOriginX, rayOriginY, rayOriginZ), + new DhVec3f(rayDirectionX, rayDirectionY, rayDirectionZ), maxRayBlockLength, dataCache); } @@ -388,7 +379,7 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo */ private DhApiResult raycastLodData( IDhApiLevelWrapper levelWrapper, - Vec3d rayOrigin, Vec3f rayDirection, + DhVec3d rayOrigin, DhVec3f rayDirection, int maxRayBlockLength, @Nullable IDhApiTerrainDataCache dataCache) @@ -405,9 +396,9 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo int currentLength = 0; // the exact position of this step - Vec3d exactPos = new Vec3d(rayOrigin.x, rayOrigin.y, rayOrigin.z); + DhVec3d exactPos = new DhVec3d(rayOrigin.x, rayOrigin.y, rayOrigin.z); // the block position for this step - Vec3i blockPos = new Vec3i((int) Math.round(rayOrigin.x), (int) Math.round(rayOrigin.y), (int) Math.round(rayOrigin.z)); + DhVec3i blockPos = new DhVec3i((int) Math.round(rayOrigin.x), (int) Math.round(rayOrigin.y), (int) Math.round(rayOrigin.z)); DhApiRaycastResult closetFoundDataPoint = null; @@ -417,8 +408,8 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo && currentLength <= maxRayBlockLength) { // get the LOD columns around this position - ArrayList columnPositions = getIntersectingColumnsAtPosition(blockPos, rayDirection); - for (Vec3i columnPos : columnPositions) + ArrayList columnPositions = getIntersectingColumnsAtPosition(blockPos, rayDirection); + for (DhVec3i columnPos : columnPositions) { // check each column DhApiResult result = this.getColumnDataAtBlockPos(levelWrapper, columnPos.x, columnPos.z, dataCache); @@ -435,7 +426,7 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo if (dataPoint.blockStateWrapper != null && !dataPoint.blockStateWrapper.isAir()) { // does this LOD contain the given Y position? - Vec3i dataPointPos = new Vec3i(columnPos.x, dataPoint.bottomYBlockPos, columnPos.z); + DhVec3i dataPointPos = new DhVec3i(columnPos.x, dataPoint.bottomYBlockPos, columnPos.z); if (exactPos.y >= dataPoint.bottomYBlockPos && exactPos.y <= dataPoint.topYBlockPos) { @@ -488,15 +479,15 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo * * Used to make sure the raycast step doesn't accidentally walk over any adjacent data. */ - private static ArrayList getIntersectingColumnsAtPosition(Vec3i rayEndingPos, Vec3f rayDirection) + private static ArrayList getIntersectingColumnsAtPosition(DhVec3i rayEndingPos, DhVec3f rayDirection) { - ArrayList returnList = new ArrayList<>(9); + ArrayList returnList = new ArrayList<>(9); for (int x = -1; x <= 1; x++) { for (int z = -1; z <= 1; z++) { - Vec3i pos = new Vec3i(rayEndingPos.x + x, rayEndingPos.y, rayEndingPos.z + z); + DhVec3i pos = new DhVec3i(rayEndingPos.x + x, rayEndingPos.y, rayEndingPos.z + z); // check if this column is intersected by the ray if (RayCastUtil.rayIntersectsSquare(rayEndingPos.x, rayEndingPos.z, rayDirection.x, rayDirection.z, pos.x, pos.z, 1)) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/api/internal/ClientApi.java b/core/src/main/java/com/seibel/distanthorizons/core/api/internal/ClientApi.java index c5f20de66..758e5d0e7 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/api/internal/ClientApi.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/api/internal/ClientApi.java @@ -36,7 +36,7 @@ import com.seibel.distanthorizons.core.render.RenderParams; import com.seibel.distanthorizons.core.render.RenderThreadTaskHandler; import com.seibel.distanthorizons.core.render.renderer.*; import com.seibel.distanthorizons.core.util.TimerUtil; -import com.seibel.distanthorizons.core.util.math.Vec3d; +import com.seibel.distanthorizons.core.util.math.DhVec3d; import com.seibel.distanthorizons.core.util.objects.Pair; import com.seibel.distanthorizons.core.util.objects.RollingAverage; import com.seibel.distanthorizons.core.util.threading.ThreadPoolUtil; @@ -156,7 +156,7 @@ public class ClientApi * @see ClientApi#MIN_MS_BETWEEN_SPEED_CHECKS */ private final RollingAverage cameraSpeedRollingAverage = new RollingAverage(40); - private Vec3d lastCameraPosForSpeedCheck = new Vec3d(); + private DhVec3d lastCameraPosForSpeedCheck = new DhVec3d(); private long msSinceLastSpeedCheck = 0L; public double getAvgCameraSpeed() { return cameraSpeedRollingAverage.getAverage(); } @@ -470,7 +470,7 @@ public class ClientApi this.msSinceLastSpeedCheck = nowMs; // get the distance traveled since last frame - Vec3d camPos = MC_RENDER.getCameraExactPosition(); + DhVec3d camPos = MC_RENDER.getCameraExactPosition(); double distanceInBlocks = camPos.getDistance(this.lastCameraPosForSpeedCheck); double speed = distanceInBlocks / secSinceLastCheck; diff --git a/core/src/main/java/com/seibel/distanthorizons/core/api/internal/rendering/DhRenderState.java b/core/src/main/java/com/seibel/distanthorizons/core/api/internal/rendering/DhRenderState.java index 2d6aed6c7..406b7425e 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/api/internal/rendering/DhRenderState.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/api/internal/rendering/DhRenderState.java @@ -1,7 +1,7 @@ package com.seibel.distanthorizons.core.api.internal.rendering; import com.seibel.distanthorizons.core.api.internal.ClientApi; -import com.seibel.distanthorizons.core.util.math.Mat4f; +import com.seibel.distanthorizons.core.util.math.DhMat4f; import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; @@ -12,8 +12,8 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapp */ public class DhRenderState { - public Mat4f mcModelViewMatrix = null; - public Mat4f mcProjectionMatrix = null; + public DhMat4f mcModelViewMatrix = null; + public DhMat4f mcProjectionMatrix = null; /** * percentage of time into the current client tick.

* diff --git a/core/src/main/java/com/seibel/distanthorizons/core/enums/EDhDirection.java b/core/src/main/java/com/seibel/distanthorizons/core/enums/EDhDirection.java index 12902c7fa..66718b1a7 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/enums/EDhDirection.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/enums/EDhDirection.java @@ -19,7 +19,7 @@ package com.seibel.distanthorizons.core.enums; -import com.seibel.distanthorizons.core.util.math.Vec3i; +import com.seibel.distanthorizons.core.util.math.DhVec3i; /** * Up
@@ -32,17 +32,17 @@ import com.seibel.distanthorizons.core.util.math.Vec3i; public enum EDhDirection { /** negative Y */ - DOWN("down", EDhDirection.AxisDirection.NEGATIVE, EDhDirection.Axis.Y, new Vec3i(0, -1, 0), -1), + DOWN("down", EDhDirection.AxisDirection.NEGATIVE, EDhDirection.Axis.Y, new DhVec3i(0, -1, 0), -1), /** positive Y */ - UP("up", EDhDirection.AxisDirection.POSITIVE, EDhDirection.Axis.Y, new Vec3i(0, 1, 0), -1), + UP("up", EDhDirection.AxisDirection.POSITIVE, EDhDirection.Axis.Y, new DhVec3i(0, 1, 0), -1), /** negative Z */ - NORTH("north", EDhDirection.AxisDirection.NEGATIVE, EDhDirection.Axis.Z, new Vec3i(0, 0, -1), 0), + NORTH("north", EDhDirection.AxisDirection.NEGATIVE, EDhDirection.Axis.Z, new DhVec3i(0, 0, -1), 0), /** positive Z */ - SOUTH("south", EDhDirection.AxisDirection.POSITIVE, EDhDirection.Axis.Z, new Vec3i(0, 0, 1), 1), + SOUTH("south", EDhDirection.AxisDirection.POSITIVE, EDhDirection.Axis.Z, new DhVec3i(0, 0, 1), 1), /** negative X */ - WEST("west", EDhDirection.AxisDirection.NEGATIVE, EDhDirection.Axis.X, new Vec3i(-1, 0, 0), 2), + WEST("west", EDhDirection.AxisDirection.NEGATIVE, EDhDirection.Axis.X, new DhVec3i(-1, 0, 0), 2), /** positive X */ - EAST("east", EDhDirection.AxisDirection.POSITIVE, EDhDirection.Axis.X, new Vec3i(1, 0, 0), 3); + EAST("east", EDhDirection.AxisDirection.POSITIVE, EDhDirection.Axis.X, new DhVec3i(1, 0, 0), 3); /** Up, Down, West, East, North, South */ @@ -68,7 +68,7 @@ public enum EDhDirection public final String name; public final EDhDirection.Axis axis; public final EDhDirection.AxisDirection axisDirection; - public final Vec3i normal; + public final DhVec3i normal; /** -1 if not a {@link EDhDirection#CARDINAL_COMPASS} direction */ public final int compassIndex; @@ -78,7 +78,7 @@ public enum EDhDirection // constructor // //=============// - EDhDirection(String name, EDhDirection.AxisDirection axisDirection, EDhDirection.Axis axis, Vec3i normal, int compassIndex) + EDhDirection(String name, EDhDirection.AxisDirection axisDirection, EDhDirection.Axis axis, DhVec3i normal, int compassIndex) { this.name = name; this.axis = axis; diff --git a/core/src/main/java/com/seibel/distanthorizons/core/level/AbstractDhServerLevel.java b/core/src/main/java/com/seibel/distanthorizons/core/level/AbstractDhServerLevel.java index d0ba42ed1..31854f0dc 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/level/AbstractDhServerLevel.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/level/AbstractDhServerLevel.java @@ -21,14 +21,13 @@ import com.seibel.distanthorizons.core.pos.DhSectionPos; import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D; import com.seibel.distanthorizons.core.util.LodUtil; import com.seibel.distanthorizons.core.util.WorldGenUtil; -import com.seibel.distanthorizons.core.util.math.Vec3d; +import com.seibel.distanthorizons.core.util.math.DhVec3d; import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IServerPlayerWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.world.IServerLevelWrapper; import com.seibel.distanthorizons.core.logging.DhLogger; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; import java.io.IOException; import java.sql.SQLException; import java.util.List; @@ -113,7 +112,7 @@ public abstract class AbstractDhServerLevel extends AbstractDhLevel implements I this.worldGenPlayerCenteringQueue.add(firstPlayer); this.worldGenPlayerCenteringQueue.remove(firstPlayer); - Vec3d position = firstPlayer.getPosition(); + DhVec3d position = firstPlayer.getPosition(); return new DhBlockPos2D((int) position.x, (int) position.z); } @@ -132,7 +131,7 @@ public abstract class AbstractDhServerLevel extends AbstractDhLevel implements I return; } - Vec3d playerPosition = serverPlayerState.getServerPlayer().getPosition(); + DhVec3d playerPosition = serverPlayerState.getServerPlayer().getPosition(); int distanceFromPlayer = DhSectionPos.getChebyshevSignedBlockDistance(message.sectionPos, new DhBlockPos2D((int) playerPosition.x, (int) playerPosition.z)) / 16; ServerPlayerState.RateLimiterSet rateLimiterSet = serverPlayerState.getRateLimiterSet(this); @@ -249,7 +248,7 @@ public abstract class AbstractDhServerLevel extends AbstractDhLevel implements I continue; } - Vec3d playerPosition = serverPlayerState.getServerPlayer().getPosition(); + DhVec3d playerPosition = serverPlayerState.getServerPlayer().getPosition(); int distanceFromPlayer = DhSectionPos.getChebyshevSignedBlockDistance(data.getPos(), new DhBlockPos2D((int) playerPosition.x, (int) playerPosition.z)) / 16; if (distanceFromPlayer <= serverPlayerState.sessionConfig.getMaxUpdateDistanceRadius()) { diff --git a/core/src/main/java/com/seibel/distanthorizons/core/level/ClientLevelModule.java b/core/src/main/java/com/seibel/distanthorizons/core/level/ClientLevelModule.java index 1826b8edf..d812e9bf6 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/level/ClientLevelModule.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/level/ClientLevelModule.java @@ -29,7 +29,7 @@ import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D; import com.seibel.distanthorizons.core.render.QuadTree.LodQuadTree; import com.seibel.distanthorizons.core.render.RenderBufferHandler; import com.seibel.distanthorizons.core.util.LodUtil; -import com.seibel.distanthorizons.core.util.math.Vec3d; +import com.seibel.distanthorizons.core.util.math.DhVec3d; import com.seibel.distanthorizons.core.wrapperInterfaces.IWrapperFactory; import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper; @@ -110,7 +110,7 @@ public class ClientLevelModule implements Closeable, IDataSourceUpdateListenerFu } // use camera position instead of player pos so free cam mods work better - Vec3d cameraDoublePos = MC_RENDER.getCameraExactPosition(); + DhVec3d cameraDoublePos = MC_RENDER.getCameraExactPosition(); DhBlockPos2D cameraBlockPos = new DhBlockPos2D((int)cameraDoublePos.x, (int)cameraDoublePos.z); clientRenderState.quadtree.tryTick(cameraBlockPos); } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/pos/DhChunkPos.java b/core/src/main/java/com/seibel/distanthorizons/core/pos/DhChunkPos.java index 590513c56..16a9348d0 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/pos/DhChunkPos.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/pos/DhChunkPos.java @@ -22,7 +22,7 @@ package com.seibel.distanthorizons.core.pos; import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos; import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D; import com.seibel.distanthorizons.core.util.LodUtil; -import com.seibel.distanthorizons.core.util.math.Vec3d; +import com.seibel.distanthorizons.core.util.math.DhVec3d; /** * immutable

@@ -65,7 +65,7 @@ public class DhChunkPos // >> 4 is the Same as div 16 this(blockPos.x >> 4, blockPos.z >> 4); } - public DhChunkPos(Vec3d pos) + public DhChunkPos(DhVec3d pos) { // >> 4 is the Same as div 16 this(((int)pos.x) >> 4, ((int)pos.z) >> 4); 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 b85774ced..661dd6bc1 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 @@ -22,7 +22,6 @@ package com.seibel.distanthorizons.core.render; import com.seibel.distanthorizons.api.DhApi; import com.seibel.distanthorizons.api.interfaces.override.rendering.IDhApiCullingFrustum; import com.seibel.distanthorizons.api.interfaces.override.rendering.IDhApiShadowCullingFrustum; -import com.seibel.distanthorizons.api.objects.math.DhApiMat4f; import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.dataObjects.render.bufferBuilding.LodBufferContainer; import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; @@ -43,10 +42,9 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRen import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor; import com.seibel.distanthorizons.coreapi.ModInfo; import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IOverrideInjector; -import com.seibel.distanthorizons.core.util.math.Mat4f; -import com.seibel.distanthorizons.core.util.math.Vec3d; +import com.seibel.distanthorizons.core.util.math.DhMat4f; +import com.seibel.distanthorizons.core.util.math.DhVec3d; import org.joml.Matrix4f; -import org.joml.Matrix4fc; import java.util.ArrayList; @@ -65,7 +63,7 @@ public class RenderBufferHandler implements AutoCloseable private static final float[] JOML_TRANSPOSE_ARRAY = new float[16]; private static final Matrix4f WORLD_VIEW_JOML_MATRIX = new Matrix4f(); private static final Matrix4f WORLD_VIEW_PROJ_JOML_MATRIX = new Matrix4f(); - private static final Mat4f FRUSTOM_DH_MATRIX = new Mat4f(); + private static final DhMat4f FRUSTOM_DH_MATRIX = new DhMat4f(); /** contains all relevant data */ @@ -172,7 +170,7 @@ public class RenderBufferHandler implements AutoCloseable int worldMinY = renderParams.clientLevelWrapper.getMinHeight(); int worldHeight = renderParams.clientLevelWrapper.getMaxHeight(); - Vec3d cameraPos = MC_RENDER.getCameraExactPosition(); + DhVec3d cameraPos = MC_RENDER.getCameraExactPosition(); renderParams.mcModelViewMatrix.putValuesInArray(JOML_TRANSPOSE_ARRAY); WORLD_VIEW_JOML_MATRIX diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/RenderParams.java b/core/src/main/java/com/seibel/distanthorizons/core/render/RenderParams.java index 55706608f..41fc9649f 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/render/RenderParams.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/render/RenderParams.java @@ -2,15 +2,14 @@ package com.seibel.distanthorizons.core.render; import com.seibel.distanthorizons.api.enums.rendering.EDhApiRenderPass; import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam; -import com.seibel.distanthorizons.api.objects.math.DhApiMat4f; import com.seibel.distanthorizons.core.api.internal.SharedApi; import com.seibel.distanthorizons.core.api.internal.rendering.DhRenderState; import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; import com.seibel.distanthorizons.core.level.IDhClientLevel; import com.seibel.distanthorizons.core.util.RenderUtil; -import com.seibel.distanthorizons.core.util.math.Mat4f; -import com.seibel.distanthorizons.core.util.math.Vec3d; +import com.seibel.distanthorizons.core.util.math.DhMat4f; +import com.seibel.distanthorizons.core.util.math.DhVec3d; import com.seibel.distanthorizons.core.world.IDhClientWorld; import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper; @@ -46,7 +45,7 @@ public class RenderParams extends DhApiRenderParam public ILightMapWrapper lightmap; public RenderBufferHandler renderBufferHandler; public IDhGenericRenderer genericRenderer; - public Vec3d exactCameraPosition; + public DhVec3d exactCameraPosition; /** @see DhRenderState#vanillaFogEnabled */ public boolean vanillaFogEnabled; @@ -154,14 +153,14 @@ public class RenderParams extends DhApiRenderParam return "No Generic Renderer Present"; } - if (this.dhModelViewMatrix.equals(Mat4f.IDENTITY) - || this.dhModelViewMatrix.equals(Mat4f.EMPTY)) + if (this.dhModelViewMatrix.equals(DhMat4f.IDENTITY) + || this.dhModelViewMatrix.equals(DhMat4f.EMPTY)) { return "No DH MVM Matrix Given"; } - if (this.mcModelViewMatrix.equals(Mat4f.IDENTITY) - || this.mcModelViewMatrix.equals(Mat4f.EMPTY)) + if (this.mcModelViewMatrix.equals(DhMat4f.IDENTITY) + || this.mcModelViewMatrix.equals(DhMat4f.EMPTY)) { return "No MC MVM Matrix Given"; } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/AbstractDebugWireframeRenderer.java b/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/AbstractDebugWireframeRenderer.java index 3604c050e..77e4f0cd1 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/AbstractDebugWireframeRenderer.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/AbstractDebugWireframeRenderer.java @@ -7,9 +7,9 @@ import com.seibel.distanthorizons.core.logging.DhLogger; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.pos.DhSectionPos; import com.seibel.distanthorizons.core.render.RenderParams; -import com.seibel.distanthorizons.core.util.math.Mat4f; -import com.seibel.distanthorizons.core.util.math.Vec3d; -import com.seibel.distanthorizons.core.util.math.Vec3f; +import com.seibel.distanthorizons.core.util.math.DhMat4f; +import com.seibel.distanthorizons.core.util.math.DhVec3d; +import com.seibel.distanthorizons.core.util.math.DhVec3f; import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper; import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IBindable; import org.jetbrains.annotations.NotNull; @@ -35,8 +35,8 @@ public abstract class AbstractDebugWireframeRenderer implements IBindable protected final PriorityBlockingQueue particles = new PriorityBlockingQueue<>(); // used when rendering - protected Mat4f dhMvmProjMatrixThisFrame; - protected Vec3f camPosFloatThisFrame; + protected DhMat4f dhMvmProjMatrixThisFrame; + protected DhVec3f camPosFloatThisFrame; @@ -47,9 +47,9 @@ public abstract class AbstractDebugWireframeRenderer implements IBindable public void render(RenderParams renderParams) { - this.dhMvmProjMatrixThisFrame = new Mat4f(renderParams.dhMvmProjMatrix); - Vec3d camPos = MC_RENDER.getCameraExactPosition(); - this.camPosFloatThisFrame = new Vec3f((float) camPos.x, (float) camPos.y, (float) camPos.z); + this.dhMvmProjMatrixThisFrame = new DhMat4f(renderParams.dhMvmProjMatrix); + DhVec3d camPos = MC_RENDER.getCameraExactPosition(); + this.camPosFloatThisFrame = new DhVec3f((float) camPos.x, (float) camPos.y, (float) camPos.z); this.rendererLists.render(this); @@ -113,8 +113,8 @@ public abstract class AbstractDebugWireframeRenderer implements IBindable public static final class Box { - public Vec3f minPos; - public Vec3f maxPos; + public DhVec3f minPos; + public DhVec3f maxPos; public Color color; @@ -128,13 +128,13 @@ public abstract class AbstractDebugWireframeRenderer implements IBindable int maxBlockPosX = minBlockPosX + DhSectionPos.getBlockWidth(pos); int maxBlockPosZ = minBlockPosZ + DhSectionPos.getBlockWidth(pos); - this.minPos = new Vec3f(minBlockPosX + edgeOffset, minY, minBlockPosZ + edgeOffset); - this.maxPos = new Vec3f(maxBlockPosX - edgeOffset, maxY, maxBlockPosZ - edgeOffset); + this.minPos = new DhVec3f(minBlockPosX + edgeOffset, minY, minBlockPosZ + edgeOffset); + this.maxPos = new DhVec3f(maxBlockPosX - edgeOffset, maxY, maxBlockPosZ - edgeOffset); this.color = color; } /** only used for */ - public Box(Vec3f minPos, Vec3f maxPos, Color color) + public Box(DhVec3f minPos, DhVec3f maxPos, Color color) { this.minPos = minPos; this.maxPos = maxPos; @@ -177,8 +177,8 @@ public abstract class AbstractDebugWireframeRenderer implements IBindable float yDiff = this.yChange * percent; return new Box( - new Vec3f(this.box.minPos.x, this.box.minPos.y + yDiff, this.box.minPos.z), - new Vec3f(this.box.maxPos.x, this.box.maxPos.y + yDiff, this.box.maxPos.z), + new DhVec3f(this.box.minPos.x, this.box.minPos.y + yDiff, this.box.minPos.z), + new DhVec3f(this.box.maxPos.x, this.box.maxPos.y + yDiff, this.box.maxPos.z), this.box.color); } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/BeaconRenderHandler.java b/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/BeaconRenderHandler.java index 17d48b108..2f9be2f45 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/BeaconRenderHandler.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/BeaconRenderHandler.java @@ -34,7 +34,7 @@ import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos; import com.seibel.distanthorizons.core.sql.dto.BeaconBeamDTO; import com.seibel.distanthorizons.core.util.LodUtil; import com.seibel.distanthorizons.core.util.RenderUtil; -import com.seibel.distanthorizons.core.util.math.Vec3d; +import com.seibel.distanthorizons.core.util.math.DhVec3d; import com.seibel.distanthorizons.core.util.threading.ThreadPoolUtil; import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhGenericRenderer; @@ -138,7 +138,7 @@ public class BeaconRenderHandler // lock to make sure we don't try adding beacons to the arrays while processing them this.updateLock.lock(); - Vec3d cameraPos = MC_RENDER.getCameraExactPosition(); + DhVec3d cameraPos = MC_RENDER.getCameraExactPosition(); // fading by the overdraw prevention amount helps reduce beacons from rendering strangely // on the border of DH's render distance @@ -156,7 +156,7 @@ public class BeaconRenderHandler for (DhApiRenderableBox box : this.fullBeaconBoxList) { // if a beacon is outside the vanilla render distance render it - double distance = Vec3d.getHorizontalDistance(cameraPos, box.minPos); + double distance = DhVec3d.getHorizontalDistance(cameraPos, box.minPos); if (distance > dhFadeDistance) { this.activeBeaconBoxRenderGroup.add(box); diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/CloudRenderHandler.java b/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/CloudRenderHandler.java index 1f30e3a24..5986e5372 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/CloudRenderHandler.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/CloudRenderHandler.java @@ -31,8 +31,8 @@ import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; import com.seibel.distanthorizons.core.level.IDhClientLevel; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.util.LodUtil; -import com.seibel.distanthorizons.core.util.math.Vec3d; -import com.seibel.distanthorizons.core.util.math.Vec3f; +import com.seibel.distanthorizons.core.util.math.DhVec3d; +import com.seibel.distanthorizons.core.util.math.DhVec3f; import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhGenericRenderer; import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; @@ -89,13 +89,13 @@ public class CloudRenderHandler private final IDhGenericRenderer renderer; /** cached array so we don't need to re-create it each frame for each cloud group */ - private final Vec3d[] cullingCorners = new Vec3d[] + private final DhVec3d[] cullingCorners = new DhVec3d[] { // the values of each will be overwritten during the culling pass - new Vec3d(), - new Vec3d(), - new Vec3d(), - new Vec3d(), + new DhVec3d(), + new DhVec3d(), + new DhVec3d(), + new DhVec3d(), }; @@ -511,8 +511,8 @@ public class CloudRenderHandler this.cullingCorners[3].y = minPosY; this.cullingCorners[3].z = minPosZ + cloudParams.widthInBlocks; - Vec3d cameraPos = MC_RENDER.getCameraExactPosition(); - Vec3f cameraLookAtVector = MC_RENDER.getLookAtVector(); + DhVec3d cameraPos = MC_RENDER.getCameraExactPosition(); + DhVec3f cameraLookAtVector = MC_RENDER.getLookAtVector(); cameraLookAtVector.normalize(); double renderDistance = Config.Client.Advanced.Graphics.Quality.lodChunkRenderDistanceRadius.get() @@ -529,14 +529,14 @@ public class CloudRenderHandler boolean allOutsideRenderDistance = true; boolean allBehindCamera = true; - for (Vec3d corner : this.cullingCorners) + for (DhVec3d corner : this.cullingCorners) { // Check if the corner is within the render distance // (ignoring height, since LODs also ignore height) - Vec3d cornerNoHeight = new Vec3d(corner); + DhVec3d cornerNoHeight = new DhVec3d(corner); cornerNoHeight.y = 0; - Vec3d cameraPosNoHeight = new Vec3d(cameraPos); + DhVec3d cameraPosNoHeight = new DhVec3d(cameraPos); cameraPosNoHeight.y = 0; double cornerDistance = cornerNoHeight.getDistance(cameraPosNoHeight); @@ -547,7 +547,7 @@ public class CloudRenderHandler // Check if the corner is in front of the camera (dot product > 0 means in front) - Vec3f toCorner = new Vec3f( + DhVec3f toCorner = new DhVec3f( (float) (corner.x - cameraPos.x), (float) (corner.y - cameraPos.y), (float) (corner.z - cameraPos.z)); diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/cullingFrustum/DhFrustumBounds.java b/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/cullingFrustum/DhFrustumBounds.java index 5fe059b34..7d85e52b9 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/cullingFrustum/DhFrustumBounds.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/cullingFrustum/DhFrustumBounds.java @@ -3,7 +3,7 @@ package com.seibel.distanthorizons.core.render.renderer.cullingFrustum; import com.seibel.distanthorizons.api.interfaces.override.rendering.IDhApiCullingFrustum; import com.seibel.distanthorizons.api.objects.math.DhApiMat4f; import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IOverrideInjector; -import com.seibel.distanthorizons.core.util.math.Mat4f; +import com.seibel.distanthorizons.core.util.math.DhMat4f; import org.joml.FrustumIntersection; import org.joml.Matrix4f; import org.joml.Matrix4fc; @@ -41,7 +41,7 @@ public class DhFrustumBounds implements IDhApiCullingFrustum this.worldMinY = worldMinBlockY; this.worldMaxY = worldMaxBlockY; - Matrix4f worldViewProjection = new Matrix4f(Mat4f.createJomlMatrix(dhWorldViewProjection)); + Matrix4f worldViewProjection = new Matrix4f(DhMat4f.createJomlMatrix(dhWorldViewProjection)); this.frustum.set(worldViewProjection); Matrix4fc matWorldViewProjectionInv = new Matrix4f(worldViewProjection).invert(); diff --git a/core/src/main/java/com/seibel/distanthorizons/core/util/math/Mat4f.java b/core/src/main/java/com/seibel/distanthorizons/core/util/math/DhMat4f.java similarity index 86% rename from core/src/main/java/com/seibel/distanthorizons/core/util/math/Mat4f.java rename to core/src/main/java/com/seibel/distanthorizons/core/util/math/DhMat4f.java index 2254777b2..9cf611117 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/util/math/Mat4f.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/util/math/DhMat4f.java @@ -32,7 +32,7 @@ import java.nio.FloatBuffer; * @author James Seibel * @version 11-11-2021 */ -public class Mat4f extends DhApiMat4f +public class DhMat4f extends DhApiMat4f { /** * A matrix containing all 0's.

@@ -60,16 +60,16 @@ public class Mat4f extends DhApiMat4f //==============// /** all values are 0 */ - public Mat4f() { } + public DhMat4f() { } - public Mat4f(DhApiMat4f sourceMatrix) { super(sourceMatrix); } + public DhMat4f(DhApiMat4f sourceMatrix) { super(sourceMatrix); } /** Expects the values of the input buffer to be in row major order (AKA rows then columns) */ - public Mat4f(FloatBuffer buffer) { this(buffer.array()); } + public DhMat4f(FloatBuffer buffer) { this(buffer.array()); } /** Expects the values of the input array to be in row major order (AKA rows then columns) */ - public Mat4f(float[] values) { super(values); } + public DhMat4f(float[] values) { super(values); } - public Mat4f(Matrix4fc sourceMatrix) { this.set(sourceMatrix); } + public DhMat4f(Matrix4fc sourceMatrix) { this.set(sourceMatrix); } public void set(Matrix4fc sourceMatrix) { @@ -120,10 +120,10 @@ public class Mat4f extends DhApiMat4f // methods // //=========// - public static Mat4f perspective(double fov, float widthHeightRatio, float nearClipPlane, float farClipPlane) + public static DhMat4f perspective(double fov, float widthHeightRatio, float nearClipPlane, float farClipPlane) { float f = (float) (1.0D / Math.tan(fov * ((float) Math.PI / 180F) / 2.0D)); - Mat4f matrix = new Mat4f(); + DhMat4f matrix = new DhMat4f(); matrix.m00 = f / widthHeightRatio; matrix.m11 = f; matrix.m22 = (farClipPlane + nearClipPlane) / (nearClipPlane - farClipPlane); @@ -136,9 +136,9 @@ public class Mat4f extends DhApiMat4f public void multiplyTranslationMatrix(double x, double y, double z) { multiply(createTranslateMatrix((float) x, (float) y, (float) z)); } - public static Mat4f createScaleMatrix(float x, float y, float z) + public static DhMat4f createScaleMatrix(float x, float y, float z) { - Mat4f matrix = new Mat4f(); + DhMat4f matrix = new DhMat4f(); matrix.m00 = x; matrix.m11 = y; matrix.m22 = z; @@ -146,9 +146,9 @@ public class Mat4f extends DhApiMat4f return matrix; } - public static Mat4f createTranslateMatrix(float x, float y, float z) + public static DhMat4f createTranslateMatrix(float x, float y, float z) { - Mat4f matrix = new Mat4f(); + DhMat4f matrix = new DhMat4f(); matrix.m00 = 1.0F; matrix.m11 = 1.0F; matrix.m22 = 1.0F; @@ -203,7 +203,7 @@ public class Mat4f extends DhApiMat4f this.m23 = z; } - public Mat4f copy() { return new Mat4f(this); } + public DhMat4f copy() { return new DhMat4f(this); } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/util/math/Vec3d.java b/core/src/main/java/com/seibel/distanthorizons/core/util/math/DhVec3d.java similarity index 74% rename from core/src/main/java/com/seibel/distanthorizons/core/util/math/Vec3d.java rename to core/src/main/java/com/seibel/distanthorizons/core/util/math/DhVec3d.java index 6d8a745e2..bfa92e9ec 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/util/math/Vec3d.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/util/math/DhVec3d.java @@ -20,7 +20,6 @@ package com.seibel.distanthorizons.core.util.math; import com.seibel.distanthorizons.api.objects.math.DhApiVec3d; -import com.seibel.distanthorizons.api.objects.math.DhApiVec3f; import com.seibel.distanthorizons.coreapi.util.MathUtil; /** @@ -31,16 +30,16 @@ import com.seibel.distanthorizons.coreapi.util.MathUtil; * @author James Seibel * @version 11-18-2021 */ -public class Vec3d extends DhApiVec3d +public class DhVec3d extends DhApiVec3d { - public static Vec3d XNeg = new Vec3d(-1.0F, 0.0F, 0.0F); - public static Vec3d XPos = new Vec3d(1.0F, 0.0F, 0.0F); - public static Vec3d YNeg = new Vec3d(0.0F, -1.0F, 0.0F); - public static Vec3d YPos = new Vec3d(0.0F, 1.0F, 0.0F); - public static Vec3d ZNeg = new Vec3d(0.0F, 0.0F, -1.0F); - public static Vec3d ZPos = new Vec3d(0.0F, 0.0F, 1.0F); + public static DhVec3d XNeg = new DhVec3d(-1.0F, 0.0F, 0.0F); + public static DhVec3d XPos = new DhVec3d(1.0F, 0.0F, 0.0F); + public static DhVec3d YNeg = new DhVec3d(0.0F, -1.0F, 0.0F); + public static DhVec3d YPos = new DhVec3d(0.0F, 1.0F, 0.0F); + public static DhVec3d ZNeg = new DhVec3d(0.0F, 0.0F, -1.0F); + public static DhVec3d ZPos = new DhVec3d(0.0F, 0.0F, 1.0F); - public static final Vec3d ZERO_VECTOR = new Vec3d(0.0D, 0.0D, 0.0D); + public static final DhVec3d ZERO_VECTOR = new DhVec3d(0.0D, 0.0D, 0.0D); @@ -48,26 +47,26 @@ public class Vec3d extends DhApiVec3d // constructors // //==============// - public Vec3d() { } + public DhVec3d() { } - public Vec3d(double x, double y, double z) + public DhVec3d(double x, double y, double z) { this.x = x; this.y = y; this.z = z; } - public Vec3d(DhApiVec3d that) + public DhVec3d(DhApiVec3d that) { this.x = that.x; this.y = that.y; this.z = that.z; } - public Vec3d(double[] values) { this.set(values); } + public DhVec3d(double[] values) { this.set(values); } - public Vec3d copy() { return new Vec3d(this); } + public DhVec3d copy() { return new DhVec3d(this); } @@ -110,29 +109,29 @@ public class Vec3d extends DhApiVec3d this.z += z; } - public void add(Vec3d vector) + public void add(DhVec3d vector) { this.x += vector.x; this.y += vector.y; this.z += vector.z; } - public void subtract(Vec3d vector) + public void subtract(DhVec3d vector) { this.x -= vector.x; this.y -= vector.y; this.z -= vector.z; } - public double dotProduct(Vec3d vector) { return this.x * vector.x + this.y * vector.y + this.z * vector.z; } + public double dotProduct(DhVec3d vector) { return this.x * vector.x + this.y * vector.y + this.z * vector.z; } - public Vec3d normalize() + public DhVec3d normalize() { double value = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); - return value < 1.0E-4D ? ZERO_VECTOR : new Vec3d(this.x / value, this.y / value, this.z / value); + return value < 1.0E-4D ? ZERO_VECTOR : new DhVec3d(this.x / value, this.y / value, this.z / value); } - public void crossProduct(Vec3d vector) + public void crossProduct(DhVec3d vector) { double f = this.x; double f1 = this.y; @@ -168,9 +167,9 @@ public class Vec3d extends DhApiVec3d + Math.pow(a.z - b.z, 2)); } - /** @see Vec3d#getSquaredDistance(DhApiVec3d, DhApiVec3d) */ + /** @see DhVec3d#getSquaredDistance(DhApiVec3d, DhApiVec3d) */ public double getSquaredDistance(DhApiVec3d other) { return getSquaredDistance(this, other); } - /** slightly faster version of {@link Vec3d#getDistance} */ + /** slightly faster version of {@link DhVec3d#getDistance} */ public static double getSquaredDistance(DhApiVec3d a, DhApiVec3d b) { return Math.pow(a.x - b.x, 2) @@ -178,7 +177,7 @@ public class Vec3d extends DhApiVec3d + Math.pow(a.z - b.z, 2); } - /** @see Vec3d#getHorizontalDistance(DhApiVec3d, DhApiVec3d) */ + /** @see DhVec3d#getHorizontalDistance(DhApiVec3d, DhApiVec3d) */ public double getHorizontalDistance(DhApiVec3d other) { return getHorizontalDistance(this, other); } /** Gets the distance between points A and B, ignoring Y height. */ public static double getHorizontalDistance(DhApiVec3d a, DhApiVec3d b) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/util/math/Vec3f.java b/core/src/main/java/com/seibel/distanthorizons/core/util/math/DhVec3f.java similarity index 86% rename from core/src/main/java/com/seibel/distanthorizons/core/util/math/Vec3f.java rename to core/src/main/java/com/seibel/distanthorizons/core/util/math/DhVec3f.java index 84a9d52e0..d00677335 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/util/math/Vec3f.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/util/math/DhVec3f.java @@ -29,29 +29,29 @@ import com.seibel.distanthorizons.coreapi.util.MathUtil; * @author James Seibel * @version 11-11-2021 */ -public class Vec3f extends DhApiVec3f +public class DhVec3f extends DhApiVec3f { //==============// // constructors // //==============// - public Vec3f() { this(0,0,0); } + public DhVec3f() { this(0,0,0); } - public Vec3f(float x, float y, float z) + public DhVec3f(float x, float y, float z) { this.x = x; this.y = y; this.z = z; } - public Vec3f(DhApiVec3f pos) + public DhVec3f(DhApiVec3f pos) { this.x = pos.x; this.y = pos.y; this.z = pos.z; } - public Vec3f(Vec3d pos) + public DhVec3f(DhVec3d pos) { this.x = (float) pos.x; this.y = (float) pos.y; @@ -93,21 +93,21 @@ public class Vec3f extends DhApiVec3f this.z += z; } - public void add(Vec3f vector) + public void add(DhVec3f vector) { this.x += vector.x; this.y += vector.y; this.z += vector.z; } - public void subtract(Vec3f vector) + public void subtract(DhVec3f vector) { this.x -= vector.x; this.y -= vector.y; this.z -= vector.z; } - public float dotProduct(Vec3f vector) { return this.x * vector.x + this.y * vector.y + this.z * vector.z; } + public float dotProduct(DhVec3f vector) { return this.x * vector.x + this.y * vector.y + this.z * vector.z; } /** @return true if normalization had to be done */ public boolean normalize() @@ -127,7 +127,7 @@ public class Vec3f extends DhApiVec3f } } - public void crossProduct(Vec3f vector) + public void crossProduct(DhVec3f vector) { float f = this.x; float f1 = this.y; @@ -167,6 +167,6 @@ public class Vec3f extends DhApiVec3f this.z = z; } - public Vec3f copy() { return new Vec3f(this.x, this.y, this.z); } + public DhVec3f copy() { return new DhVec3f(this.x, this.y, this.z); } } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/util/math/Vec3i.java b/core/src/main/java/com/seibel/distanthorizons/core/util/math/DhVec3i.java similarity index 78% rename from core/src/main/java/com/seibel/distanthorizons/core/util/math/Vec3i.java rename to core/src/main/java/com/seibel/distanthorizons/core/util/math/DhVec3i.java index 9947eab00..1ac5eac23 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/util/math/Vec3i.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/util/math/DhVec3i.java @@ -29,27 +29,27 @@ import com.seibel.distanthorizons.api.objects.math.DhApiVec3i; * @author James Seibel * @version 2022-11-19 */ -public class Vec3i extends DhApiVec3i // extends the API object so it can be returned through the API +public class DhVec3i extends DhApiVec3i // extends the API object so it can be returned through the API { - public static Vec3i XNeg = new Vec3i(-1, 0, 0); - public static Vec3i XPos = new Vec3i(1, 0, 0); - public static Vec3i YNeg = new Vec3i(0, -1, 0); - public static Vec3i YPos = new Vec3i(0, 1, 0); - public static Vec3i ZNeg = new Vec3i(0, 0, -1); - public static Vec3i ZPos = new Vec3i(0, 0, 1); + public static DhVec3i XNeg = new DhVec3i(-1, 0, 0); + public static DhVec3i XPos = new DhVec3i(1, 0, 0); + public static DhVec3i YNeg = new DhVec3i(0, -1, 0); + public static DhVec3i YPos = new DhVec3i(0, 1, 0); + public static DhVec3i ZNeg = new DhVec3i(0, 0, -1); + public static DhVec3i ZPos = new DhVec3i(0, 0, 1); // x,y,z variables are handled in the parent object - public Vec3i() + public DhVec3i() { this.x = 0; this.y = 0; this.z = 0; } - public Vec3i(int x, int y, int z) + public DhVec3i(int x, int y, int z) { this.x = x; this.y = y; @@ -93,14 +93,14 @@ public class Vec3i extends DhApiVec3i // extends the API object so it can be ret this.z += z; } - public void add(Vec3i vector) + public void add(DhVec3i vector) { this.x += vector.x; this.y += vector.y; this.z += vector.z; } - public void subtract(Vec3i vector) + public void subtract(DhVec3i vector) { this.x -= vector.x; this.y -= vector.y; @@ -116,7 +116,7 @@ public class Vec3i extends DhApiVec3i // extends the API object so it can be ret return (xAdd * xAdd) + (yAdd * yAdd) + (zAdd * zAdd); } - public int distManhattan(Vec3i otherVec) + public int distManhattan(DhVec3i otherVec) { float xSub = Math.abs(otherVec.x - this.x); float ySub = Math.abs(otherVec.y - this.y); @@ -125,30 +125,30 @@ public class Vec3i extends DhApiVec3i // extends the API object so it can be ret } /** inner product */ - public float dotProduct(Vec3i vector) + public float dotProduct(DhVec3i vector) { return (this.x * vector.x) + (this.y * vector.y) + (this.z * vector.z); } /** Cross product */ - public Vec3i cross(Vec3i otherVec) + public DhVec3i cross(DhVec3i otherVec) { - return new Vec3i( + return new DhVec3i( (this.y * otherVec.z) - (this.z * otherVec.y), (this.z * otherVec.x) - (this.x * otherVec.z), (this.x * otherVec.y) - (this.y * otherVec.x)); } - public Vec3i copy() + public DhVec3i copy() { - return new Vec3i(this.x, this.y, this.z); + return new DhVec3i(this.x, this.y, this.z); } // Forge start - public Vec3i(int[] values) { this.set(values); } + public DhVec3i(int[] values) { this.set(values); } public void set(int[] values) { diff --git a/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/minecraft/IMinecraftRenderWrapper.java b/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/minecraft/IMinecraftRenderWrapper.java index 82f0d93da..ff6d02828 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/minecraft/IMinecraftRenderWrapper.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/minecraft/IMinecraftRenderWrapper.java @@ -22,12 +22,11 @@ package com.seibel.distanthorizons.core.wrapperInterfaces.minecraft; import java.awt.Color; import com.seibel.distanthorizons.core.api.internal.rendering.DhRenderState; -import com.seibel.distanthorizons.core.enums.EDhDirection; import com.seibel.distanthorizons.api.enums.config.EDhApiRenderingApi; import com.seibel.distanthorizons.core.wrapperInterfaces.misc.ILightMapWrapper; import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IBindable; -import com.seibel.distanthorizons.core.util.math.Vec3d; -import com.seibel.distanthorizons.core.util.math.Vec3f; +import com.seibel.distanthorizons.core.util.math.DhVec3d; +import com.seibel.distanthorizons.core.util.math.DhVec3f; import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -41,7 +40,7 @@ import org.jetbrains.annotations.Nullable; */ public interface IMinecraftRenderWrapper extends IBindable { - Vec3f getLookAtVector(); + DhVec3f getLookAtVector(); boolean playerHasBlindingEffect(); @@ -60,7 +59,7 @@ public interface IMinecraftRenderWrapper extends IBindable */ float getPartialTickTime(); - Vec3d getCameraExactPosition(); + DhVec3d getCameraExactPosition(); Color getFogColor(float partialTicks); diff --git a/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/misc/IServerPlayerWrapper.java b/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/misc/IServerPlayerWrapper.java index 5b03c0779..4268e4d8b 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/misc/IServerPlayerWrapper.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/misc/IServerPlayerWrapper.java @@ -21,9 +21,7 @@ package com.seibel.distanthorizons.core.wrapperInterfaces.misc; import com.seibel.distanthorizons.api.interfaces.IDhApiUnsafeWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.world.IServerLevelWrapper; -import com.seibel.distanthorizons.core.util.math.Vec3d; - -import java.net.SocketAddress; +import com.seibel.distanthorizons.core.util.math.DhVec3d; public interface IServerPlayerWrapper extends IDhApiUnsafeWrapper { @@ -31,6 +29,6 @@ public interface IServerPlayerWrapper extends IDhApiUnsafeWrapper IServerLevelWrapper getLevel(); - Vec3d getPosition(); + DhVec3d getPosition(); } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/modAccessor/IImmersivePortalsAccessor.java b/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/modAccessor/IImmersivePortalsAccessor.java index 9e79ce687..2703f1083 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/modAccessor/IImmersivePortalsAccessor.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/modAccessor/IImmersivePortalsAccessor.java @@ -21,7 +21,7 @@ package com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor; import com.seibel.distanthorizons.core.pos.DhChunkPos; import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos; -import com.seibel.distanthorizons.core.util.math.Vec3d; +import com.seibel.distanthorizons.core.util.math.DhVec3d; import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; import org.jetbrains.annotations.Nullable; @@ -70,7 +70,7 @@ public interface IImmersivePortalsAccessor extends IModAccessor * variables in order to render the camera in multiple dimensions. */ @Nullable - Vec3d getActualCameraPos(); + DhVec3d getActualCameraPos(); diff --git a/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/render/renderPass/IDhVanillaFadeRenderer.java b/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/render/renderPass/IDhVanillaFadeRenderer.java index 7bb325a0c..628bbf05e 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/render/renderPass/IDhVanillaFadeRenderer.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/render/renderPass/IDhVanillaFadeRenderer.java @@ -20,8 +20,6 @@ package com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass; import com.seibel.distanthorizons.core.render.RenderParams; -import com.seibel.distanthorizons.core.util.math.Mat4f; -import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IBindable; public interface IDhVanillaFadeRenderer extends IBindable