From b2196448f7c24a656a583c9b44df6c76154a0a5c Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 14 Jun 2023 19:42:16 -0500 Subject: [PATCH 1/4] Improve thread pool names --- .../bufferBuilding/ColumnRenderBufferBuilder.java | 4 ++-- .../transformers/DataRenderTransformer.java | 2 +- .../core/file/renderfile/RenderSourceFileHandler.java | 10 +++++----- .../file/subDimMatching/SubDimensionLevelMatcher.java | 2 +- .../com/seibel/lod/core/render/glObject/GLProxy.java | 3 ++- .../com/seibel/lod/core/world/DhClientServerWorld.java | 3 ++- .../java/com/seibel/lod/core/world/DhClientWorld.java | 3 ++- 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/core/src/main/java/com/seibel/lod/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java b/core/src/main/java/com/seibel/lod/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java index e011cfd4f..bf411dfff 100644 --- a/core/src/main/java/com/seibel/lod/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java +++ b/core/src/main/java/com/seibel/lod/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java @@ -38,7 +38,7 @@ public class ColumnRenderBufferBuilder private static final Logger LOGGER = DhLoggerBuilder.getLogger(); - public static ExecutorService bufferUploaderThreadPool = ThreadUtil.makeSingleThreadPool("ColumnBufferUploader"); + public static ExecutorService bufferUploaderThreadPool = ThreadUtil.makeSingleThreadPool("Column Buffer Uploader"); public static ExecutorService bufferBuilderThreadPool; private static ConfigChangeListener configListener; @@ -382,7 +382,7 @@ public class ColumnRenderBufferBuilder } public static void setThreadPoolSize(int threadPoolSize) { - bufferBuilderThreadPool = ThreadUtil.makeThreadPool(threadPoolSize, "BufferBuilder"); + bufferBuilderThreadPool = ThreadUtil.makeThreadPool(threadPoolSize, "Buffer Builder"); maxNumberOfConcurrentCalls = threadPoolSize * MAX_NUMBER_OF_CONCURRENT_CALLS_PER_THREAD; } diff --git a/core/src/main/java/com/seibel/lod/core/dataObjects/transformers/DataRenderTransformer.java b/core/src/main/java/com/seibel/lod/core/dataObjects/transformers/DataRenderTransformer.java index 5a2600a05..6ae445e43 100644 --- a/core/src/main/java/com/seibel/lod/core/dataObjects/transformers/DataRenderTransformer.java +++ b/core/src/main/java/com/seibel/lod/core/dataObjects/transformers/DataRenderTransformer.java @@ -87,7 +87,7 @@ public class DataRenderTransformer setThreadPoolSize(Config.Client.Advanced.MultiThreading.numberOfDataConverterThreads.get()); } } - public static void setThreadPoolSize(int threadPoolSize) { transformerThreadPool = ThreadUtil.makeThreadPool(threadPoolSize, "Data/Render Transformer"); } + public static void setThreadPoolSize(int threadPoolSize) { transformerThreadPool = ThreadUtil.makeThreadPool(threadPoolSize, "Full/Render Data Transformer"); } /** * Stops any executing tasks and destroys the executor.
diff --git a/core/src/main/java/com/seibel/lod/core/file/renderfile/RenderSourceFileHandler.java b/core/src/main/java/com/seibel/lod/core/file/renderfile/RenderSourceFileHandler.java index 9ca359e9b..fccd6c0e2 100644 --- a/core/src/main/java/com/seibel/lod/core/file/renderfile/RenderSourceFileHandler.java +++ b/core/src/main/java/com/seibel/lod/core/file/renderfile/RenderSourceFileHandler.java @@ -32,7 +32,7 @@ public class RenderSourceFileHandler implements ILodRenderSourceProvider private static final Logger LOGGER = DhLoggerBuilder.getLogger(); - private final ExecutorService renderCacheThread = ThreadUtil.makeSingleThreadPool("RenderCacheThread"); + private final ExecutorService fileHandlerThreadPool = ThreadUtil.makeSingleThreadPool("Render Source File Handler"); private final ConcurrentHashMap filesBySectionPos = new ConcurrentHashMap<>(); private final IDhClientLevel level; @@ -160,7 +160,7 @@ public class RenderSourceFileHandler implements ILodRenderSourceProvider public CompletableFuture readAsync(DhSectionPos pos) { // don't continue if the handler has been shut down - if (this.renderCacheThread.isTerminated()) + if (this.fileHandlerThreadPool.isTerminated()) { return CompletableFuture.completedFuture(null); } @@ -205,7 +205,7 @@ public class RenderSourceFileHandler implements ILodRenderSourceProvider } } - return metaFile.loadOrGetCachedDataSourceAsync(this.renderCacheThread, this.level).handle( + return metaFile.loadOrGetCachedDataSourceAsync(this.fileHandlerThreadPool, this.level).handle( (renderSource, exception) -> { if (exception != null) @@ -289,7 +289,7 @@ public class RenderSourceFileHandler implements ILodRenderSourceProvider ArrayList> futures = new ArrayList<>(); for (RenderMetaDataFile metaFile : this.filesBySectionPos.values()) { - futures.add(metaFile.flushAndSave(this.renderCacheThread)); + futures.add(metaFile.flushAndSave(this.fileHandlerThreadPool)); } return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])) @@ -423,7 +423,7 @@ public class RenderSourceFileHandler implements ILodRenderSourceProvider ArrayList> futures = new ArrayList<>(); for (RenderMetaDataFile metaFile : this.filesBySectionPos.values()) { - futures.add(metaFile.flushAndSave(this.renderCacheThread)); + futures.add(metaFile.flushAndSave(this.fileHandlerThreadPool)); } CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join(); } diff --git a/core/src/main/java/com/seibel/lod/core/file/subDimMatching/SubDimensionLevelMatcher.java b/core/src/main/java/com/seibel/lod/core/file/subDimMatching/SubDimensionLevelMatcher.java index 7cdfe3146..95d94c92c 100644 --- a/core/src/main/java/com/seibel/lod/core/file/subDimMatching/SubDimensionLevelMatcher.java +++ b/core/src/main/java/com/seibel/lod/core/file/subDimMatching/SubDimensionLevelMatcher.java @@ -44,7 +44,7 @@ public class SubDimensionLevelMatcher implements AutoCloseable public static final ConfigBasedLogger LOGGER = new ConfigBasedLogger(LogManager.getLogger(), () -> Config.Client.Advanced.Logging.logFileSubDimEvent.get()); - private final ExecutorService matcherThread = ThreadUtil.makeSingleThreadPool("Level-To-File-Matcher"); + private final ExecutorService matcherThread = ThreadUtil.makeSingleThreadPool("Sub Dimension Matcher"); private SubDimensionPlayerData playerData = null; private SubDimensionPlayerData firstSeenPlayerData = null; diff --git a/core/src/main/java/com/seibel/lod/core/render/glObject/GLProxy.java b/core/src/main/java/com/seibel/lod/core/render/glObject/GLProxy.java index c241a6f18..1fe2f8712 100644 --- a/core/src/main/java/com/seibel/lod/core/render/glObject/GLProxy.java +++ b/core/src/main/java/com/seibel/lod/core/render/glObject/GLProxy.java @@ -28,6 +28,7 @@ import java.util.concurrent.TimeUnit; import com.seibel.lod.core.config.Config; import com.seibel.lod.core.logging.ConfigBasedLogger; import com.seibel.lod.core.logging.DhLoggerBuilder; +import com.seibel.lod.core.util.ThreadUtil; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.lwjgl.glfw.GLFW; @@ -69,7 +70,7 @@ public class GLProxy private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); - private ExecutorService workerThread = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat(GLProxy.class.getSimpleName() + "-Worker-Thread").build()); + private ExecutorService workerThread = ThreadUtil.makeSingleThreadPool("GL Proxy Worker"); private static final Logger LOGGER = DhLoggerBuilder.getLogger(MethodHandles.lookup().lookupClass().getSimpleName()); public static final ConfigBasedLogger GL_LOGGER = new ConfigBasedLogger(LogManager.getLogger(GLProxy.class), diff --git a/core/src/main/java/com/seibel/lod/core/world/DhClientServerWorld.java b/core/src/main/java/com/seibel/lod/core/world/DhClientServerWorld.java index 676e00faf..02acc8083 100644 --- a/core/src/main/java/com/seibel/lod/core/world/DhClientServerWorld.java +++ b/core/src/main/java/com/seibel/lod/core/world/DhClientServerWorld.java @@ -23,7 +23,8 @@ public class DhClientServerWorld extends AbstractDhWorld implements IDhClientWor private final HashSet dhLevels; public final LocalSaveStructure saveStructure; - public ExecutorService dhTickerThread = ThreadUtil.makeSingleThreadPool("DHTickerThread", 2); + // TODO why does this executor have 2 threads? + public ExecutorService dhTickerThread = ThreadUtil.makeSingleThreadPool("DH Client Server World Ticker Thread", 2); public EventLoop eventLoop = new EventLoop(this.dhTickerThread, this::_clientTick); //TODO: Rate-limit the loop public F3Screen.DynamicMessage f3Message; diff --git a/core/src/main/java/com/seibel/lod/core/world/DhClientWorld.java b/core/src/main/java/com/seibel/lod/core/world/DhClientWorld.java index 556467ab4..e62a3ea6f 100644 --- a/core/src/main/java/com/seibel/lod/core/world/DhClientWorld.java +++ b/core/src/main/java/com/seibel/lod/core/world/DhClientWorld.java @@ -22,7 +22,8 @@ public class DhClientWorld extends AbstractDhWorld implements IDhClientWorld private final HashMap levels; public final ClientOnlySaveStructure saveStructure; - public ExecutorService dhTickerThread = ThreadUtil.makeSingleThreadPool("DHTickerThread", 2); + // TODO why does this executor have 2 threads? + public ExecutorService dhTickerThread = ThreadUtil.makeSingleThreadPool("DH Client World Ticker Thread", 2); public EventLoop eventLoop = new EventLoop(this.dhTickerThread, this::_clientTick); From d502fd4daa8e32e737849159cdd003ed2b2544af Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 14 Jun 2023 19:42:34 -0500 Subject: [PATCH 2/4] Add a thread config for ChunkToLodBuilder --- .../com/seibel/lod/core/config/Config.java | 13 + .../ThreadPresetConfigEventHandler.java | 10 + .../transformers/ChunkToLodBuilder.java | 265 +++++++++++------- .../lod/core/level/AbstractDhClientLevel.java | 2 +- .../main/resources/assets/lod/lang/en_us.json | 14 +- 5 files changed, 204 insertions(+), 100 deletions(-) diff --git a/core/src/main/java/com/seibel/lod/core/config/Config.java b/core/src/main/java/com/seibel/lod/core/config/Config.java index 88981d2ed..581b5761c 100644 --- a/core/src/main/java/com/seibel/lod/core/config/Config.java +++ b/core/src/main/java/com/seibel/lod/core/config/Config.java @@ -805,6 +805,19 @@ public class Config + THREAD_NOTE) .build(); + public static final ConfigEntry numberOfChunkLodConverterThreads = new ConfigEntry.Builder() + .setMinDefaultMax(1, + Runtime.getRuntime().availableProcessors()/16, + Runtime.getRuntime().availableProcessors()) + .comment("" + + "How many threads should be used to convert Minecraft chunks into LOD data? \n" + + "\n" + + "These threads run both when terrain is generated and when\n" + + "chunks are loaded, unloaded, and modified. \n" + + "\n" + + THREAD_NOTE) + .build(); + } public static class GpuBuffers diff --git a/core/src/main/java/com/seibel/lod/core/config/eventHandlers/presets/ThreadPresetConfigEventHandler.java b/core/src/main/java/com/seibel/lod/core/config/eventHandlers/presets/ThreadPresetConfigEventHandler.java index 91816b57e..7946f9309 100644 --- a/core/src/main/java/com/seibel/lod/core/config/eventHandlers/presets/ThreadPresetConfigEventHandler.java +++ b/core/src/main/java/com/seibel/lod/core/config/eventHandlers/presets/ThreadPresetConfigEventHandler.java @@ -55,6 +55,15 @@ public class ThreadPresetConfigEventHandler extends AbstractPresetConfigEventHan this.put(EThreadPreset.AGGRESSIVE, getThreadCountByPercent(0.2)); this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, getThreadCountByPercent(1.0)); }}); + private final ConfigEntryWithPresetOptions chunkLodConverters = new ConfigEntryWithPresetOptions<>(Config.Client.Advanced.MultiThreading.numberOfChunkLodConverterThreads, + new HashMap() + {{ + this.put(EThreadPreset.MINIMAL_IMPACT, 1); + this.put(EThreadPreset.LOW_IMPACT, getThreadCountByPercent(0.1)); + this.put(EThreadPreset.BALANCED, getThreadCountByPercent(0.2)); + this.put(EThreadPreset.AGGRESSIVE, getThreadCountByPercent(0.4)); + this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, getThreadCountByPercent(1.0)); + }}); @@ -70,6 +79,7 @@ public class ThreadPresetConfigEventHandler extends AbstractPresetConfigEventHan this.configList.add(this.bufferBuilders); this.configList.add(this.fileHandlers); this.configList.add(this.dataConverters); + this.configList.add(this.chunkLodConverters); for (ConfigEntryWithPresetOptions config : this.configList) diff --git a/core/src/main/java/com/seibel/lod/core/dataObjects/transformers/ChunkToLodBuilder.java b/core/src/main/java/com/seibel/lod/core/dataObjects/transformers/ChunkToLodBuilder.java index 833171c60..b9680e169 100644 --- a/core/src/main/java/com/seibel/lod/core/dataObjects/transformers/ChunkToLodBuilder.java +++ b/core/src/main/java/com/seibel/lod/core/dataObjects/transformers/ChunkToLodBuilder.java @@ -1,8 +1,11 @@ package com.seibel.lod.core.dataObjects.transformers; +import java.io.Closeable; +import java.io.IOException; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; +import com.seibel.lod.core.config.listeners.ConfigChangeListener; import com.seibel.lod.core.dataObjects.fullData.accessor.ChunkSizedFullDataAccessor; import com.seibel.lod.core.config.Config; import com.seibel.lod.core.logging.ConfigBasedLogger; @@ -13,66 +16,65 @@ import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; import com.seibel.lod.core.dependencyInjection.SingletonInjector; import org.apache.logging.log4j.LogManager; -//FIXME: To-Be-Used class -public class ChunkToLodBuilder +public class ChunkToLodBuilder implements AutoCloseable { - public static final ConfigBasedLogger LOGGER = new ConfigBasedLogger(LogManager.getLogger(), () -> Config.Client.Advanced.Logging.logLodBuilderEvent.get()); + public static final ConfigBasedLogger LOGGER = new ConfigBasedLogger(LogManager.getLogger(), () -> Config.Client.Advanced.Logging.logLodBuilderEvent.get()); private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); - public static final long MAX_TICK_TIME_NS = 1000000000L / 20L; - public static final int THREAD_COUNT = 1; + public static final long MAX_TICK_TIME_NS = 1000000000L / 20L; - private static class Task + + private final ConcurrentHashMap latestChunkToBuild = new ConcurrentHashMap<>(); + private final ConcurrentLinkedDeque taskToBuild = new ConcurrentLinkedDeque<>(); + private final AtomicInteger runningCount = new AtomicInteger(0); + + private int threadCount = -1; + private ExecutorService executorThreadPool = null; + private ConfigChangeListener configListener; + + + + //==============// + // constructors // + //==============// + + public ChunkToLodBuilder() { this.setupExecutorService(); } + + + + //=================// + // data generation // + //=================// + + public CompletableFuture tryGenerateData(IChunkWrapper chunkWrapper) { - final DhChunkPos chunkPos; - final CompletableFuture future; - - Task(DhChunkPos chunkPos, CompletableFuture future) - { - this.chunkPos = chunkPos; - this.future = future; - } - } - private final ConcurrentHashMap latestChunkToBuild = new ConcurrentHashMap<>(); - private final ConcurrentLinkedDeque taskToBuild = new ConcurrentLinkedDeque<>(); - private final ExecutorService executor = ThreadUtil.makeThreadPool(THREAD_COUNT, ChunkToLodBuilder.class); - private final AtomicInteger runningCount = new AtomicInteger(0); - - - - public ChunkToLodBuilder() { } - - - - public CompletableFuture tryGenerateData(IChunkWrapper chunkWrapper) - { - if (chunkWrapper == null) + if (chunkWrapper == null) { throw new NullPointerException("ChunkWrapper cannot be null!"); } - IChunkWrapper oldChunk = this.latestChunkToBuild.put(chunkWrapper.getChunkPos(), chunkWrapper); // an Exchange operation - // If there's old chunk, that means we just replaced an unprocessed old request on generating data on this pos. - // if so, we can just return null to signal this, as the old request's future will instead be the proper one - // that will return the latest generated data. - if (oldChunk != null) + IChunkWrapper oldChunk = this.latestChunkToBuild.put(chunkWrapper.getChunkPos(), chunkWrapper); // an Exchange operation + // If there's old chunk, that means we just replaced an unprocessed old request on generating data on this pos. + // if so, we can just return null to signal this, as the old request's future will instead be the proper one + // that will return the latest generated data. + if (oldChunk != null) { return null; } - // Otherwise, it means we're the first to do so. Let's submit our task to this entry. - CompletableFuture future = new CompletableFuture<>(); + // Otherwise, it means we're the first to do so. Let's submit our task to this entry. + CompletableFuture future = new CompletableFuture<>(); this.taskToBuild.addLast(new Task(chunkWrapper.getChunkPos(), future)); - return future; - } + return future; + } - public void tick() + public void tick() { - if (this.runningCount.get() >= THREAD_COUNT) + if (this.runningCount.get() >= this.threadCount) { return; } - else if (this.taskToBuild.isEmpty()) + else if (this.taskToBuild.isEmpty()) { return; } @@ -86,95 +88,94 @@ public class ChunkToLodBuilder } - for (int i = 0; i + CompletableFuture.runAsync(() -> { - try + try { - _tick(); - } + this._tick(); + } finally { this.runningCount.decrementAndGet(); - } - }, this.executor); - } - } - private void _tick() + } + }, this.executorThreadPool); + } + } + private void _tick() { - long time = System.nanoTime(); - int count = 0; - boolean allDone = false; - while (true) + long time = System.nanoTime(); + int count = 0; + boolean allDone = false; + while (true) { // run until we either run out of time, or all tasks are complete - if (System.nanoTime() - time > MAX_TICK_TIME_NS && !this.taskToBuild.isEmpty()) + if (System.nanoTime() - time > MAX_TICK_TIME_NS && !this.taskToBuild.isEmpty()) { break; } - Task task = this.taskToBuild.pollFirst(); - if (task == null) + Task task = this.taskToBuild.pollFirst(); + if (task == null) { - allDone = true; - break; - } + allDone = true; + break; + } - count++; - IChunkWrapper latestChunk = this.latestChunkToBuild.remove(task.chunkPos); // Basically an Exchange operation - if (latestChunk == null) + count++; + IChunkWrapper latestChunk = this.latestChunkToBuild.remove(task.chunkPos); // Basically an Exchange operation + if (latestChunk == null) { - LOGGER.error("Somehow Task at "+task.chunkPos+" has latestChunk as null. Skipping task."); - task.future.complete(null); - continue; - } + LOGGER.error("Somehow Task at "+task.chunkPos+" has latestChunk as null. Skipping task."); + task.future.complete(null); + continue; + } - try + try { - if (LodDataBuilder.canGenerateLodFromChunk(latestChunk)) + if (LodDataBuilder.canGenerateLodFromChunk(latestChunk)) { - ChunkSizedFullDataAccessor data = LodDataBuilder.createChunkData(latestChunk); - if (data != null) + ChunkSizedFullDataAccessor data = LodDataBuilder.createChunkData(latestChunk); + if (data != null) { - task.future.complete(data); - continue; - } - } - } + task.future.complete(data); + continue; + } + } + } catch (Exception ex) { - LOGGER.error("Error while processing Task at "+task.chunkPos, ex); - } + LOGGER.error("Error while processing Task at "+task.chunkPos, ex); + } - // Failed to build due to chunk not meeting requirement. - IChunkWrapper casChunk = this.latestChunkToBuild.putIfAbsent(task.chunkPos, latestChunk); // CAS operation with expected=null - if (casChunk == null || latestChunk.isStillValid()) // That means CAS have been successful + // Failed to build due to chunk not meeting requirement. + IChunkWrapper casChunk = this.latestChunkToBuild.putIfAbsent(task.chunkPos, latestChunk); // CAS operation with expected=null + if (casChunk == null || latestChunk.isStillValid()) // That means CAS have been successful { this.taskToBuild.addLast(task); // Then add back the same old task. } - else // Else, it means someone managed to sneak in a new gen request in this pos. Then lets drop this old task. + else // Else, it means someone managed to sneak in a new gen request in this pos. Then lets drop this old task. { task.future.complete(null); } - count--; - } + count--; + } - long time2 = System.nanoTime(); - if (!allDone) + long time2 = System.nanoTime(); + if (!allDone) { - //LOGGER.info("Completed {} tasks in {} in this tick", count, Duration.ofNanos(time2 - time)); - } + //LOGGER.info("Completed {} tasks in {} in this tick", count, Duration.ofNanos(time2 - time)); + } else if (count > 0) { - //LOGGER.info("Completed all {} tasks in {}", count, Duration.ofNanos(time2 - time)); - } - } + //LOGGER.info("Completed all {} tasks in {}", count, Duration.ofNanos(time2 - time)); + } + } - - /** + /** * should be called whenever changing levels/worlds * to prevent trying to generate LODs for chunk(s) that are no longer loaded * (which can cause exceptions) @@ -185,4 +186,80 @@ public class ChunkToLodBuilder this.latestChunkToBuild.clear(); } + + + //==========================// + // executor handler methods // + //==========================// + + /** + * Creates a new executor.
+ * Does nothing if an executor already exists. + */ + public void setupExecutorService() + { + // static setup + if (this.configListener == null) + { + this.configListener = new ConfigChangeListener<>(Config.Client.Advanced.MultiThreading.numberOfChunkLodConverterThreads, (threadCount) -> { this.setThreadPoolSize(threadCount); }); + } + + + if (this.executorThreadPool == null || this.executorThreadPool.isTerminated()) + { + LOGGER.info("Starting "+ChunkToLodBuilder.class.getSimpleName()); + this.setThreadPoolSize(Config.Client.Advanced.MultiThreading.numberOfChunkLodConverterThreads.get()); + } + } + public void setThreadPoolSize(int threadPoolSize) + { + this.threadCount = threadPoolSize; + this.executorThreadPool = ThreadUtil.makeThreadPool(threadPoolSize, ChunkToLodBuilder.class); + } + + /** + * Stops any executing tasks and destroys the executor.
+ * Does nothing if the executor isn't running. + */ + public void shutdownExecutorService() + { + if (this.executorThreadPool != null) + { + LOGGER.info("Stopping "+ChunkToLodBuilder.class.getSimpleName()); + this.executorThreadPool.shutdownNow(); + } + } + + + + //==============// + // base methods // + //==============// + + @Override + public void close() + { + this.shutdownExecutorService(); + this.clearCurrentTasks(); + } + + + + //================// + // helper classes // + //================// + + private static class Task + { + final DhChunkPos chunkPos; + final CompletableFuture future; + + Task(DhChunkPos chunkPos, CompletableFuture future) + { + this.chunkPos = chunkPos; + this.future = future; + } + } + } + diff --git a/core/src/main/java/com/seibel/lod/core/level/AbstractDhClientLevel.java b/core/src/main/java/com/seibel/lod/core/level/AbstractDhClientLevel.java index fb344f714..4ca81efc5 100644 --- a/core/src/main/java/com/seibel/lod/core/level/AbstractDhClientLevel.java +++ b/core/src/main/java/com/seibel/lod/core/level/AbstractDhClientLevel.java @@ -218,7 +218,7 @@ public abstract class AbstractDhClientLevel implements IDhClientLevel this.fullDataFileHandler.close(); // clear the chunk builder to prevent generating LODs for chunks that are unloaded - this.chunkToLodBuilder.clearCurrentTasks(); + this.chunkToLodBuilder.close(); // shutdown the renderer diff --git a/core/src/main/resources/assets/lod/lang/en_us.json b/core/src/main/resources/assets/lod/lang/en_us.json index 8259312af..fd591999b 100644 --- a/core/src/main/resources/assets/lod/lang/en_us.json +++ b/core/src/main/resources/assets/lod/lang/en_us.json @@ -308,15 +308,19 @@ "lod.config.client.advanced.multiThreading.numberOfBufferBuilderThreads": "NO. of buffer builder threads", "lod.config.client.advanced.multiThreading.numberOfBufferBuilderThreads.@tooltip": - "The number of threads used when building geometry data.\nCan only be between 1 and your CPU's processor count.", + "The number of threads used when building geometry data. \nCan only be between 1 and your CPU's processor count.", "lod.config.client.advanced.multiThreading.numberOfFileHandlerThreads": - "NO. of file handler threads", + "NO. of file handler threads", "lod.config.client.advanced.multiThreading.numberOfFileHandlerThreads.@tooltip": - "The number of threads used when building vertex buffers\n(The things sent to your GPU to draw the LODs).\nCan only be between 1 and your CPU's processor count.", + "The number of threads used when building vertex buffers \n(The things sent to your GPU to draw the LODs). \nCan only be between 1 and your CPU's processor count.", "lod.config.client.advanced.multiThreading.numberOfDataConverterThreads": - "NO. of data converter threads", + "NO. of data converter threads", "lod.config.client.advanced.multiThreading.numberOfDataConverterThreads.@tooltip": - "The number of threads used when converting ID data to render-able data.\n(This generally happens when generating new terrain or changing graphics settings).\nCan only be between 1 and your CPU's processor count.", + "The number of threads used when converting ID data to render-able data. \n(This generally happens when generating new terrain or changing graphics settings). \nCan only be between 1 and your CPU's processor count.", + "lod.config.client.advanced.multiThreading.numberOfChunkLodConverterThreads": + "NO. of chunk LOD converter threads", + "lod.config.client.advanced.multiThreading.numberOfChunkLodConverterThreads.@tooltip": + "How many threads should be used to convert Minecraft chunks into LOD data? \nThese threads run both when terrain is generated and when \nchunks are loaded, unloaded, and modified.", From 6db6c6998391d7928cbaab6a7258c88303a8f562 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 14 Jun 2023 20:17:43 -0500 Subject: [PATCH 3/4] Add LZ4 to the readme --- Readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 0f95324ff..ba593171f 100644 --- a/Readme.md +++ b/Readme.md @@ -14,8 +14,8 @@ It should be automatically included when pulling the full mod. ## Open Source Acknowledgements -XZ for Java (data compression)\ -https://tukaani.org/xz/java.html +LZ4 for Java (data compression)\ +https://github.com/lz4/lz4-java Json & Toml for Java (config handling)\ https://github.com/TheElectronWill/night-config From 6832d21a3b42e5a7b8e84a3c213c81ce155a5ed2 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 14 Jun 2023 21:32:10 -0500 Subject: [PATCH 4/4] config renaming and add new configs to DhApi --- ...ion.java => EMaxHorizontalResolution.java} | 24 ++-- .../{EDebugMode.java => EDebugRendering.java} | 6 +- .../api/interfaces/config/IDhApiConfig.java | 25 ++-- .../both/IDhApiWorldGenerationConfig.java | 33 +---- .../config/client/IDhApiDebuggingConfig.java | 15 +- .../config/client/IDhApiFarFogConfig.java | 70 +++++++++ .../config/client/IDhApiFogConfig.java | 58 ++++++++ ...onfig.java => IDhApiGpuBuffersConfig.java} | 8 +- .../config/client/IDhApiGraphicsConfig.java | 63 +++++--- .../client/IDhApiGraphicsFogConfig.java | 130 ----------------- .../config/client/IDhApiHeightFogConfig.java | 71 +++++++++ .../config/client/IDhApiLoggingConfig.java | 37 +++++ ...g.java => IDhApiMultiThreadingConfig.java} | 23 +-- .../client/IDhApiMultiplayerConfig.java | 6 +- .../client/IDhApiNoiseTextureConfig.java | 53 +++++++ .../external/methods/config/DhApiConfig.java | 35 ++--- .../config/client/DhApiDebuggingConfig.java | 25 ++-- .../config/client/DhApiFarFogConfig.java | 61 ++++++++ .../methods/config/client/DhApiFogConfig.java | 67 +++++++++ ...Config.java => DhApiGpuBuffersConfig.java} | 18 +-- .../config/client/DhApiGraphicsConfig.java | 97 ++++++++----- .../config/client/DhApiGraphicsFogConfig.java | 136 ------------------ .../config/client/DhApiHeightFogConfig.java | 72 ++++++++++ .../client/DhApiMultiThreadingConfig.java | 55 +++++++ .../config/client/DhApiMultiplayerConfig.java | 14 +- ...nfig.java => DhApiNoiseTextureConfig.java} | 32 ++--- .../DhApiWorldGenerationConfig.java | 21 ++- .../lod/core/api/internal/ClientApi.java | 6 +- .../com/seibel/lod/core/config/Config.java | 77 ++++------ .../RenderCacheConfigEventHandler.java | 6 +- ...RenderQualityPresetConfigEventHandler.java | 16 +-- .../ColumnRenderBufferBuilder.java | 4 +- .../bufferBuilding/CubicLodTemplate.java | 4 +- .../structure/ClientOnlySaveStructure.java | 2 +- .../file/subDimMatching/SubDimCompare.java | 2 +- .../seibel/lod/core/render/LodQuadTree.java | 2 +- .../lod/core/render/fog/LodFogConfig.java | 8 +- .../lod/core/render/renderer/LodRenderer.java | 6 +- .../main/resources/assets/lod/lang/en_us.json | 59 ++++---- 39 files changed, 853 insertions(+), 594 deletions(-) rename api/src/main/java/com/seibel/lod/api/enums/config/{EHorizontalResolution.java => EMaxHorizontalResolution.java} (81%) rename api/src/main/java/com/seibel/lod/api/enums/rendering/{EDebugMode.java => EDebugRendering.java} (93%) create mode 100644 api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiFarFogConfig.java create mode 100644 api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiFogConfig.java rename api/src/main/java/com/seibel/lod/api/interfaces/config/client/{IDhApiBuffersConfig.java => IDhApiGpuBuffersConfig.java} (86%) delete mode 100644 api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiGraphicsFogConfig.java create mode 100644 api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiHeightFogConfig.java create mode 100644 api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiLoggingConfig.java rename api/src/main/java/com/seibel/lod/api/interfaces/config/client/{IDhApiThreadingConfig.java => IDhApiMultiThreadingConfig.java} (78%) create mode 100644 api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiNoiseTextureConfig.java create mode 100644 core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiFarFogConfig.java create mode 100644 core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiFogConfig.java rename core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/{DhApiBuffersConfig.java => DhApiGpuBuffersConfig.java} (73%) delete mode 100644 core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiGraphicsFogConfig.java create mode 100644 core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiHeightFogConfig.java create mode 100644 core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiMultiThreadingConfig.java rename core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/{DhApiThreadingConfig.java => DhApiNoiseTextureConfig.java} (51%) rename core/src/main/java/com/seibel/lod/core/api/external/methods/config/{both => common}/DhApiWorldGenerationConfig.java (72%) diff --git a/api/src/main/java/com/seibel/lod/api/enums/config/EHorizontalResolution.java b/api/src/main/java/com/seibel/lod/api/enums/config/EMaxHorizontalResolution.java similarity index 81% rename from api/src/main/java/com/seibel/lod/api/enums/config/EHorizontalResolution.java rename to api/src/main/java/com/seibel/lod/api/enums/config/EMaxHorizontalResolution.java index 61fc5df70..7e5696cbb 100644 --- a/api/src/main/java/com/seibel/lod/api/enums/config/EHorizontalResolution.java +++ b/api/src/main/java/com/seibel/lod/api/enums/config/EMaxHorizontalResolution.java @@ -33,9 +33,9 @@ import com.seibel.lod.coreapi.util.MathUtil; * * @author James Seibel * @author Leonardo Amato - * @version 2022-7-5 + * @version 2023-6-14 */ -public enum EHorizontalResolution +public enum EMaxHorizontalResolution { /** render 256 LODs for each chunk */ BLOCK(16, 0), @@ -83,12 +83,12 @@ public enum EHorizontalResolution * 2nd dimension: An array of all LodDetails that are less than or
* equal to that detailLevel */ - private static EHorizontalResolution[][] lowerDetailArrays; + private static EMaxHorizontalResolution[][] lowerDetailArrays; - EHorizontalResolution(int newLengthCount, int newDetailLevel) + EMaxHorizontalResolution(int newLengthCount, int newDetailLevel) { this.detailLevel = (byte) newDetailLevel; this.dataPointLengthCount = newLengthCount; @@ -128,20 +128,20 @@ public enum EHorizontalResolution * Returns an array of all LodDetails that have a detail level * that is less than or equal to the given LodDetail */ - public static EHorizontalResolution[] getSelfAndLowerDetails(EHorizontalResolution detail) + public static EMaxHorizontalResolution[] getSelfAndLowerDetails(EMaxHorizontalResolution detail) { if (lowerDetailArrays == null) { // run first time setup - lowerDetailArrays = new EHorizontalResolution[EHorizontalResolution.values().length][]; + lowerDetailArrays = new EMaxHorizontalResolution[EMaxHorizontalResolution.values().length][]; // go through each LodDetail - for (EHorizontalResolution currentDetail : EHorizontalResolution.values()) + for (EMaxHorizontalResolution currentDetail : EMaxHorizontalResolution.values()) { - ArrayList lowerDetails = new ArrayList<>(); + ArrayList lowerDetails = new ArrayList<>(); // find the details lower than currentDetail - for (EHorizontalResolution compareDetail : EHorizontalResolution.values()) + for (EMaxHorizontalResolution compareDetail : EMaxHorizontalResolution.values()) { if (currentDetail.detailLevel <= compareDetail.detailLevel) { @@ -153,7 +153,7 @@ public enum EHorizontalResolution Collections.sort(lowerDetails); Collections.reverse(lowerDetails); - lowerDetailArrays[currentDetail.detailLevel] = lowerDetails.toArray(new EHorizontalResolution[lowerDetails.size()]); + lowerDetailArrays[currentDetail.detailLevel] = lowerDetails.toArray(new EMaxHorizontalResolution[lowerDetails.size()]); } } @@ -161,9 +161,9 @@ public enum EHorizontalResolution } /** Returns what detail level should be used at a given distance and maxDistance. */ - public static EHorizontalResolution getDetailForDistance(EHorizontalResolution maxDetailLevel, int distance, int maxDistance) + public static EMaxHorizontalResolution getDetailForDistance(EMaxHorizontalResolution maxDetailLevel, int distance, int maxDistance) { - EHorizontalResolution[] lowerDetails = getSelfAndLowerDetails(maxDetailLevel); + EMaxHorizontalResolution[] lowerDetails = getSelfAndLowerDetails(maxDetailLevel); int distanceBetweenDetails = maxDistance / lowerDetails.length; int index = MathUtil.clamp(0, distance / distanceBetweenDetails, lowerDetails.length - 1); diff --git a/api/src/main/java/com/seibel/lod/api/enums/rendering/EDebugMode.java b/api/src/main/java/com/seibel/lod/api/enums/rendering/EDebugRendering.java similarity index 93% rename from api/src/main/java/com/seibel/lod/api/enums/rendering/EDebugMode.java rename to api/src/main/java/com/seibel/lod/api/enums/rendering/EDebugRendering.java index cfae31adb..31bb51557 100644 --- a/api/src/main/java/com/seibel/lod/api/enums/rendering/EDebugMode.java +++ b/api/src/main/java/com/seibel/lod/api/enums/rendering/EDebugRendering.java @@ -30,7 +30,7 @@ package com.seibel.lod.api.enums.rendering; * @author James Seibel * @version 2023-6-7 */ -public enum EDebugMode +public enum EDebugRendering { // Reminder: // when adding items up the API minor version @@ -53,7 +53,7 @@ public enum EDebugMode SHOW_RENDER_SOURCE_FLAG; - public static EDebugMode next(EDebugMode type) + public static EDebugRendering next(EDebugRendering type) { switch (type) { @@ -65,7 +65,7 @@ public enum EDebugMode } } - public static EDebugMode previous(EDebugMode type) + public static EDebugRendering previous(EDebugRendering type) { switch (type) { diff --git a/api/src/main/java/com/seibel/lod/api/interfaces/config/IDhApiConfig.java b/api/src/main/java/com/seibel/lod/api/interfaces/config/IDhApiConfig.java index b4859341b..27539682f 100644 --- a/api/src/main/java/com/seibel/lod/api/interfaces/config/IDhApiConfig.java +++ b/api/src/main/java/com/seibel/lod/api/interfaces/config/IDhApiConfig.java @@ -1,25 +1,24 @@ package com.seibel.lod.api.interfaces.config; import com.seibel.lod.api.interfaces.config.both.IDhApiWorldGenerationConfig; -import com.seibel.lod.api.interfaces.config.client.IDhApiBuffersConfig; -import com.seibel.lod.api.interfaces.config.client.IDhApiGraphicsConfig; -import com.seibel.lod.api.interfaces.config.client.IDhApiMultiplayerConfig; -import com.seibel.lod.api.interfaces.config.client.IDhApiThreadingConfig; +import com.seibel.lod.api.interfaces.config.client.*; /** - * This interfaces holds all of the config groups - * the API has access to for easy access to all config values. + * This interfaces holds all config groups + * the API has access to for easy access. * * @author James Seibel - * @version 9-15-2022 + * @version 2023-6-14 */ public interface IDhApiConfig { - - IDhApiWorldGenerationConfig getWorldGeneratorConfig(); - IDhApiBuffersConfig getBufferConfig(); - IDhApiGraphicsConfig getGraphicsConfig(); - IDhApiMultiplayerConfig getMultiplayerConfig(); - IDhApiThreadingConfig getThreadingConfig(); + IDhApiGraphicsConfig graphics(); + IDhApiWorldGenerationConfig worldGenerator(); + IDhApiMultiplayerConfig multiplayer(); + IDhApiMultiThreadingConfig multiThreading(); + IDhApiGpuBuffersConfig gpuBuffers(); + // note: DON'T add the Auto Updater to this API. We only want the user's to have the ability to control when things are downloaded to their machines. + //IDhApiLoggingConfig logging(); // TODO implement + IDhApiDebuggingConfig debugging(); } diff --git a/api/src/main/java/com/seibel/lod/api/interfaces/config/both/IDhApiWorldGenerationConfig.java b/api/src/main/java/com/seibel/lod/api/interfaces/config/both/IDhApiWorldGenerationConfig.java index e9f8b51c6..1b68033c5 100644 --- a/api/src/main/java/com/seibel/lod/api/interfaces/config/both/IDhApiWorldGenerationConfig.java +++ b/api/src/main/java/com/seibel/lod/api/interfaces/config/both/IDhApiWorldGenerationConfig.java @@ -19,11 +19,9 @@ package com.seibel.lod.api.interfaces.config.both; -import com.seibel.lod.api.enums.config.EBlocksToAvoid; -import com.seibel.lod.api.enums.worldGeneration.EDhApiDistantGeneratorMode; -import com.seibel.lod.api.enums.config.EGenerationPriority; -import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; import com.seibel.lod.api.enums.config.ELightGenerationMode; +import com.seibel.lod.api.enums.worldGeneration.EDhApiDistantGeneratorMode; +import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup; /** @@ -41,31 +39,14 @@ public interface IDhApiWorldGenerationConfig extends IDhApiConfigGroup * Defines whether fake chunks will be generated * outside Minecraft's vanilla render distance. */ - IDhApiConfigValue getEnableDistantWorldGeneration(); + IDhApiConfigValue enableDistantWorldGeneration(); /** Defines to what level fake chunks will be generated. */ - IDhApiConfigValue getDistantGeneratorMode(); + IDhApiConfigValue distantGeneratorMode(); - /** - * Defines what blocks will be ignored when generating LODs.

- * - * TODO if this isn't deprecated before 1.7 it should probably be moved to the graphics tab - * @deprecated this method won't be needed once we transition to an ID based save system
- * (vs the color based system we have currently) + /** + * TODO */ - @Deprecated - IDhApiConfigValue getBlocksToAvoid(); - - /** - * Defines if the color of avoided blocks will color the block below them.
- * (IE: if flowers are avoided should they color the grass below them?) - * - * TODO if this isn't deprecated before 1.7 it should probably be moved to the graphics tab - * @deprecated this method won't be needed once we transition to an ID based save system
- * (vs the color based system we have currently) - */ - @Deprecated - IDhApiConfigValue getTintWithAvoidedBlocks(); - + IDhApiConfigValue lightingEngine(); } diff --git a/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiDebuggingConfig.java b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiDebuggingConfig.java index 79f14a445..e1b103dec 100644 --- a/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiDebuggingConfig.java +++ b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiDebuggingConfig.java @@ -19,7 +19,7 @@ package com.seibel.lod.api.interfaces.config.client; -import com.seibel.lod.api.enums.rendering.EDebugMode; +import com.seibel.lod.api.enums.rendering.EDebugRendering; import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup; @@ -32,10 +32,19 @@ import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup; public interface IDhApiDebuggingConfig extends IDhApiConfigGroup { /** Can be used to debug the standard fake chunk rendering. */ - IDhApiConfigValue getDebugRenderMode(); + IDhApiConfigValue debugRendering(); /** If enabled debug keybindings can be used. */ - IDhApiConfigValue getEnableDebugKeybindings(); + IDhApiConfigValue debugKeybindings(); + + /** TODO */ + IDhApiConfigValue renderWireframe(); + + /** TODO */ + IDhApiConfigValue lodOnlyMode(); + + /** TODO */ + IDhApiConfigValue debugWireframeRendering(); } diff --git a/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiFarFogConfig.java b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiFarFogConfig.java new file mode 100644 index 000000000..704c8cc37 --- /dev/null +++ b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiFarFogConfig.java @@ -0,0 +1,70 @@ +/* + * This file is part of the Distant Horizons mod (formerly the LOD Mod), + * licensed under the GNU LGPL v3 License. + * + * Copyright (C) 2020-2022 James Seibel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.seibel.lod.api.interfaces.config.client; + +import com.seibel.lod.api.enums.rendering.*; +import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup; +import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; + +/** + * Distant Horizons' fog configuration.

+ * + * Note: unless an option explicitly states that it modifies + * Minecraft's vanilla rendering (like DisableVanillaFog) + * these settings will only affect Distant horizons' fog. + * + * @author James Seibel + * @version 2022-6-14 + */ +public interface IDhApiFarFogConfig extends IDhApiConfigGroup +{ + /** + * Defines where the fog starts as a percent of the + * fake chunks render distance radius.
+ * Can be greater than the fog end distance to invert the fog direction.

+ * + * 0.0 = fog starts at the camera
+ * 1.0 = fog starts at the edge of the fake chunk render distance
+ */ + IDhApiConfigValue farFogStartDistance(); + + /** + * Defines where the fog ends as a percent of the radius + * of the fake chunks render distance.
+ * Can be less than the fog start distance to invert the fog direction.

+ * + * 0.0 = fog ends at the camera
+ * 1.0 = fog ends at the edge of the fake chunk render distance
+ */ + IDhApiConfigValue farFogEndDistance(); + + /** Defines how opaque the fog is at its thinnest point. */ + IDhApiConfigValue farFogMinThickness(); + + /** Defines how opaque the fog is at its thickest point. */ + IDhApiConfigValue farFogMaxThickness(); + + /** Defines how the fog changes in thickness. */ + IDhApiConfigValue farFogFalloff(); + + /** Defines the fog density. */ + IDhApiConfigValue farFogDensity(); + +} diff --git a/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiFogConfig.java b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiFogConfig.java new file mode 100644 index 000000000..841e253d2 --- /dev/null +++ b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiFogConfig.java @@ -0,0 +1,58 @@ +/* + * This file is part of the Distant Horizons mod (formerly the LOD Mod), + * licensed under the GNU LGPL v3 License. + * + * Copyright (C) 2020-2022 James Seibel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.seibel.lod.api.interfaces.config.client; + +import com.seibel.lod.api.enums.rendering.*; +import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup; +import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; + +/** + * Distant Horizons' fog configuration.

+ * + * Note: unless an option explicitly states that it modifies + * Minecraft's vanilla rendering (like DisableVanillaFog) + * these settings will only affect Distant horizons' fog. + * + * @author James Seibel + * @version 2022-6-14 + */ +public interface IDhApiFogConfig extends IDhApiConfigGroup +{ + + //====================// + // basic fog settings // + //====================// + + /** Defines at what distance fog is rendered on fake chunks. */ + IDhApiConfigValue distance(); + + /** Should be used to enable/disable fog rendering. */ + IDhApiConfigValue drawMode(); + + /** Can be used to enable support with mods that change vanilla MC's fog color. */ + IDhApiConfigValue color(); + + /** + * If enabled attempts to disable vanilla MC's fog on real chunks.
+ * May not play nice with other fog editing mods. + */ + IDhApiConfigValue disableVanillaFog(); + +} diff --git a/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiBuffersConfig.java b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiGpuBuffersConfig.java similarity index 86% rename from api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiBuffersConfig.java rename to api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiGpuBuffersConfig.java index bfd17d67d..7a2043653 100644 --- a/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiBuffersConfig.java +++ b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiGpuBuffersConfig.java @@ -27,13 +27,13 @@ import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; * Distant Horizons' OpenGL buffer configuration. * * @author James Seibel - * @version 2022-9-15 + * @version 2023-6-14 */ -public interface IDhApiBuffersConfig extends IDhApiConfigGroup +public interface IDhApiGpuBuffersConfig extends IDhApiConfigGroup { /** Defines how geometry data is uploaded to the GPU. */ - IDhApiConfigValue getGpuUploadMethod(); + IDhApiConfigValue gpuUploadMethod(); /** * Defines how long we should wait after uploading one @@ -42,6 +42,6 @@ public interface IDhApiBuffersConfig extends IDhApiConfigGroup * This can be set to a non-zero number to reduce stuttering caused by * uploading buffers to the GPU. */ - IDhApiConfigValue getBufferUploadTimeoutPerMegabyteInMilliseconds(); + IDhApiConfigValue gpuUploadPerMegabyteInMilliseconds(); } diff --git a/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiGraphicsConfig.java b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiGraphicsConfig.java index db6b2a485..3d83d325a 100644 --- a/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiGraphicsConfig.java +++ b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiGraphicsConfig.java @@ -21,6 +21,7 @@ package com.seibel.lod.api.interfaces.config.client; import com.seibel.lod.api.enums.config.*; import com.seibel.lod.api.enums.rendering.ERendererMode; +import com.seibel.lod.api.enums.rendering.ETransparency; import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup; @@ -28,25 +29,33 @@ import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup; * Distant Horizons' graphics/rendering configuration. * * @author James Seibel - * @version 2022-9-15 + * @version 2023-6-14 */ public interface IDhApiGraphicsConfig extends IDhApiConfigGroup { + //===============// + // inner configs // + //===============// + + IDhApiFogConfig fog(); + IDhApiNoiseTextureConfig noiseTexture(); + + //========================// // basic graphic settings // //========================// /** The distance is the radius measured in chunks. */ - IDhApiConfigValue getChunkRenderDistance(); + IDhApiConfigValue chunkRenderDistance(); /** - * Simplified version of {@link IDhApiGraphicsConfig#getRenderingMode()} + * Simplified version of {@link IDhApiGraphicsConfig#renderingMode()} * that only enables/disables the fake chunk rendering.

* - * Changing this config also changes {@link IDhApiGraphicsConfig#getRenderingMode()}'s value. + * Changing this config also changes {@link IDhApiGraphicsConfig#renderingMode()}'s value. */ - IDhApiConfigValue getRenderingEnabled(); + IDhApiConfigValue renderingEnabled(); /** * Can be used to enable/disable fake chunk rendering or enable the debug renderer.

@@ -54,9 +63,9 @@ public interface IDhApiGraphicsConfig extends IDhApiConfigGroup * The debug renderer is used to confirm rendering is working at and will draw * a single multicolor rhombus on the screen in skybox space (AKA behind MC's rendering).

* - * Changing this config also changes {@link IDhApiGraphicsConfig#getRenderingEnabled()}'s value. + * Changing this config also changes {@link IDhApiGraphicsConfig#renderingEnabled()}'s value. */ - IDhApiConfigValue getRenderingMode(); + IDhApiConfigValue renderingMode(); @@ -65,14 +74,27 @@ public interface IDhApiGraphicsConfig extends IDhApiConfigGroup //==================// /** Defines how detailed fake chunks are in the horizontal direction */ - IDhApiConfigValue getMaxDetailLevel(); + IDhApiConfigValue maxHorizontalResolution(); /** Defines how detailed fake chunks are in the vertical direction */ - IDhApiConfigValue getVerticalQuality(); + IDhApiConfigValue verticalQuality(); /** Modifies the quadratic function fake chunks use for horizontal quality drop-off. */ - IDhApiConfigValue getHorizontalQualityDropoff(); - + IDhApiConfigValue horizontalQuality(); + + IDhApiConfigValue ambientOcclusion(); + + IDhApiConfigValue transparency(); + + /** Defines what blocks won't be rendered as LODs. */ + IDhApiConfigValue blocksToAvoid(); + + /** + * Defines if the color of avoided blocks will color the block below them.
+ * (IE: if flowers are avoided, should they color the grass below them?) + */ + IDhApiConfigValue tintWithAvoidedBlocks(); + /** * The same as vanilla Minecraft's biome blending.

* @@ -95,32 +117,35 @@ public interface IDhApiGraphicsConfig extends IDhApiConfigGroup * Disabling this reduces holes in the world due to the near clip plane * being too close to the camera and the terrain not being covered by vanilla terrain. */ - IDhApiConfigValue getUseExtendedNearClipPlane(); + IDhApiConfigValue overdrawPrevention(); /** * Modifies how bright fake chunks are.
* This is done when generating the vertex data and is applied before any shaders. */ - IDhApiConfigValue getBrightnessMultiplier(); + IDhApiConfigValue brightnessMultiplier(); /** * Modifies how saturated fake chunks are.
* This is done when generating the vertex data and is applied before any shaders. */ - IDhApiConfigValue getSaturationMultiplier(); + IDhApiConfigValue saturationMultiplier(); /** Defines if Distant Horizons should attempt to cull fake chunk cave geometry. */ - IDhApiConfigValue getCaveCullingEnabled(); + IDhApiConfigValue caveCullingEnabled(); /** Defines what height cave culling should be used below if enabled. */ - IDhApiConfigValue getCaveCullingHeight(); + IDhApiConfigValue caveCullingHeight(); /** This ratio is relative to Earth's real world curvature. */ - IDhApiConfigValue getEarthCurvatureRatio(); + IDhApiConfigValue earthCurvatureRatio(); /** If enabled vanilla chunk rendering is disabled and only fake chunks are rendered. */ - IDhApiConfigValue getEnableLodOnlyMode(); - + IDhApiConfigValue lodOnlyMode(); + /** + * TODO + */ + IDhApiConfigValue lodBias(); } diff --git a/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiGraphicsFogConfig.java b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiGraphicsFogConfig.java deleted file mode 100644 index a060a316e..000000000 --- a/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiGraphicsFogConfig.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * This file is part of the Distant Horizons mod (formerly the LOD Mod), - * licensed under the GNU LGPL v3 License. - * - * Copyright (C) 2020-2022 James Seibel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.seibel.lod.api.interfaces.config.client; - -import com.seibel.lod.api.enums.rendering.*; -import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup; -import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; - -/** - * Distant Horizons' fog configuration.

- * - * Note: unless an option explicitly states that it modifies - * Minecraft's vanilla rendering (like DisableVanillaFog) - * these settings will only affect Distant horizons' fog. - * - * @author James Seibel - * @version 2022-9-15 - */ -public interface IDhApiGraphicsFogConfig extends IDhApiConfigGroup -{ - - //====================// - // basic fog settings // - //====================// - - /** Defines at what distance fog is rendered on fake chunks. */ - IDhApiConfigValue getFogDistance(); - - /** Should be used to enable/disable fog rendering. */ - IDhApiConfigValue getFogRender(); - - /** Can be used to enable support with mods that change vanilla MC's fog color. */ - IDhApiConfigValue getFogColor(); - - /** - * If enabled attempts to disable vanilla MC's fog on real chunks.
- * May not play nice with other fog editing mods. - */ - IDhApiConfigValue getDisableVanillaFog(); - - - //=======================// - // advanced fog settings // - //=======================// - - /** - * Defines where the fog starts as a percent of the - * fake chunks render distance radius.
- * Can be greater than the fog end distance to invert the fog direction.

- * - * 0.0 = fog starts at the camera
- * 1.0 = fog starts at the edge of the fake chunk render distance
- */ - IDhApiConfigValue getFogStartDistance(); - - /** - * Defines where the fog ends as a percent of the radius - * of the fake chunks render distance.
- * Can be less than the fog start distance to invert the fog direction.

- * - * 0.0 = fog ends at the camera
- * 1.0 = fog ends at the edge of the fake chunk render distance
- */ - IDhApiConfigValue getFogEndDistance(); - - /** Defines how opaque the fog is at its thinnest point. */ - IDhApiConfigValue getFogMinThickness(); - - /** Defines how opaque the fog is at its thickest point. */ - IDhApiConfigValue getFogMaxThickness(); - - /** Defines how the fog changes in thickness. */ - IDhApiConfigValue getFarFogFalloff(); - - /** Defines the fog density. */ - IDhApiConfigValue getFogDensity(); - - - //=====================// - // height fog settings // - //=====================// - - /** Defines how the height fog mixes. */ - IDhApiConfigValue getHeightFogMixMode(); - - /** Defines how the height fog is drawn relative to the camera or world. */ - IDhApiConfigValue getHeightFogMode(); - - /** - * Defines the height fog's base height if {@link IDhApiGraphicsFogConfig#getHeightFogMode()} - * is set to use a specific height. - */ - IDhApiConfigValue getHeightFogBaseHeight(); - - /** Defines the height fog's starting height as a percent of the world height. */ - IDhApiConfigValue getHeightFogStartingHeightPercent(); - - /** Defines the height fog's ending height as a percent of the world height. */ - IDhApiConfigValue getHeightFogEndingHeightPercent(); - - /** Defines how opaque the height fog is at its thinnest point. */ - IDhApiConfigValue getHeightFogMinThickness(); - - /** Defines how opaque the height fog is at its thickest point. */ - IDhApiConfigValue getHeightFogMaxThickness(); - - /** Defines how the height fog changes in thickness. */ - IDhApiConfigValue getHeightFogFalloff(); - - /** Defines the height fog's density. */ - IDhApiConfigValue getHeightFogDensity(); - -} diff --git a/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiHeightFogConfig.java b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiHeightFogConfig.java new file mode 100644 index 000000000..ab05a7406 --- /dev/null +++ b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiHeightFogConfig.java @@ -0,0 +1,71 @@ +/* + * This file is part of the Distant Horizons mod (formerly the LOD Mod), + * licensed under the GNU LGPL v3 License. + * + * Copyright (C) 2020-2022 James Seibel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.seibel.lod.api.interfaces.config.client; + +import com.seibel.lod.api.enums.rendering.EFogFalloff; +import com.seibel.lod.api.enums.rendering.EHeightFogMixMode; +import com.seibel.lod.api.enums.rendering.EHeightFogMode; +import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup; +import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; + +/** + * Distant Horizons' fog configuration.

+ * + * Note: unless an option explicitly states that it modifies + * Minecraft's vanilla rendering (like DisableVanillaFog) + * these settings will only affect Distant horizons' fog. + * + * @author James Seibel + * @version 2022-6-14 + */ +public interface IDhApiHeightFogConfig extends IDhApiConfigGroup +{ + + /** Defines how the height fog mixes. */ + IDhApiConfigValue heightFogMixMode(); + + /** Defines how the height fog is drawn relative to the camera or world. */ + IDhApiConfigValue heightFogMode(); + + /** + * Defines the height fog's base height if {@link IDhApiHeightFogConfig#heightFogMode()} + * is set to use a specific height. + */ + IDhApiConfigValue heightFogBaseHeight(); + + /** Defines the height fog's starting height as a percent of the world height. */ + IDhApiConfigValue heightFogStartingHeightPercent(); + + /** Defines the height fog's ending height as a percent of the world height. */ + IDhApiConfigValue heightFogEndingHeightPercent(); + + /** Defines how opaque the height fog is at its thinnest point. */ + IDhApiConfigValue heightFogMinThickness(); + + /** Defines how opaque the height fog is at its thickest point. */ + IDhApiConfigValue heightFogMaxThickness(); + + /** Defines how the height fog changes in thickness. */ + IDhApiConfigValue heightFogFalloff(); + + /** Defines the height fog's density. */ + IDhApiConfigValue heightFogDensity(); + +} diff --git a/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiLoggingConfig.java b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiLoggingConfig.java new file mode 100644 index 000000000..d71214156 --- /dev/null +++ b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiLoggingConfig.java @@ -0,0 +1,37 @@ +/* + * This file is part of the Distant Horizons mod (formerly the LOD Mod), + * licensed under the GNU LGPL v3 License. + * + * Copyright (C) 2020-2022 James Seibel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.seibel.lod.api.interfaces.config.client; + +import com.seibel.lod.api.enums.rendering.EFogColorMode; +import com.seibel.lod.api.enums.rendering.EFogDistance; +import com.seibel.lod.api.enums.rendering.EFogDrawMode; +import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup; +import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; + +/** + * Distant Horizons' fog configuration.

+ * + * @author James Seibel + * @version 2022-6-14 + */ +public interface IDhApiLoggingConfig extends IDhApiConfigGroup +{ + // TODO implement +} diff --git a/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiThreadingConfig.java b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiMultiThreadingConfig.java similarity index 78% rename from api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiThreadingConfig.java rename to api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiMultiThreadingConfig.java index 19fa66204..617ee456c 100644 --- a/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiThreadingConfig.java +++ b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiMultiThreadingConfig.java @@ -26,9 +26,9 @@ import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup; * Distant Horizons' threading configuration. * * @author James Seibel - * @version 2023-6-5 + * @version 2023-6-14 */ -public interface IDhApiThreadingConfig extends IDhApiConfigGroup +public interface IDhApiMultiThreadingConfig extends IDhApiConfigGroup { /** @@ -36,19 +36,15 @@ public interface IDhApiThreadingConfig extends IDhApiConfigGroup * terrain outside Minecraft's vanilla render distance.
*
* If the number of threads is less than 1 it will be treated as a percentage - * representing how often the single thread will actively generate terrain.

- * - * @deprecated this (and the related config) should be replaced with an int - * count of threads and then a double percent active config. + * representing how often the single thread will actively generate terrain. */ - @Deprecated - IDhApiConfigValue getWorldGeneratorThread(); + IDhApiConfigValue worldGeneratorThreads(); /** Defines how many buffer (GPU Terrain data) builder threads are used. */ - IDhApiConfigValue getBufferBuilderThread(); + IDhApiConfigValue bufferBuilderThreads(); /** Defines how many file handler threads are used. */ - IDhApiConfigValue getFileHandlerThread(); + IDhApiConfigValue fileHandlerThreads(); /** * Defines how many Full to Render data converter threads are used.

@@ -56,6 +52,11 @@ public interface IDhApiThreadingConfig extends IDhApiConfigGroup * Full data - Distant Horizons data based on BlockState and Biome IDs
* Render data - color data used when Distant Horizons is rendering */ - IDhApiConfigValue getDataConverterThread(); + IDhApiConfigValue dataConverterThreads(); + + /** + * TODO + */ + IDhApiConfigValue chunkLodConverterThreads(); } diff --git a/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiMultiplayerConfig.java b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiMultiplayerConfig.java index 994337fcf..d7392bb70 100644 --- a/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiMultiplayerConfig.java +++ b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiMultiplayerConfig.java @@ -27,7 +27,7 @@ import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup; * Distant Horizons' client-side multiplayer configuration. * * @author James Seibel - * @version 2022-9-15 + * @version 2023-6-14 */ public interface IDhApiMultiplayerConfig extends IDhApiConfigGroup { @@ -36,7 +36,7 @@ public interface IDhApiMultiplayerConfig extends IDhApiConfigGroup * Defines how multiplayer server folders are named.
* Note: Changing this while connected to a multiplayer world will cause undefined behavior! */ - IDhApiConfigValue getFolderSavingMode(); + IDhApiConfigValue folderSavingMode(); /** * Defines the necessary similarity (as a percent) that two potential levels @@ -47,7 +47,7 @@ public interface IDhApiMultiplayerConfig extends IDhApiConfigGroup * Setting this to a non-zero value allows for usage in servers that user Multiverse * or similar mods. */ - IDhApiConfigValue getMultiverseSimilarityRequirement(); + IDhApiConfigValue multiverseSimilarityRequirement(); } diff --git a/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiNoiseTextureConfig.java b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiNoiseTextureConfig.java new file mode 100644 index 000000000..53ad891cb --- /dev/null +++ b/api/src/main/java/com/seibel/lod/api/interfaces/config/client/IDhApiNoiseTextureConfig.java @@ -0,0 +1,53 @@ +/* + * This file is part of the Distant Horizons mod (formerly the LOD Mod), + * licensed under the GNU LGPL v3 License. + * + * Copyright (C) 2020-2022 James Seibel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.seibel.lod.api.interfaces.config.client; + +import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup; +import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; + +/** + * Distant Horizons' noise texture configuration.

+ * + * @author James Seibel + * @version 2022-6-14 + */ +public interface IDhApiNoiseTextureConfig extends IDhApiConfigGroup +{ + /** + * TODO + */ + IDhApiConfigValue noiseEnabled(); + + /** + * TODO + */ + IDhApiConfigValue noiseSteps(); + + /** + * TODO + */ + IDhApiConfigValue noiseIntensity(); + + /** + * TODO + */ + IDhApiConfigValue noiseDropoff(); + +} diff --git a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/DhApiConfig.java b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/DhApiConfig.java index ed81a5a84..578f898d7 100644 --- a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/DhApiConfig.java +++ b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/DhApiConfig.java @@ -2,22 +2,10 @@ package com.seibel.lod.core.api.external.methods.config; import com.seibel.lod.api.interfaces.config.IDhApiConfig; import com.seibel.lod.api.interfaces.config.both.IDhApiWorldGenerationConfig; -import com.seibel.lod.api.interfaces.config.client.IDhApiBuffersConfig; -import com.seibel.lod.api.interfaces.config.client.IDhApiGraphicsConfig; -import com.seibel.lod.api.interfaces.config.client.IDhApiMultiplayerConfig; -import com.seibel.lod.api.interfaces.config.client.IDhApiThreadingConfig; -import com.seibel.lod.core.api.external.methods.config.both.DhApiWorldGenerationConfig; -import com.seibel.lod.core.api.external.methods.config.client.DhApiBuffersConfig; -import com.seibel.lod.core.api.external.methods.config.client.DhApiGraphicsConfig; -import com.seibel.lod.core.api.external.methods.config.client.DhApiMultiplayerConfig; -import com.seibel.lod.core.api.external.methods.config.client.DhApiThreadingConfig; +import com.seibel.lod.api.interfaces.config.client.*; +import com.seibel.lod.core.api.external.methods.config.client.*; +import com.seibel.lod.core.api.external.methods.config.common.DhApiWorldGenerationConfig; -/** - * A singleton that holds all of the config groups for the API. - * - * @author James Seibel - * @version 9-15-2022 - */ public class DhApiConfig implements IDhApiConfig { public static final DhApiConfig INSTANCE = new DhApiConfig(); @@ -25,15 +13,18 @@ public class DhApiConfig implements IDhApiConfig private DhApiConfig() { } + + @Override + public IDhApiGraphicsConfig graphics() { return DhApiGraphicsConfig.INSTANCE; } @Override - public IDhApiWorldGenerationConfig getWorldGeneratorConfig() { return DhApiWorldGenerationConfig.INSTANCE; } + public IDhApiWorldGenerationConfig worldGenerator() { return DhApiWorldGenerationConfig.INSTANCE; } + @Override + public IDhApiMultiplayerConfig multiplayer() { return DhApiMultiplayerConfig.INSTANCE; } + @Override + public IDhApiMultiThreadingConfig multiThreading() { return DhApiMultiThreadingConfig.INSTANCE; } @Override - public IDhApiBuffersConfig getBufferConfig() { return DhApiBuffersConfig.INSTANCE; } + public IDhApiGpuBuffersConfig gpuBuffers() { return DhApiGpuBuffersConfig.INSTANCE; } @Override - public IDhApiGraphicsConfig getGraphicsConfig() { return DhApiGraphicsConfig.INSTANCE; } - @Override - public IDhApiMultiplayerConfig getMultiplayerConfig() { return DhApiMultiplayerConfig.INSTANCE; } - @Override - public IDhApiThreadingConfig getThreadingConfig() { return DhApiThreadingConfig.INSTANCE; } + public IDhApiDebuggingConfig debugging() { return DhApiDebuggingConfig.INSTANCE; } } diff --git a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiDebuggingConfig.java b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiDebuggingConfig.java index c6aba94c4..af121db3e 100644 --- a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiDebuggingConfig.java +++ b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiDebuggingConfig.java @@ -23,14 +23,8 @@ import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; import com.seibel.lod.api.interfaces.config.client.IDhApiDebuggingConfig; import com.seibel.lod.api.objects.config.DhApiConfigValue; import com.seibel.lod.core.config.Config.Client.Advanced.Debugging; -import com.seibel.lod.api.enums.rendering.EDebugMode; +import com.seibel.lod.api.enums.rendering.EDebugRendering; -/** - * Distant Horizons' debug configuration. - * - * @author James Seibel - * @version 2022-9-15 - */ public class DhApiDebuggingConfig implements IDhApiDebuggingConfig { public static DhApiDebuggingConfig INSTANCE = new DhApiDebuggingConfig(); @@ -39,10 +33,19 @@ public class DhApiDebuggingConfig implements IDhApiDebuggingConfig - public IDhApiConfigValue getDebugRenderMode() - { return new DhApiConfigValue<>(Debugging.debugMode); } + public IDhApiConfigValue debugRendering() + { return new DhApiConfigValue(Debugging.debugRendering); } - public IDhApiConfigValue getEnableDebugKeybindings() - { return new DhApiConfigValue<>(Debugging.enableDebugKeybindings); } + public IDhApiConfigValue debugKeybindings() + { return new DhApiConfigValue(Debugging.enableDebugKeybindings); } + + public IDhApiConfigValue renderWireframe() + { return new DhApiConfigValue(Debugging.renderWireframe); } + + public IDhApiConfigValue lodOnlyMode() + { return new DhApiConfigValue(Debugging.lodOnlyMode); } + + public IDhApiConfigValue debugWireframeRendering() + { return new DhApiConfigValue(Debugging.debugWireframeRendering); } } diff --git a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiFarFogConfig.java b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiFarFogConfig.java new file mode 100644 index 000000000..ad521180b --- /dev/null +++ b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiFarFogConfig.java @@ -0,0 +1,61 @@ +/* + * This file is part of the Distant Horizons mod (formerly the LOD Mod), + * licensed under the GNU LGPL v3 License. + * + * Copyright (C) 2020-2022 James Seibel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.seibel.lod.core.api.external.methods.config.client; + +import com.seibel.lod.api.enums.rendering.*; +import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; +import com.seibel.lod.api.interfaces.config.client.IDhApiFarFogConfig; +import com.seibel.lod.api.interfaces.config.client.IDhApiFogConfig; +import com.seibel.lod.api.objects.config.DhApiConfigValue; +import com.seibel.lod.core.config.Config.Client.Advanced.Graphics.Fog; + +public class DhApiFarFogConfig implements IDhApiFarFogConfig +{ + public static DhApiFarFogConfig INSTANCE = new DhApiFarFogConfig(); + + private DhApiFarFogConfig() { } + + + + @Override + public IDhApiConfigValue farFogStartDistance() + { return new DhApiConfigValue(Fog.AdvancedFog.farFogStart); } + + @Override + public IDhApiConfigValue farFogEndDistance() + { return new DhApiConfigValue(Fog.AdvancedFog.farFogEnd); } + + @Override + public IDhApiConfigValue farFogMinThickness() + { return new DhApiConfigValue(Fog.AdvancedFog.farFogMin); } + + @Override + public IDhApiConfigValue farFogMaxThickness() + { return new DhApiConfigValue(Fog.AdvancedFog.farFogMax); } + + @Override + public IDhApiConfigValue farFogFalloff() + { return new DhApiConfigValue(Fog.AdvancedFog.farFogFalloff); } + + @Override + public IDhApiConfigValue farFogDensity() + { return new DhApiConfigValue(Fog.AdvancedFog.farFogDensity); } + +} diff --git a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiFogConfig.java b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiFogConfig.java new file mode 100644 index 000000000..ae371c336 --- /dev/null +++ b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiFogConfig.java @@ -0,0 +1,67 @@ +/* + * This file is part of the Distant Horizons mod (formerly the LOD Mod), + * licensed under the GNU LGPL v3 License. + * + * Copyright (C) 2020-2022 James Seibel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.seibel.lod.core.api.external.methods.config.client; + +import com.seibel.lod.api.enums.rendering.*; +import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; +import com.seibel.lod.api.interfaces.config.client.IDhApiFarFogConfig; +import com.seibel.lod.api.interfaces.config.client.IDhApiFogConfig; +import com.seibel.lod.api.interfaces.config.client.IDhApiHeightFogConfig; +import com.seibel.lod.api.objects.config.DhApiConfigValue; +import com.seibel.lod.core.config.Config.Client.Advanced.Graphics.Fog; + +public class DhApiFogConfig implements IDhApiFogConfig +{ + public static DhApiFogConfig INSTANCE = new DhApiFogConfig(); + + private DhApiFogConfig() { } + + + + //===============// + // inner configs // + //===============// + + public IDhApiFarFogConfig farFog() { return DhApiFarFogConfig.INSTANCE; } + public IDhApiHeightFogConfig heightFog() { return DhApiHeightFogConfig.INSTANCE; } + + + + //====================// + // basic fog settings // + //====================// + + @Override + public IDhApiConfigValue distance() + { return new DhApiConfigValue<>(Fog.distance); } + + @Override + public IDhApiConfigValue drawMode() + { return new DhApiConfigValue<>(Fog.drawMode); } + + @Override + public IDhApiConfigValue color() + { return new DhApiConfigValue<>(Fog.colorMode); } + + @Override + public IDhApiConfigValue disableVanillaFog() + { return new DhApiConfigValue<>(Fog.disableVanillaFog); } + +} diff --git a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiBuffersConfig.java b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiGpuBuffersConfig.java similarity index 73% rename from core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiBuffersConfig.java rename to core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiGpuBuffersConfig.java index b1b33a9b3..659778da2 100644 --- a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiBuffersConfig.java +++ b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiGpuBuffersConfig.java @@ -20,30 +20,24 @@ package com.seibel.lod.core.api.external.methods.config.client; import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; -import com.seibel.lod.api.interfaces.config.client.IDhApiBuffersConfig; +import com.seibel.lod.api.interfaces.config.client.IDhApiGpuBuffersConfig; import com.seibel.lod.api.objects.config.DhApiConfigValue; import com.seibel.lod.core.config.Config; import com.seibel.lod.core.config.Config.Client.Advanced.GpuBuffers; import com.seibel.lod.api.enums.config.EGpuUploadMethod; -/** - * Distant Horizons' OpenGL buffer configuration. - * - * @author James Seibel - * @version 2022-9-15 - */ -public class DhApiBuffersConfig implements IDhApiBuffersConfig +public class DhApiGpuBuffersConfig implements IDhApiGpuBuffersConfig { - public static DhApiBuffersConfig INSTANCE = new DhApiBuffersConfig(); + public static DhApiGpuBuffersConfig INSTANCE = new DhApiGpuBuffersConfig(); - private DhApiBuffersConfig() { } + private DhApiGpuBuffersConfig() { } - public IDhApiConfigValue getGpuUploadMethod() + public IDhApiConfigValue gpuUploadMethod() { return new DhApiConfigValue<>(Config.Client.Advanced.GpuBuffers.gpuUploadMethod); } - public IDhApiConfigValue getBufferUploadTimeoutPerMegabyteInMilliseconds() + public IDhApiConfigValue gpuUploadPerMegabyteInMilliseconds() { return new DhApiConfigValue<>(GpuBuffers.gpuUploadPerMegabyteInMilliseconds); } } diff --git a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiGraphicsConfig.java b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiGraphicsConfig.java index 95afd0601..9de814045 100644 --- a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiGraphicsConfig.java +++ b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiGraphicsConfig.java @@ -20,21 +20,18 @@ package com.seibel.lod.core.api.external.methods.config.client; import com.seibel.lod.api.enums.config.*; +import com.seibel.lod.api.enums.rendering.ETransparency; import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; +import com.seibel.lod.api.interfaces.config.client.IDhApiFogConfig; import com.seibel.lod.api.interfaces.config.client.IDhApiGraphicsConfig; +import com.seibel.lod.api.interfaces.config.client.IDhApiNoiseTextureConfig; import com.seibel.lod.api.objects.config.DhApiConfigValue; -import com.seibel.lod.coreapi.util.converters.RenderModeEnabledConverter; import com.seibel.lod.api.enums.rendering.ERendererMode; +import com.seibel.lod.core.config.Config; import com.seibel.lod.core.config.Config.Client.Advanced.Graphics.Quality; import com.seibel.lod.core.config.Config.Client.Advanced.Debugging; import com.seibel.lod.core.config.Config.Client.Advanced.Graphics.AdvancedGraphics; -/** - * Distant Horizons' graphics/rendering configuration. - * - * @author James Seibel - * @version 2022-9-15 - */ public class DhApiGraphicsConfig implements IDhApiGraphicsConfig { public static DhApiGraphicsConfig INSTANCE = new DhApiGraphicsConfig(); @@ -43,21 +40,30 @@ public class DhApiGraphicsConfig implements IDhApiGraphicsConfig + //==============// + // inner layers // + //==============// + + public IDhApiFogConfig fog() { return DhApiFogConfig.INSTANCE; } + public IDhApiNoiseTextureConfig noiseTexture() { return DhApiNoiseTextureConfig.INSTANCE; } + + + //========================// // basic graphic settings // //========================// @Override - public IDhApiConfigValue getChunkRenderDistance() - { return new DhApiConfigValue<>(Quality.lodChunkRenderDistance); } + public IDhApiConfigValue chunkRenderDistance() + { return new DhApiConfigValue(Quality.lodChunkRenderDistance); } @Override - public IDhApiConfigValue getRenderingEnabled() - { return new DhApiConfigValue(Debugging.rendererMode, new RenderModeEnabledConverter()); } + public IDhApiConfigValue renderingEnabled() + { return new DhApiConfigValue(Config.Client.quickEnableRendering); } @Override - public IDhApiConfigValue getRenderingMode() - { return new DhApiConfigValue<>(Debugging.rendererMode); } + public IDhApiConfigValue renderingMode() + { return new DhApiConfigValue(Debugging.rendererMode); } @@ -66,20 +72,37 @@ public class DhApiGraphicsConfig implements IDhApiGraphicsConfig //==================// @Override - public IDhApiConfigValue getMaxDetailLevel() - { return new DhApiConfigValue<>(Quality.drawResolution); } + public IDhApiConfigValue maxHorizontalResolution() + { return new DhApiConfigValue(Quality.maxHorizontalResolution); } @Override - public IDhApiConfigValue getVerticalQuality() - { return new DhApiConfigValue<>(Quality.verticalQuality); } + public IDhApiConfigValue verticalQuality() + { return new DhApiConfigValue(Quality.verticalQuality); } @Override - public IDhApiConfigValue getHorizontalQualityDropoff() - { return new DhApiConfigValue<>(Quality.horizontalQuality); } + public IDhApiConfigValue horizontalQuality() + { return new DhApiConfigValue(Quality.horizontalQuality); } + @Override + public IDhApiConfigValue ambientOcclusion() + { return new DhApiConfigValue(Quality.ssao); } + + @Override + public IDhApiConfigValue transparency() + { return new DhApiConfigValue(Quality.transparency); } + + @Override + public IDhApiConfigValue blocksToAvoid() + { return new DhApiConfigValue(Quality.blocksToIgnore); } + + @Override + public IDhApiConfigValue tintWithAvoidedBlocks() + { return new DhApiConfigValue(Quality.tintWithAvoidedBlocks); } + + // TODO re-implement // @Override // public IDhApiConfigValue getBiomeBlending() -// { return new DhApiConfigValue<>(Quality.lodBiomeBlending); } +// { return new DhApiConfigValue(Quality.lodBiomeBlending); } @@ -89,35 +112,39 @@ public class DhApiGraphicsConfig implements IDhApiGraphicsConfig // @Override // public IDhApiConfigValue getDisableDirectionalCulling() -// { return new DhApiConfigValue<>(AdvancedGraphics.disableDirectionalCulling); } +// { return new DhApiConfigValue(AdvancedGraphics.disableDirectionalCulling); } @Override - public IDhApiConfigValue getUseExtendedNearClipPlane() - { return new DhApiConfigValue<>(AdvancedGraphics.overdrawPrevention); } + public IDhApiConfigValue overdrawPrevention() + { return new DhApiConfigValue(AdvancedGraphics.overdrawPrevention); } @Override - public IDhApiConfigValue getBrightnessMultiplier() - { return new DhApiConfigValue<>(AdvancedGraphics.brightnessMultiplier); } + public IDhApiConfigValue brightnessMultiplier() + { return new DhApiConfigValue(AdvancedGraphics.brightnessMultiplier); } @Override - public IDhApiConfigValue getSaturationMultiplier() - { return new DhApiConfigValue<>(AdvancedGraphics.saturationMultiplier); } + public IDhApiConfigValue saturationMultiplier() + { return new DhApiConfigValue(AdvancedGraphics.saturationMultiplier); } @Override - public IDhApiConfigValue getCaveCullingEnabled() - { return new DhApiConfigValue<>(AdvancedGraphics.enableCaveCulling); } + public IDhApiConfigValue caveCullingEnabled() + { return new DhApiConfigValue(AdvancedGraphics.enableCaveCulling); } @Override - public IDhApiConfigValue getCaveCullingHeight() - { return new DhApiConfigValue<>(AdvancedGraphics.caveCullingHeight); } + public IDhApiConfigValue caveCullingHeight() + { return new DhApiConfigValue(AdvancedGraphics.caveCullingHeight); } @Override - public IDhApiConfigValue getEarthCurvatureRatio() - { return new DhApiConfigValue<>(AdvancedGraphics.earthCurveRatio); } + public IDhApiConfigValue earthCurvatureRatio() + { return new DhApiConfigValue(AdvancedGraphics.earthCurveRatio); } @Override - public IDhApiConfigValue getEnableLodOnlyMode() - { return new DhApiConfigValue<>(Debugging.lodOnlyMode); } + public IDhApiConfigValue lodOnlyMode() + { return new DhApiConfigValue(Debugging.lodOnlyMode); } + + @Override + public IDhApiConfigValue lodBias() + { return new DhApiConfigValue(AdvancedGraphics.lodBias); } diff --git a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiGraphicsFogConfig.java b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiGraphicsFogConfig.java deleted file mode 100644 index 1f2210d45..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiGraphicsFogConfig.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * This file is part of the Distant Horizons mod (formerly the LOD Mod), - * licensed under the GNU LGPL v3 License. - * - * Copyright (C) 2020-2022 James Seibel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.seibel.lod.core.api.external.methods.config.client; - -import com.seibel.lod.api.enums.rendering.*; -import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; -import com.seibel.lod.api.interfaces.config.client.IDhApiGraphicsFogConfig; -import com.seibel.lod.api.objects.config.DhApiConfigValue; -import com.seibel.lod.core.config.Config.Client.Advanced.Graphics.Fog; - -/** - * Distant Horizons' fog configuration.

- * - * Note: unless an option explicitly states that it modifies - * Minecraft's vanilla rendering (like DisableVanillaFog) - * these settings will only affect Distant horizons' fog. - * - * @author James Seibel - * @version 2022-9-15 - */ -public class DhApiGraphicsFogConfig implements IDhApiGraphicsFogConfig -{ - public static DhApiGraphicsFogConfig INSTANCE = new DhApiGraphicsFogConfig(); - - private DhApiGraphicsFogConfig() { } - - - - //====================// - // basic fog settings // - //====================// - - @Override - public IDhApiConfigValue getFogDistance() - { return new DhApiConfigValue<>(Fog.fogDistance); } - - @Override - public IDhApiConfigValue getFogRender() - { return new DhApiConfigValue<>(Fog.fogDrawMode); } - - @Override - public IDhApiConfigValue getFogColor() - { return new DhApiConfigValue<>(Fog.fogColorMode); } - - @Override - public IDhApiConfigValue getDisableVanillaFog() - { return new DhApiConfigValue<>(Fog.disableVanillaFog); } - - - //=======================// - // advanced fog settings // - //=======================// - - @Override - public IDhApiConfigValue getFogStartDistance() - { return new DhApiConfigValue<>(Fog.AdvancedFog.farFogStart); } - - @Override - public IDhApiConfigValue getFogEndDistance() - { return new DhApiConfigValue<>(Fog.AdvancedFog.farFogEnd); } - - @Override - public IDhApiConfigValue getFogMinThickness() - { return new DhApiConfigValue<>(Fog.AdvancedFog.farFogMin); } - - @Override - public IDhApiConfigValue getFogMaxThickness() - { return new DhApiConfigValue<>(Fog.AdvancedFog.farFogMax); } - - @Override - public IDhApiConfigValue getFarFogFalloff() - { return new DhApiConfigValue<>(Fog.AdvancedFog.farFogFalloff); } - - @Override - public IDhApiConfigValue getFogDensity() - { return new DhApiConfigValue<>(Fog.AdvancedFog.farFogDensity); } - - - //=====================// - // height fog settings // - //=====================// - - @Override - public IDhApiConfigValue getHeightFogMixMode() - { return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogMixMode); } - - @Override - public IDhApiConfigValue getHeightFogMode() - { return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogMode); } - - @Override - public IDhApiConfigValue getHeightFogBaseHeight() - { return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogHeight); } - - @Override - public IDhApiConfigValue getHeightFogStartingHeightPercent() - { return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogStart); } - - @Override - public IDhApiConfigValue getHeightFogEndingHeightPercent() - { return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogEnd); } - - @Override - public IDhApiConfigValue getHeightFogMinThickness() - { return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogMin); } - - @Override - public IDhApiConfigValue getHeightFogMaxThickness() - { return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogMax); } - - @Override - public IDhApiConfigValue getHeightFogFalloff() - { return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogFalloff); } - - @Override - public IDhApiConfigValue getHeightFogDensity() - { return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogDensity); } - -} diff --git a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiHeightFogConfig.java b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiHeightFogConfig.java new file mode 100644 index 000000000..c45ddf906 --- /dev/null +++ b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiHeightFogConfig.java @@ -0,0 +1,72 @@ +/* + * This file is part of the Distant Horizons mod (formerly the LOD Mod), + * licensed under the GNU LGPL v3 License. + * + * Copyright (C) 2020-2022 James Seibel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.seibel.lod.core.api.external.methods.config.client; + +import com.seibel.lod.api.enums.rendering.*; +import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; +import com.seibel.lod.api.interfaces.config.client.IDhApiHeightFogConfig; +import com.seibel.lod.api.objects.config.DhApiConfigValue; +import com.seibel.lod.core.config.Config.Client.Advanced.Graphics.Fog; + +public class DhApiHeightFogConfig implements IDhApiHeightFogConfig +{ + public static DhApiHeightFogConfig INSTANCE = new DhApiHeightFogConfig(); + + private DhApiHeightFogConfig() { } + + + + @Override + public IDhApiConfigValue heightFogMixMode() + { return new DhApiConfigValue(Fog.AdvancedFog.HeightFog.heightFogMixMode); } + + @Override + public IDhApiConfigValue heightFogMode() + { return new DhApiConfigValue(Fog.AdvancedFog.HeightFog.heightFogMode); } + + @Override + public IDhApiConfigValue heightFogBaseHeight() + { return new DhApiConfigValue(Fog.AdvancedFog.HeightFog.heightFogBaseHeight); } + + @Override + public IDhApiConfigValue heightFogStartingHeightPercent() + { return new DhApiConfigValue(Fog.AdvancedFog.HeightFog.heightFogStart); } + + @Override + public IDhApiConfigValue heightFogEndingHeightPercent() + { return new DhApiConfigValue(Fog.AdvancedFog.HeightFog.heightFogEnd); } + + @Override + public IDhApiConfigValue heightFogMinThickness() + { return new DhApiConfigValue(Fog.AdvancedFog.HeightFog.heightFogMin); } + + @Override + public IDhApiConfigValue heightFogMaxThickness() + { return new DhApiConfigValue(Fog.AdvancedFog.HeightFog.heightFogMax); } + + @Override + public IDhApiConfigValue heightFogFalloff() + { return new DhApiConfigValue(Fog.AdvancedFog.HeightFog.heightFogFalloff); } + + @Override + public IDhApiConfigValue heightFogDensity() + { return new DhApiConfigValue(Fog.AdvancedFog.HeightFog.heightFogDensity); } + +} diff --git a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiMultiThreadingConfig.java b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiMultiThreadingConfig.java new file mode 100644 index 000000000..d7f36e496 --- /dev/null +++ b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiMultiThreadingConfig.java @@ -0,0 +1,55 @@ +/* + * This file is part of the Distant Horizons mod (formerly the LOD Mod), + * licensed under the GNU LGPL v3 License. + * + * Copyright (C) 2020-2022 James Seibel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.seibel.lod.core.api.external.methods.config.client; + +import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; +import com.seibel.lod.api.interfaces.config.client.IDhApiMultiThreadingConfig; +import com.seibel.lod.api.objects.config.DhApiConfigValue; +import com.seibel.lod.core.config.Config.Client.Advanced.MultiThreading; + +public class DhApiMultiThreadingConfig implements IDhApiMultiThreadingConfig +{ + public static DhApiMultiThreadingConfig INSTANCE = new DhApiMultiThreadingConfig(); + + private DhApiMultiThreadingConfig() { } + + + + @Override + public IDhApiConfigValue worldGeneratorThreads() + { return new DhApiConfigValue(MultiThreading.numberOfWorldGenerationThreads); } + + @Override + public IDhApiConfigValue bufferBuilderThreads() + { return new DhApiConfigValue(MultiThreading.numberOfBufferBuilderThreads); } + + @Override + public IDhApiConfigValue fileHandlerThreads() + { return new DhApiConfigValue(MultiThreading.numberOfFileHandlerThreads); } + + @Override + public IDhApiConfigValue dataConverterThreads() + { return new DhApiConfigValue(MultiThreading.numberOfDataConverterThreads); } + + @Override + public IDhApiConfigValue chunkLodConverterThreads() + { return new DhApiConfigValue(MultiThreading.numberOfChunkLodConverterThreads); } + +} diff --git a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiMultiplayerConfig.java b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiMultiplayerConfig.java index 6cf1feac7..c589e4a8c 100644 --- a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiMultiplayerConfig.java +++ b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiMultiplayerConfig.java @@ -25,12 +25,6 @@ import com.seibel.lod.api.objects.config.DhApiConfigValue; import com.seibel.lod.core.config.Config.Client.Advanced.Multiplayer; import com.seibel.lod.api.enums.config.EServerFolderNameMode; -/** - * Distant Horizons' client-side multiplayer configuration. - * - * @author James Seibel - * @version 2022-9-15 - */ public class DhApiMultiplayerConfig implements IDhApiMultiplayerConfig { public static DhApiMultiplayerConfig INSTANCE = new DhApiMultiplayerConfig(); @@ -39,10 +33,10 @@ public class DhApiMultiplayerConfig implements IDhApiMultiplayerConfig - public IDhApiConfigValue getFolderSavingMode() - { return new DhApiConfigValue<>(Multiplayer.serverFolderNameMode); } + public IDhApiConfigValue folderSavingMode() + { return new DhApiConfigValue(Multiplayer.serverFolderNameMode); } - public IDhApiConfigValue getMultiverseSimilarityRequirement() - { return new DhApiConfigValue<>(Multiplayer.multiDimensionRequiredSimilarity); } + public IDhApiConfigValue multiverseSimilarityRequirement() + { return new DhApiConfigValue(Multiplayer.multiverseSimilarityRequiredPercent); } } diff --git a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiThreadingConfig.java b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiNoiseTextureConfig.java similarity index 51% rename from core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiThreadingConfig.java rename to core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiNoiseTextureConfig.java index 746f02083..093532d24 100644 --- a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiThreadingConfig.java +++ b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/client/DhApiNoiseTextureConfig.java @@ -20,38 +20,32 @@ package com.seibel.lod.core.api.external.methods.config.client; import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; -import com.seibel.lod.api.interfaces.config.client.IDhApiThreadingConfig; +import com.seibel.lod.api.interfaces.config.client.IDhApiNoiseTextureConfig; import com.seibel.lod.api.objects.config.DhApiConfigValue; -import com.seibel.lod.core.config.Config.Client.Advanced.MultiThreading; +import com.seibel.lod.core.config.Config.Client.Advanced.Graphics.NoiseTextureSettings; -/** - * Distant Horizons' threading configuration. - * - * @author James Seibel - * @version 2022-9-15 - */ -public class DhApiThreadingConfig implements IDhApiThreadingConfig +public class DhApiNoiseTextureConfig implements IDhApiNoiseTextureConfig { - public static DhApiThreadingConfig INSTANCE = new DhApiThreadingConfig(); + public static DhApiNoiseTextureConfig INSTANCE = new DhApiNoiseTextureConfig(); - private DhApiThreadingConfig() { } + private DhApiNoiseTextureConfig() { } @Override - public IDhApiConfigValue getWorldGeneratorThread() - { return new DhApiConfigValue<>(MultiThreading.numberOfWorldGenerationThreads); } + public IDhApiConfigValue noiseEnabled() + { return new DhApiConfigValue(NoiseTextureSettings.noiseEnabled); } @Override - public IDhApiConfigValue getBufferBuilderThread() - { return new DhApiConfigValue<>(MultiThreading.numberOfBufferBuilderThreads); } + public IDhApiConfigValue noiseSteps() + { return new DhApiConfigValue(NoiseTextureSettings.noiseSteps); } @Override - public IDhApiConfigValue getFileHandlerThread() - { return new DhApiConfigValue<>(MultiThreading.numberOfFileHandlerThreads); } + public IDhApiConfigValue noiseIntensity() + { return new DhApiConfigValue(NoiseTextureSettings.noiseIntensity); } @Override - public IDhApiConfigValue getDataConverterThread() - { return new DhApiConfigValue<>(MultiThreading.numberOfDataConverterThreads); } + public IDhApiConfigValue noiseDropoff() + { return new DhApiConfigValue(NoiseTextureSettings.noiseDropoff); } } diff --git a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/both/DhApiWorldGenerationConfig.java b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/common/DhApiWorldGenerationConfig.java similarity index 72% rename from core/src/main/java/com/seibel/lod/core/api/external/methods/config/both/DhApiWorldGenerationConfig.java rename to core/src/main/java/com/seibel/lod/core/api/external/methods/config/common/DhApiWorldGenerationConfig.java index 7b0a112b8..70422af8f 100644 --- a/core/src/main/java/com/seibel/lod/core/api/external/methods/config/both/DhApiWorldGenerationConfig.java +++ b/core/src/main/java/com/seibel/lod/core/api/external/methods/config/common/DhApiWorldGenerationConfig.java @@ -17,8 +17,9 @@ * along with this program. If not, see . */ -package com.seibel.lod.core.api.external.methods.config.both; +package com.seibel.lod.core.api.external.methods.config.common; +import com.seibel.lod.api.enums.config.ELightGenerationMode; import com.seibel.lod.api.interfaces.config.IDhApiConfigValue; import com.seibel.lod.api.interfaces.config.both.IDhApiWorldGenerationConfig; import com.seibel.lod.api.objects.config.DhApiConfigValue; @@ -30,10 +31,10 @@ import com.seibel.lod.api.enums.worldGeneration.EDhApiDistantGeneratorMode; /** * Distant Horizons' world generation configuration.

* - * Note: Fake chunks are NOT saved in Minecraft's vanilla save system. + * Note: LODs are NOT saved in Minecraft's save system. * * @author James Seibel - * @version 2022-9-15 + * @version 2023-9-14 */ public class DhApiWorldGenerationConfig implements IDhApiWorldGenerationConfig { @@ -44,22 +45,16 @@ public class DhApiWorldGenerationConfig implements IDhApiWorldGenerationConfig @Override - public IDhApiConfigValue getEnableDistantWorldGeneration() + public IDhApiConfigValue enableDistantWorldGeneration() { return new DhApiConfigValue<>(WorldGenerator.enableDistantGeneration); } @Override - public IDhApiConfigValue getDistantGeneratorMode() + public IDhApiConfigValue distantGeneratorMode() { return new DhApiConfigValue<>(WorldGenerator.distantGeneratorMode); } - @Deprecated @Override - public IDhApiConfigValue getBlocksToAvoid() - { return new DhApiConfigValue<>(Config.Client.Advanced.Graphics.Quality.blocksToIgnore); } - - @Deprecated - @Override - public IDhApiConfigValue getTintWithAvoidedBlocks() - { return new DhApiConfigValue<>(Config.Client.Advanced.Graphics.Quality.tintWithAvoidedBlocks); } + public IDhApiConfigValue lightingEngine() + { return new DhApiConfigValue<>(WorldGenerator.lightingEngine); } } diff --git a/core/src/main/java/com/seibel/lod/core/api/internal/ClientApi.java b/core/src/main/java/com/seibel/lod/core/api/internal/ClientApi.java index ceba3f4f7..6cf7e9bc0 100644 --- a/core/src/main/java/com/seibel/lod/core/api/internal/ClientApi.java +++ b/core/src/main/java/com/seibel/lod/core/api/internal/ClientApi.java @@ -25,7 +25,7 @@ import com.seibel.lod.coreapi.DependencyInjection.ApiEventInjector; import com.seibel.lod.core.level.IDhClientLevel; import com.seibel.lod.core.config.Config; import com.seibel.lod.coreapi.ModInfo; -import com.seibel.lod.api.enums.rendering.EDebugMode; +import com.seibel.lod.api.enums.rendering.EDebugRendering; import com.seibel.lod.api.enums.rendering.ERendererMode; import com.seibel.lod.core.dependencyInjection.SingletonInjector; import com.seibel.lod.core.level.IDhLevel; @@ -338,8 +338,8 @@ public class ClientApi if (glfwKey == GLFW.GLFW_KEY_F8) { - Config.Client.Advanced.Debugging.debugMode.set(EDebugMode.next(Config.Client.Advanced.Debugging.debugMode.get())); - MC.sendChatMessage("F8: Set debug mode to " + Config.Client.Advanced.Debugging.debugMode.get()); + Config.Client.Advanced.Debugging.debugRendering.set(EDebugRendering.next(Config.Client.Advanced.Debugging.debugRendering.get())); + MC.sendChatMessage("F8: Set debug mode to " + Config.Client.Advanced.Debugging.debugRendering.get()); } else if (glfwKey == GLFW.GLFW_KEY_F6) { diff --git a/core/src/main/java/com/seibel/lod/core/config/Config.java b/core/src/main/java/com/seibel/lod/core/config/Config.java index 581b5761c..b0ea45b41 100644 --- a/core/src/main/java/com/seibel/lod/core/config/Config.java +++ b/core/src/main/java/com/seibel/lod/core/config/Config.java @@ -49,28 +49,9 @@ import java.util.*; public class Config { - // TODO update this diagram - // CONFIG STRUCTURE - // -> Client - // | - // |-> Graphics - // | |-> Quality - // | |-> FogQuality - // | |-> AdvancedGraphics - // | |-> NoiseTextureSettings - // | - // |-> World Generation - // | - // |-> Advanced - // |-> Threads - // |-> GpuBuffers - // |-> Debugging - - // Since the original config system uses forge stuff, that means we have to rewrite the whole config system - public static ConfigCategory client = new ConfigCategory.Builder().set(Client.class).build(); - - + + public static class Client { public static ConfigEntry quickEnableRendering = new ConfigEntry.Builder() @@ -147,20 +128,20 @@ public class Config public static class Quality { - public static ConfigEntry drawResolution = new ConfigEntry.Builder() - .set(EHorizontalResolution.BLOCK) + public static ConfigEntry maxHorizontalResolution = new ConfigEntry.Builder() + .set(EMaxHorizontalResolution.BLOCK) .comment("" + "What is the maximum detail LODs should be drawn at? \n" + "Higher settings will increase memory and GPU usage. \n" + "\n" - + EHorizontalResolution.CHUNK + ": render 1 LOD for each Chunk. \n" - + EHorizontalResolution.HALF_CHUNK + ": render 4 LODs for each Chunk. \n" - + EHorizontalResolution.FOUR_BLOCKS + ": render 16 LODs for each Chunk. \n" - + EHorizontalResolution.TWO_BLOCKS + ": render 64 LODs for each Chunk. \n" - + EHorizontalResolution.BLOCK + ": render 256 LODs for each Chunk (width of one block). \n" + + EMaxHorizontalResolution.CHUNK + ": render 1 LOD for each Chunk. \n" + + EMaxHorizontalResolution.HALF_CHUNK + ": render 4 LODs for each Chunk. \n" + + EMaxHorizontalResolution.FOUR_BLOCKS + ": render 16 LODs for each Chunk. \n" + + EMaxHorizontalResolution.TWO_BLOCKS + ": render 64 LODs for each Chunk. \n" + + EMaxHorizontalResolution.BLOCK + ": render 256 LODs for each Chunk (width of one block). \n" + "\n" - + "Lowest Quality: " + EHorizontalResolution.CHUNK + "\n" - + "Highest Quality: " + EHorizontalResolution.BLOCK) + + "Lowest Quality: " + EMaxHorizontalResolution.CHUNK + "\n" + + "Highest Quality: " + EMaxHorizontalResolution.BLOCK) .addListener(RenderCacheConfigEventHandler.INSTANCE) .setPerformance(EConfigEntryPerformance.MEDIUM) .build(); @@ -185,15 +166,6 @@ public class Config .addListener(RenderCacheConfigEventHandler.INSTANCE) .build(); - // TODO merge with horizontal quality - public static ConfigEntry horizontalScale = new ConfigEntry.Builder() - .setMinDefaultMax(2, 12, 64) - .comment("" - + "This indicates how quickly fake chunks decrease in quality the further away they are. \n" - + "Higher settings will render higher quality fake chunks farther away, \n" - + " but will increase memory and GPU usage.") - .build(); - public static ConfigEntry ssao = new ConfigEntry.Builder() .set(true) .comment("Enable Screen Space Ambient Occlusion") @@ -261,7 +233,7 @@ public class Config public static class Fog { - public static ConfigEntry fogDrawMode = new ConfigEntry.Builder() + public static ConfigEntry drawMode = new ConfigEntry.Builder() .set(EFogDrawMode.FOG_ENABLED) .comment("" + "When should fog be drawn? \n" @@ -275,13 +247,13 @@ public class Config .setPerformance(EConfigEntryPerformance.VERY_LOW) .build(); - public static ConfigEntry fogDistance = new ConfigEntry.Builder() + public static ConfigEntry distance = new ConfigEntry.Builder() .set(EFogDistance.FAR) .comment("At what distance should Fog be drawn on the LODs?") .setPerformance(EConfigEntryPerformance.NONE) .build(); - public static ConfigEntry fogColorMode = new ConfigEntry.Builder() + public static ConfigEntry colorMode = new ConfigEntry.Builder() .set(EFogColorMode.USE_WORLD_FOG_COLOR) .comment("" + "What color should fog use? \n" @@ -370,8 +342,6 @@ public class Config public static class HeightFog { - public static ConfigUIComment heightFogConfigScreenNote = new ConfigUIComment(); - public static ConfigEntry heightFogMixMode = new ConfigEntry.Builder() .set(EHeightFogMixMode.BASIC) .comment("" @@ -405,7 +375,7 @@ public class Config + EHeightFogMode.ABOVE_AND_BELOW_SET_HEIGHT + ": Height fog starts from a set height and goes towards both the sky and void") .build(); - public static ConfigEntry heightFogHeight = new ConfigEntry.Builder() + public static ConfigEntry heightFogBaseHeight = new ConfigEntry.Builder() .setMinDefaultMax(-4096.0, 70.0, 4096.0) .comment("If the height fog is calculated around a set height, what is that height position?") .build(); @@ -467,7 +437,7 @@ public class Config public static class NoiseTextureSettings { - public static ConfigEntry noiseEnable = new ConfigEntry.Builder() + public static ConfigEntry noiseEnabled = new ConfigEntry.Builder() .set(true) .comment("" + "Should a noise texture be applied to LODs? \n" @@ -708,7 +678,7 @@ public class Config + EServerFolderNameMode.NAME_IP_PORT_MC_VERSION + ": Example: \"Minecraft Server IP 192.168.1.40:25565 GameVersion 1.16.5\"") .build(); - public static ConfigEntry multiDimensionRequiredSimilarity = new ConfigEntry.Builder() + public static ConfigEntry multiverseSimilarityRequiredPercent = new ConfigEntry.Builder() .setMinDefaultMax(0.0, 0.0, 1.0) .comment("" + "AKA: Multiverse support. \n" @@ -971,15 +941,15 @@ public class Config + ERendererMode.DISABLED + ": Disable rendering") .build(); - public static ConfigEntry debugMode = new ConfigEntry.Builder() - .set(EDebugMode.OFF) + public static ConfigEntry debugRendering = new ConfigEntry.Builder() + .set(EDebugRendering.OFF) .comment("" + "Should specialized colors/rendering modes be used? \n" + "\n" - + EDebugMode.OFF + ": Fake chunks will be drawn with their normal colors. \n" - + EDebugMode.SHOW_DETAIL + ": Fake chunks color will be based on their detail level. \n" - + EDebugMode.SHOW_GENMODE + ": Fake chunks color will be based on their distant generation mode. \n" - + EDebugMode.SHOW_OVERLAPPING_QUADS + ": Fake chunks will be drawn with total white, but overlapping quads will be drawn with red. \n" + + EDebugRendering.OFF + ": Fake chunks will be drawn with their normal colors. \n" + + EDebugRendering.SHOW_DETAIL + ": Fake chunks color will be based on their detail level. \n" + + EDebugRendering.SHOW_GENMODE + ": Fake chunks color will be based on their distant generation mode. \n" + + EDebugRendering.SHOW_OVERLAPPING_QUADS + ": Fake chunks will be drawn with total white, but overlapping quads will be drawn with red. \n" + " but overlapping quads will be drawn with red, drawn as a wireframe.") .build(); @@ -1089,6 +1059,7 @@ public class Config } + // TODO implement public static class ResetConfirmation { public static ConfigUIComment resetConfirmationNote = new ConfigUIComment(); diff --git a/core/src/main/java/com/seibel/lod/core/config/eventHandlers/RenderCacheConfigEventHandler.java b/core/src/main/java/com/seibel/lod/core/config/eventHandlers/RenderCacheConfigEventHandler.java index 33ada22fe..02400537b 100644 --- a/core/src/main/java/com/seibel/lod/core/config/eventHandlers/RenderCacheConfigEventHandler.java +++ b/core/src/main/java/com/seibel/lod/core/config/eventHandlers/RenderCacheConfigEventHandler.java @@ -1,7 +1,7 @@ package com.seibel.lod.core.config.eventHandlers; import com.seibel.lod.api.DhApiMain; -import com.seibel.lod.api.enums.config.EHorizontalResolution; +import com.seibel.lod.api.enums.config.EMaxHorizontalResolution; import com.seibel.lod.api.enums.config.EVerticalQuality; import com.seibel.lod.core.config.Config; import com.seibel.lod.core.config.listeners.IConfigListener; @@ -21,7 +21,7 @@ public class RenderCacheConfigEventHandler implements IConfigListener // previous values used to check if a watched setting was actually modified private EVerticalQuality previousVerticalQualitySetting = null; - private EHorizontalResolution previousHorizontalResolution = null; + private EMaxHorizontalResolution previousHorizontalResolution = null; /** how long to wait in milliseconds before applying the config changes */ private static final long TIMEOUT_IN_MS = 400L; @@ -47,7 +47,7 @@ public class RenderCacheConfigEventHandler implements IConfigListener refreshRenderData = true; } - EHorizontalResolution newHorizontalResolution = Config.Client.Advanced.Graphics.Quality.drawResolution.get(); + EMaxHorizontalResolution newHorizontalResolution = Config.Client.Advanced.Graphics.Quality.maxHorizontalResolution.get(); if (this.previousHorizontalResolution != newHorizontalResolution) { this.previousHorizontalResolution = newHorizontalResolution; diff --git a/core/src/main/java/com/seibel/lod/core/config/eventHandlers/presets/RenderQualityPresetConfigEventHandler.java b/core/src/main/java/com/seibel/lod/core/config/eventHandlers/presets/RenderQualityPresetConfigEventHandler.java index 56e8d9bec..dafc077da 100644 --- a/core/src/main/java/com/seibel/lod/core/config/eventHandlers/presets/RenderQualityPresetConfigEventHandler.java +++ b/core/src/main/java/com/seibel/lod/core/config/eventHandlers/presets/RenderQualityPresetConfigEventHandler.java @@ -1,7 +1,7 @@ package com.seibel.lod.core.config.eventHandlers.presets; import com.seibel.lod.api.enums.config.EHorizontalQuality; -import com.seibel.lod.api.enums.config.EHorizontalResolution; +import com.seibel.lod.api.enums.config.EMaxHorizontalResolution; import com.seibel.lod.api.enums.config.EVerticalQuality; import com.seibel.lod.api.enums.config.quickOptions.EQualityPreset; import com.seibel.lod.api.enums.rendering.ETransparency; @@ -21,14 +21,14 @@ public class RenderQualityPresetConfigEventHandler extends AbstractPresetConfigE private static final Logger LOGGER = LogManager.getLogger(); - private final ConfigEntryWithPresetOptions drawResolution = new ConfigEntryWithPresetOptions<>(Config.Client.Advanced.Graphics.Quality.drawResolution, - new HashMap() + private final ConfigEntryWithPresetOptions drawResolution = new ConfigEntryWithPresetOptions<>(Config.Client.Advanced.Graphics.Quality.maxHorizontalResolution, + new HashMap() {{ - this.put(EQualityPreset.MINIMUM, EHorizontalResolution.TWO_BLOCKS); - this.put(EQualityPreset.LOW, EHorizontalResolution.BLOCK); - this.put(EQualityPreset.MEDIUM, EHorizontalResolution.BLOCK); - this.put(EQualityPreset.HIGH, EHorizontalResolution.BLOCK); - this.put(EQualityPreset.EXTREME, EHorizontalResolution.BLOCK); + this.put(EQualityPreset.MINIMUM, EMaxHorizontalResolution.TWO_BLOCKS); + this.put(EQualityPreset.LOW, EMaxHorizontalResolution.BLOCK); + this.put(EQualityPreset.MEDIUM, EMaxHorizontalResolution.BLOCK); + this.put(EQualityPreset.HIGH, EMaxHorizontalResolution.BLOCK); + this.put(EQualityPreset.EXTREME, EMaxHorizontalResolution.BLOCK); }}); private final ConfigEntryWithPresetOptions verticalQuality = new ConfigEntryWithPresetOptions<>(Config.Client.Advanced.Graphics.Quality.verticalQuality, new HashMap() diff --git a/core/src/main/java/com/seibel/lod/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java b/core/src/main/java/com/seibel/lod/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java index bf411dfff..cd511585c 100644 --- a/core/src/main/java/com/seibel/lod/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java +++ b/core/src/main/java/com/seibel/lod/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java @@ -1,7 +1,7 @@ package com.seibel.lod.core.dataObjects.render.bufferBuilding; import com.seibel.lod.api.enums.config.EGpuUploadMethod; -import com.seibel.lod.api.enums.rendering.EDebugMode; +import com.seibel.lod.api.enums.rendering.EDebugRendering; import com.seibel.lod.api.enums.rendering.EGLProxyContext; import com.seibel.lod.core.config.Config; import com.seibel.lod.core.config.listeners.ConfigChangeListener; @@ -159,7 +159,7 @@ public class ColumnRenderBufferBuilder private static void makeLodRenderData(LodQuadBuilder quadBuilder, ColumnRenderSource renderSource, ColumnRenderSource[] adjRegions) { // Variable initialization - EDebugMode debugMode = Config.Client.Advanced.Debugging.debugMode.get(); + EDebugRendering debugMode = Config.Client.Advanced.Debugging.debugRendering.get(); // can be uncommented to limit which section positions are build and thus, rendered // useful when debugging a specific section diff --git a/core/src/main/java/com/seibel/lod/core/dataObjects/render/bufferBuilding/CubicLodTemplate.java b/core/src/main/java/com/seibel/lod/core/dataObjects/render/bufferBuilding/CubicLodTemplate.java index 00c97159d..c91d8e5d2 100644 --- a/core/src/main/java/com/seibel/lod/core/dataObjects/render/bufferBuilding/CubicLodTemplate.java +++ b/core/src/main/java/com/seibel/lod/core/dataObjects/render/bufferBuilding/CubicLodTemplate.java @@ -22,7 +22,7 @@ package com.seibel.lod.core.dataObjects.render.bufferBuilding; import com.seibel.lod.core.config.Config; import com.seibel.lod.core.dataObjects.render.ColumnRenderSource; import com.seibel.lod.core.util.RenderDataPointUtil; -import com.seibel.lod.api.enums.rendering.EDebugMode; +import com.seibel.lod.api.enums.rendering.EDebugRendering; import com.seibel.lod.core.dataObjects.render.columnViews.ColumnArrayView; import com.seibel.lod.core.pos.DhLodPos; import com.seibel.lod.coreapi.util.BitShiftUtil; @@ -40,7 +40,7 @@ public class CubicLodTemplate public static void addLodToBuffer( long data, long topData, long bottomData, ColumnArrayView[][] adjData, byte detailLevel, int offsetPosX, int offsetOosZ, LodQuadBuilder quadBuilder, - EDebugMode debugging, ColumnRenderSource.DebugSourceFlag debugSource) + EDebugRendering debugging, ColumnRenderSource.DebugSourceFlag debugSource) { DhLodPos blockOffsetPos = new DhLodPos(detailLevel, offsetPosX, offsetOosZ).convertToDetailLevel(LodUtil.BLOCK_DETAIL_LEVEL); diff --git a/core/src/main/java/com/seibel/lod/core/file/structure/ClientOnlySaveStructure.java b/core/src/main/java/com/seibel/lod/core/file/structure/ClientOnlySaveStructure.java index c46286cdb..ef322f973 100644 --- a/core/src/main/java/com/seibel/lod/core/file/structure/ClientOnlySaveStructure.java +++ b/core/src/main/java/com/seibel/lod/core/file/structure/ClientOnlySaveStructure.java @@ -58,7 +58,7 @@ public class ClientOnlySaveStructure extends AbstractSaveStructure { return this.levelToFileMap.computeIfAbsent(level, (newLevel) -> { - if (Config.Client.Advanced.Multiplayer.multiDimensionRequiredSimilarity.get() == 0) + if (Config.Client.Advanced.Multiplayer.multiverseSimilarityRequiredPercent.get() == 0) { if (this.fileMatcher != null) { diff --git a/core/src/main/java/com/seibel/lod/core/file/subDimMatching/SubDimCompare.java b/core/src/main/java/com/seibel/lod/core/file/subDimMatching/SubDimCompare.java index df5bc30bc..36d82bdb9 100644 --- a/core/src/main/java/com/seibel/lod/core/file/subDimMatching/SubDimCompare.java +++ b/core/src/main/java/com/seibel/lod/core/file/subDimMatching/SubDimCompare.java @@ -78,7 +78,7 @@ public class SubDimCompare implements Comparable /** Returns true if this sub dimension is close enough to be considered a valid sub dimension */ public boolean isValidSubDim() { - double minimumSimilarityRequired = Config.Client.Advanced.Multiplayer.multiDimensionRequiredSimilarity.get(); + double minimumSimilarityRequired = Config.Client.Advanced.Multiplayer.multiverseSimilarityRequiredPercent.get(); return this.getPercentEqual() >= minimumSimilarityRequired || this.playerPosDist <= MAX_SIMILAR_PLAYER_POS_DISTANCE_IN_BLOCKS; } diff --git a/core/src/main/java/com/seibel/lod/core/render/LodQuadTree.java b/core/src/main/java/com/seibel/lod/core/render/LodQuadTree.java index 061aa6b33..b01cf9378 100644 --- a/core/src/main/java/com/seibel/lod/core/render/LodQuadTree.java +++ b/core/src/main/java/com/seibel/lod/core/render/LodQuadTree.java @@ -337,7 +337,7 @@ public class LodQuadTree extends QuadTree implements AutoClose private void updateDetailLevelVariables() { - this.maxRenderDetailLevel = Config.Client.Advanced.Graphics.Quality.drawResolution.get().detailLevel; + this.maxRenderDetailLevel = Config.Client.Advanced.Graphics.Quality.maxHorizontalResolution.get().detailLevel; this.detailDropOffDistanceUnit = Config.Client.Advanced.Graphics.Quality.horizontalQuality.get().distanceUnitInBlocks * LodUtil.CHUNK_WIDTH; this.detailDropOffLogBase = Math.log(Config.Client.Advanced.Graphics.Quality.horizontalQuality.get().quadraticBase); } diff --git a/core/src/main/java/com/seibel/lod/core/render/fog/LodFogConfig.java b/core/src/main/java/com/seibel/lod/core/render/fog/LodFogConfig.java index 3befbb63b..f30ec2dc4 100644 --- a/core/src/main/java/com/seibel/lod/core/render/fog/LodFogConfig.java +++ b/core/src/main/java/com/seibel/lod/core/render/fog/LodFogConfig.java @@ -66,7 +66,7 @@ public class LodFogConfig public static LodFogConfig generateFogConfig() { - EFogDrawMode fogMode = Config.Client.Advanced.Graphics.Fog.fogDrawMode.get(); + EFogDrawMode fogMode = Config.Client.Advanced.Graphics.Fog.drawMode.get(); if (fogMode == EFogDrawMode.USE_OPTIFINE_SETTING && OPTIFINE != null) { fogMode = OPTIFINE.getFogDrawMode(); @@ -80,7 +80,7 @@ public class LodFogConfig // TODO: Move these out of here earthCurveRatio = Config.Client.Advanced.Graphics.AdvancedGraphics.earthCurveRatio.get(); - noiseEnable = Config.Client.Advanced.Graphics.NoiseTextureSettings.noiseEnable.get(); + noiseEnable = Config.Client.Advanced.Graphics.NoiseTextureSettings.noiseEnabled.get(); noiseSteps = Config.Client.Advanced.Graphics.NoiseTextureSettings.noiseSteps.get(); noiseIntensity = Config.Client.Advanced.Graphics.NoiseTextureSettings.noiseIntensity.get().floatValue(); noiseDropoff = Config.Client.Advanced.Graphics.NoiseTextureSettings.noiseDropoff.get().floatValue(); @@ -88,7 +88,7 @@ public class LodFogConfig if (fogDrawMode != EFogDrawMode.FOG_DISABLED) { - EFogDistance fogDistance = Config.Client.Advanced.Graphics.Fog.fogDistance.get(); + EFogDistance fogDistance = Config.Client.Advanced.Graphics.Fog.distance.get(); drawNearFog = (fogDistance == EFogDistance.NEAR || fogDistance == EFogDistance.NEAR_AND_FAR); if (fogDistance == EFogDistance.FAR || fogDistance == EFogDistance.NEAR_AND_FAR) @@ -134,7 +134,7 @@ public class LodFogConfig } else { - heightFogHeight = Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogHeight.get().floatValue(); + heightFogHeight = Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogBaseHeight.get().floatValue(); } } } diff --git a/core/src/main/java/com/seibel/lod/core/render/renderer/LodRenderer.java b/core/src/main/java/com/seibel/lod/core/render/renderer/LodRenderer.java index 78cad9ddb..71a352aa0 100644 --- a/core/src/main/java/com/seibel/lod/core/render/renderer/LodRenderer.java +++ b/core/src/main/java/com/seibel/lod/core/render/renderer/LodRenderer.java @@ -20,7 +20,7 @@ package com.seibel.lod.core.render.renderer; import com.seibel.lod.core.config.Config; -import com.seibel.lod.api.enums.rendering.EDebugMode; +import com.seibel.lod.api.enums.rendering.EDebugRendering; import com.seibel.lod.api.enums.rendering.EFogColorMode; import com.seibel.lod.core.dependencyInjection.SingletonInjector; import com.seibel.lod.core.logging.ConfigBasedLogger; @@ -104,7 +104,7 @@ public class LodRenderer private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); private static final IMinecraftRenderWrapper MC_RENDER = SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class); - public EDebugMode previousDebugMode = null; + public EDebugRendering previousDebugMode = null; public final RenderBufferHandler bufferHandler; // The shader program @@ -314,7 +314,7 @@ public class LodRenderer { Color fogColor; - if (Config.Client.Advanced.Graphics.Fog.fogColorMode.get() == EFogColorMode.USE_SKY_COLOR) + if (Config.Client.Advanced.Graphics.Fog.colorMode.get() == EFogColorMode.USE_SKY_COLOR) fogColor = MC_RENDER.getSkyColor(); else fogColor = MC_RENDER.getFogColor(partialTicks); diff --git a/core/src/main/resources/assets/lod/lang/en_us.json b/core/src/main/resources/assets/lod/lang/en_us.json index fd591999b..91dfcc264 100644 --- a/core/src/main/resources/assets/lod/lang/en_us.json +++ b/core/src/main/resources/assets/lod/lang/en_us.json @@ -78,9 +78,9 @@ "lod.config.client.advanced.graphics.quality": "Render Quality", - "lod.config.client.advanced.graphics.quality.drawResolution": - "Draw Resolution", - "lod.config.client.advanced.graphics.quality.drawResolution.@tooltip": + "lod.config.client.advanced.graphics.quality.maxHorizontalResolution": + "Max Horizontal Resolution", + "lod.config.client.advanced.graphics.quality.maxHorizontalResolution.@tooltip": "The maximum detail LODs are rendered at.\n\n§6Fastest:§r Chunk\n§6Fanciest:§r Block", "lod.config.client.advanced.graphics.quality.lodChunkRenderDistance": "LOD Render Distance", @@ -121,17 +121,17 @@ "lod.config.client.advanced.graphics.fog": "Fog", - "lod.config.client.advanced.graphics.fog.fogDrawMode": + "lod.config.client.advanced.graphics.fog.drawMode": "Fog Draw Mode", - "lod.config.client.advanced.graphics.fog.fogDrawMode.@tooltip": + "lod.config.client.advanced.graphics.fog.drawMode.@tooltip": "When fog will be rendered on the LODs.", - "lod.config.client.advanced.graphics.fog.fogDistance": + "lod.config.client.advanced.graphics.fog.distance": "Fog Distance", - "lod.config.client.advanced.graphics.fog.fogDistance.@tooltip": + "lod.config.client.advanced.graphics.fog.distance.@tooltip": "The distance(s) Fog will be rendered on the LODs.", - "lod.config.client.advanced.graphics.fog.fogColorMode": + "lod.config.client.advanced.graphics.fog.colorMode": "Fog Color Mode", - "lod.config.client.advanced.graphics.fog.fogColorMode.@tooltip": + "lod.config.client.advanced.graphics.fog.colorMode.@tooltip": "The color of the fog on LODs.", "lod.config.client.advanced.graphics.fog.disableVanillaFog": "Disable Vanilla Fog", @@ -167,10 +167,7 @@ "lod.config.client.advanced.graphics.fog.advancedFog.heightFog": "Height Fog Options", - - "lod.config.client.advanced.graphics.fog.advancedFog.heightFog.heightFogConfigScreenNote": - "", - + "lod.config.client.advanced.graphics.fog.advancedFog.heightFog.heightFogMixMode": "Height Fog Mix Mode", "lod.config.client.advanced.graphics.fog.advancedFog.heightFog.heightFogMixMode.@tooltip": @@ -179,9 +176,9 @@ "Height Fog Mode", "lod.config.client.advanced.graphics.fog.advancedFog.heightFog.heightFogMode.@tooltip": "Where should the height fog be located? \n\nABOVE_CAMERA: Height fog starts from camera to the sky \nBELOW_CAMERA: Height fog starts from camera to the void \nABOVE_AND_BELOW_CAMERA: Height fog starts from camera to both the sky and the void \nABOVE_SET_HEIGHT: Height fog starts from a set height to the sky \nBELOW_SET_HEIGHT: Height fog starts from a set height to the void \nABOVE_AND_BELOW_SET_HEIGHT: Height fog starts from a set height to both the sky and the void \n", - "lod.config.client.advanced.graphics.fog.advancedFog.heightFog.heightFogHeight": - "Height Fog Set Height", - "lod.config.client.advanced.graphics.fog.advancedFog.heightFog.heightFogHeight.@tooltip": + "lod.config.client.advanced.graphics.fog.advancedFog.heightFog.heightFogBaseHeight": + "Height Fog Base Height", + "lod.config.client.advanced.graphics.fog.advancedFog.heightFog.heightFogBaseHeight.@tooltip": "If the height fog is calculated around a set height, what is that height position? ", "lod.config.client.advanced.graphics.fog.advancedFog.heightFog.heightFogStart": "Height Fog Start", @@ -212,9 +209,9 @@ "lod.config.client.advanced.graphics.noiseTextureSettings": "Noise Texture", - "lod.config.client.advanced.graphics.noiseTextureSettings.noiseEnable": + "lod.config.client.advanced.graphics.noiseTextureSettings.noiseEnabled": "Enable Noise Texture", - "lod.config.client.advanced.graphics.noiseTextureSettings.noiseEnable.@tooltip": + "lod.config.client.advanced.graphics.noiseTextureSettings.noiseEnabled.@tooltip": "If enabled a noise texture will be applied to LODs to simulate textures.", "lod.config.client.advanced.graphics.noiseTextureSettings.noiseSteps": "Noise Steps", @@ -291,9 +288,9 @@ "Server Folder Mode", "lod.config.client.multiplayer.serverFolderNameMode.@tooltip": "Determines the folder format for local multiplayer data.\n\n§6Name Only:§r\nUses the server browser name. Ex: \"Minecraft Server\"\n§6Name IP:§r\n\"Minecraft Server, IP 192.168.1.40\"\n§6Name, IP, Port:§r\n\"Minecraft Server, IP 192.168.1.40:25565\"\n§6Name, IP, Port, MC Version:§r\n\"Minecraft Server, IP 192.168.1.40:25565, GameVersion 1.18.1\"\n\n§c§lCaution:§r changing while connected to a multiplayer server may cause glitches.", - "lod.config.client.advanced.multiplayer.multiDimensionRequiredSimilarity": - "Multiverse Dimension Required Similarity", - "lod.config.client.multiplayer.multiDimensionRequiredSimilarity.@tooltip": + "lod.config.client.advanced.multiplayer.multiverseSimilarityRequiredPercent": + "Multiverse Required Similarity %", + "lod.config.client.advanced.multiplayer.multiverseSimilarityRequiredPercent.@tooltip": "When matching worlds of the same dimension type the\ntested chunk(s) must be at least this percent the same\nin order to be considered the same world.\n\nNote: If you use portals to enter a dimension at two\ndifferent locations this system may think it is two different worlds.\n\n§61.0:§r the chunks must be identical.\n§60.5:§r the chunks must be half the same.\n§60.0:§r disables multi-dimension support\n only one world will be used per dimension.", @@ -469,15 +466,15 @@ "lod.config.enum.EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU": "I Paid For The Whole CPU", - "lod.config.enum.EHorizontalResolution.BLOCK": + "lod.config.enum.EMaxHorizontalResolution.BLOCK": "Block", - "lod.config.enum.EHorizontalResolution.TWO_BLOCKS": + "lod.config.enum.EMaxHorizontalResolution.TWO_BLOCKS": "2 blocks", - "lod.config.enum.EHorizontalResolution.FOUR_BLOCKS": + "lod.config.enum.EMaxHorizontalResolution.FOUR_BLOCKS": "4 blocks", - "lod.config.enum.EHorizontalResolution.HALF_CHUNK": + "lod.config.enum.EMaxHorizontalResolution.HALF_CHUNK": "Half a chunk", - "lod.config.enum.EHorizontalResolution.CHUNK": + "lod.config.enum.EMaxHorizontalResolution.CHUNK": "Chunk", "lod.config.enum.EVerticalQuality.HEIGHT_MAP": @@ -635,15 +632,15 @@ "lod.config.enum.ERendererMode.DISABLED": "Disabled", - "lod.config.enum.EDebugMode.OFF": + "lod.config.enum.EDebugRendering.OFF": "Off", - "lod.config.enum.EDebugMode.SHOW_DETAIL": + "lod.config.enum.EDebugRendering.SHOW_DETAIL": "Show detail", - "lod.config.enum.EDebugMode.SHOW_GENMODE": + "lod.config.enum.EDebugRendering.SHOW_GENMODE": "Show generation mode", - "lod.config.enum.EDebugMode.SHOW_OVERLAPPING_QUADS": + "lod.config.enum.EDebugRendering.SHOW_OVERLAPPING_QUADS": "Show overlapping quads", - "lod.config.enum.EDebugMode.SHOW_RENDER_SOURCE_FLAG": + "lod.config.enum.EDebugRendering.SHOW_RENDER_SOURCE_FLAG": "Show render source flag", "lod.config.enum.ELoggerMode.DISABLED":