Merge remote-tracking branch 'origin/main'

# Conflicts:
#	core/src/main/java/com/seibel/lod/core/render/glObject/GLProxy.java
This commit is contained in:
TomTheFurry
2023-06-15 16:41:57 +08:00
49 changed files with 1074 additions and 709 deletions
+2 -2
View File
@@ -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
@@ -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 <br>
* 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<EHorizontalResolution> lowerDetails = new ArrayList<>();
ArrayList<EMaxHorizontalResolution> 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);
@@ -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)
{
@@ -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();
}
@@ -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<Boolean> getEnableDistantWorldGeneration();
IDhApiConfigValue<Boolean> enableDistantWorldGeneration();
/** Defines to what level fake chunks will be generated. */
IDhApiConfigValue<EDhApiDistantGeneratorMode> getDistantGeneratorMode();
IDhApiConfigValue<EDhApiDistantGeneratorMode> distantGeneratorMode();
/**
* Defines what blocks will be ignored when generating LODs. <br><br>
*
* 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 <br>
* (vs the color based system we have currently)
/**
* TODO
*/
@Deprecated
IDhApiConfigValue<EBlocksToAvoid> getBlocksToAvoid();
/**
* Defines if the color of avoided blocks will color the block below them. <Br>
* (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 <br>
* (vs the color based system we have currently)
*/
@Deprecated
IDhApiConfigValue<Boolean> getTintWithAvoidedBlocks();
IDhApiConfigValue<ELightGenerationMode> lightingEngine();
}
@@ -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<EDebugMode> getDebugRenderMode();
IDhApiConfigValue<EDebugRendering> debugRendering();
/** If enabled debug keybindings can be used. */
IDhApiConfigValue<Boolean> getEnableDebugKeybindings();
IDhApiConfigValue<Boolean> debugKeybindings();
/** TODO */
IDhApiConfigValue<Boolean> renderWireframe();
/** TODO */
IDhApiConfigValue<Boolean> lodOnlyMode();
/** TODO */
IDhApiConfigValue<Boolean> debugWireframeRendering();
}
@@ -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 <https://www.gnu.org/licenses/>.
*/
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. <br><br>
*
* 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. <br>
* Can be greater than the fog end distance to invert the fog direction. <br> <br>
*
* 0.0 = fog starts at the camera <br>
* 1.0 = fog starts at the edge of the fake chunk render distance <br>
*/
IDhApiConfigValue<Double> farFogStartDistance();
/**
* Defines where the fog ends as a percent of the radius
* of the fake chunks render distance. <br>
* Can be less than the fog start distance to invert the fog direction. <br> <br>
*
* 0.0 = fog ends at the camera <br>
* 1.0 = fog ends at the edge of the fake chunk render distance <br>
*/
IDhApiConfigValue<Double> farFogEndDistance();
/** Defines how opaque the fog is at its thinnest point. */
IDhApiConfigValue<Double> farFogMinThickness();
/** Defines how opaque the fog is at its thickest point. */
IDhApiConfigValue<Double> farFogMaxThickness();
/** Defines how the fog changes in thickness. */
IDhApiConfigValue<EFogFalloff> farFogFalloff();
/** Defines the fog density. */
IDhApiConfigValue<Double> farFogDensity();
}
@@ -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 <https://www.gnu.org/licenses/>.
*/
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. <br><br>
*
* 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<EFogDistance> distance();
/** Should be used to enable/disable fog rendering. */
IDhApiConfigValue<EFogDrawMode> drawMode();
/** Can be used to enable support with mods that change vanilla MC's fog color. */
IDhApiConfigValue<EFogColorMode> color();
/**
* If enabled attempts to disable vanilla MC's fog on real chunks. <br>
* May not play nice with other fog editing mods.
*/
IDhApiConfigValue<Boolean> disableVanillaFog();
}
@@ -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<EGpuUploadMethod> getGpuUploadMethod();
IDhApiConfigValue<EGpuUploadMethod> 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<Integer> getBufferUploadTimeoutPerMegabyteInMilliseconds();
IDhApiConfigValue<Integer> gpuUploadPerMegabyteInMilliseconds();
}
@@ -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<Integer> getChunkRenderDistance();
IDhApiConfigValue<Integer> chunkRenderDistance();
/**
* Simplified version of {@link IDhApiGraphicsConfig#getRenderingMode()}
* Simplified version of {@link IDhApiGraphicsConfig#renderingMode()}
* that only enables/disables the fake chunk rendering. <br><br>
*
* Changing this config also changes {@link IDhApiGraphicsConfig#getRenderingMode()}'s value.
* Changing this config also changes {@link IDhApiGraphicsConfig#renderingMode()}'s value.
*/
IDhApiConfigValue<Boolean> getRenderingEnabled();
IDhApiConfigValue<Boolean> renderingEnabled();
/**
* Can be used to enable/disable fake chunk rendering or enable the debug renderer. <br><br>
@@ -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). <br><br>
*
* Changing this config also changes {@link IDhApiGraphicsConfig#getRenderingEnabled()}'s value.
* Changing this config also changes {@link IDhApiGraphicsConfig#renderingEnabled()}'s value.
*/
IDhApiConfigValue<ERendererMode> getRenderingMode();
IDhApiConfigValue<ERendererMode> renderingMode();
@@ -65,14 +74,27 @@ public interface IDhApiGraphicsConfig extends IDhApiConfigGroup
//==================//
/** Defines how detailed fake chunks are in the horizontal direction */
IDhApiConfigValue<EHorizontalResolution> getMaxDetailLevel();
IDhApiConfigValue<EMaxHorizontalResolution> maxHorizontalResolution();
/** Defines how detailed fake chunks are in the vertical direction */
IDhApiConfigValue<EVerticalQuality> getVerticalQuality();
IDhApiConfigValue<EVerticalQuality> verticalQuality();
/** Modifies the quadratic function fake chunks use for horizontal quality drop-off. */
IDhApiConfigValue<EHorizontalQuality> getHorizontalQualityDropoff();
IDhApiConfigValue<EHorizontalQuality> horizontalQuality();
IDhApiConfigValue<Boolean> ambientOcclusion();
IDhApiConfigValue<ETransparency> transparency();
/** Defines what blocks won't be rendered as LODs. */
IDhApiConfigValue<EBlocksToAvoid> blocksToAvoid();
/**
* Defines if the color of avoided blocks will color the block below them. <Br>
* (IE: if flowers are avoided, should they color the grass below them?)
*/
IDhApiConfigValue<Boolean> tintWithAvoidedBlocks();
/**
* The same as vanilla Minecraft's biome blending. <br><br>
*
@@ -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<Boolean> getUseExtendedNearClipPlane();
IDhApiConfigValue<EOverdrawPrevention> overdrawPrevention();
/**
* Modifies how bright fake chunks are. <br>
* This is done when generating the vertex data and is applied before any shaders.
*/
IDhApiConfigValue<Double> getBrightnessMultiplier();
IDhApiConfigValue<Double> brightnessMultiplier();
/**
* Modifies how saturated fake chunks are. <br>
* This is done when generating the vertex data and is applied before any shaders.
*/
IDhApiConfigValue<Double> getSaturationMultiplier();
IDhApiConfigValue<Double> saturationMultiplier();
/** Defines if Distant Horizons should attempt to cull fake chunk cave geometry. */
IDhApiConfigValue<Boolean> getCaveCullingEnabled();
IDhApiConfigValue<Boolean> caveCullingEnabled();
/** Defines what height cave culling should be used below if enabled. */
IDhApiConfigValue<Integer> getCaveCullingHeight();
IDhApiConfigValue<Integer> caveCullingHeight();
/** This ratio is relative to Earth's real world curvature. */
IDhApiConfigValue<Integer> getEarthCurvatureRatio();
IDhApiConfigValue<Integer> earthCurvatureRatio();
/** If enabled vanilla chunk rendering is disabled and only fake chunks are rendered. */
IDhApiConfigValue<Boolean> getEnableLodOnlyMode();
IDhApiConfigValue<Boolean> lodOnlyMode();
/**
* TODO
*/
IDhApiConfigValue<Double> lodBias();
}
@@ -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 <https://www.gnu.org/licenses/>.
*/
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. <br><br>
*
* 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<EFogDistance> getFogDistance();
/** Should be used to enable/disable fog rendering. */
IDhApiConfigValue<EFogDrawMode> getFogRender();
/** Can be used to enable support with mods that change vanilla MC's fog color. */
IDhApiConfigValue<EFogColorMode> getFogColor();
/**
* If enabled attempts to disable vanilla MC's fog on real chunks. <br>
* May not play nice with other fog editing mods.
*/
IDhApiConfigValue<Boolean> getDisableVanillaFog();
//=======================//
// advanced fog settings //
//=======================//
/**
* Defines where the fog starts as a percent of the
* fake chunks render distance radius. <br>
* Can be greater than the fog end distance to invert the fog direction. <br> <br>
*
* 0.0 = fog starts at the camera <br>
* 1.0 = fog starts at the edge of the fake chunk render distance <br>
*/
IDhApiConfigValue<Double> getFogStartDistance();
/**
* Defines where the fog ends as a percent of the radius
* of the fake chunks render distance. <br>
* Can be less than the fog start distance to invert the fog direction. <br> <br>
*
* 0.0 = fog ends at the camera <br>
* 1.0 = fog ends at the edge of the fake chunk render distance <br>
*/
IDhApiConfigValue<Double> getFogEndDistance();
/** Defines how opaque the fog is at its thinnest point. */
IDhApiConfigValue<Double> getFogMinThickness();
/** Defines how opaque the fog is at its thickest point. */
IDhApiConfigValue<Double> getFogMaxThickness();
/** Defines how the fog changes in thickness. */
IDhApiConfigValue<EFogFalloff> getFarFogFalloff();
/** Defines the fog density. */
IDhApiConfigValue<Double> getFogDensity();
//=====================//
// height fog settings //
//=====================//
/** Defines how the height fog mixes. */
IDhApiConfigValue<EHeightFogMixMode> getHeightFogMixMode();
/** Defines how the height fog is drawn relative to the camera or world. */
IDhApiConfigValue<EHeightFogMode> getHeightFogMode();
/**
* Defines the height fog's base height if {@link IDhApiGraphicsFogConfig#getHeightFogMode()}
* is set to use a specific height.
*/
IDhApiConfigValue<Double> getHeightFogBaseHeight();
/** Defines the height fog's starting height as a percent of the world height. */
IDhApiConfigValue<Double> getHeightFogStartingHeightPercent();
/** Defines the height fog's ending height as a percent of the world height. */
IDhApiConfigValue<Double> getHeightFogEndingHeightPercent();
/** Defines how opaque the height fog is at its thinnest point. */
IDhApiConfigValue<Double> getHeightFogMinThickness();
/** Defines how opaque the height fog is at its thickest point. */
IDhApiConfigValue<Double> getHeightFogMaxThickness();
/** Defines how the height fog changes in thickness. */
IDhApiConfigValue<EFogFalloff> getHeightFogFalloff();
/** Defines the height fog's density. */
IDhApiConfigValue<Double> getHeightFogDensity();
}
@@ -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 <https://www.gnu.org/licenses/>.
*/
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. <br><br>
*
* 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<EHeightFogMixMode> heightFogMixMode();
/** Defines how the height fog is drawn relative to the camera or world. */
IDhApiConfigValue<EHeightFogMode> heightFogMode();
/**
* Defines the height fog's base height if {@link IDhApiHeightFogConfig#heightFogMode()}
* is set to use a specific height.
*/
IDhApiConfigValue<Double> heightFogBaseHeight();
/** Defines the height fog's starting height as a percent of the world height. */
IDhApiConfigValue<Double> heightFogStartingHeightPercent();
/** Defines the height fog's ending height as a percent of the world height. */
IDhApiConfigValue<Double> heightFogEndingHeightPercent();
/** Defines how opaque the height fog is at its thinnest point. */
IDhApiConfigValue<Double> heightFogMinThickness();
/** Defines how opaque the height fog is at its thickest point. */
IDhApiConfigValue<Double> heightFogMaxThickness();
/** Defines how the height fog changes in thickness. */
IDhApiConfigValue<EFogFalloff> heightFogFalloff();
/** Defines the height fog's density. */
IDhApiConfigValue<Double> heightFogDensity();
}
@@ -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 <https://www.gnu.org/licenses/>.
*/
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. <br><br>
*
* @author James Seibel
* @version 2022-6-14
*/
public interface IDhApiLoggingConfig extends IDhApiConfigGroup
{
// TODO implement
}
@@ -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. <br>
* <br>
* 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. <br> <br>
*
* @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<Integer> getWorldGeneratorThread();
IDhApiConfigValue<Integer> worldGeneratorThreads();
/** Defines how many buffer (GPU Terrain data) builder threads are used. */
IDhApiConfigValue<Integer> getBufferBuilderThread();
IDhApiConfigValue<Integer> bufferBuilderThreads();
/** Defines how many file handler threads are used. */
IDhApiConfigValue<Integer> getFileHandlerThread();
IDhApiConfigValue<Integer> fileHandlerThreads();
/**
* Defines how many Full to Render data converter threads are used. <br><br>
@@ -56,6 +52,11 @@ public interface IDhApiThreadingConfig extends IDhApiConfigGroup
* <strong>Full data</strong> - Distant Horizons data based on BlockState and Biome IDs <br>
* <strong>Render data</strong> - color data used when Distant Horizons is rendering
*/
IDhApiConfigValue<Integer> getDataConverterThread();
IDhApiConfigValue<Integer> dataConverterThreads();
/**
* TODO
*/
IDhApiConfigValue<Integer> chunkLodConverterThreads();
}
@@ -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. <br>
* Note: Changing this while connected to a multiplayer world will cause undefined behavior!
*/
IDhApiConfigValue<EServerFolderNameMode> getFolderSavingMode();
IDhApiConfigValue<EServerFolderNameMode> 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<Double> getMultiverseSimilarityRequirement();
IDhApiConfigValue<Double> multiverseSimilarityRequirement();
}
@@ -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 <https://www.gnu.org/licenses/>.
*/
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. <br><br>
*
* @author James Seibel
* @version 2022-6-14
*/
public interface IDhApiNoiseTextureConfig extends IDhApiConfigGroup
{
/**
* TODO
*/
IDhApiConfigValue<Boolean> noiseEnabled();
/**
* TODO
*/
IDhApiConfigValue<Integer> noiseSteps();
/**
* TODO
*/
IDhApiConfigValue<Double> noiseIntensity();
/**
* TODO
*/
IDhApiConfigValue<Double> noiseDropoff();
}
@@ -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; }
}
@@ -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<EDebugMode> getDebugRenderMode()
{ return new DhApiConfigValue<>(Debugging.debugMode); }
public IDhApiConfigValue<EDebugRendering> debugRendering()
{ return new DhApiConfigValue<EDebugRendering, EDebugRendering>(Debugging.debugRendering); }
public IDhApiConfigValue<Boolean> getEnableDebugKeybindings()
{ return new DhApiConfigValue<>(Debugging.enableDebugKeybindings); }
public IDhApiConfigValue<Boolean> debugKeybindings()
{ return new DhApiConfigValue<Boolean, Boolean>(Debugging.enableDebugKeybindings); }
public IDhApiConfigValue<Boolean> renderWireframe()
{ return new DhApiConfigValue<Boolean, Boolean>(Debugging.renderWireframe); }
public IDhApiConfigValue<Boolean> lodOnlyMode()
{ return new DhApiConfigValue<Boolean, Boolean>(Debugging.lodOnlyMode); }
public IDhApiConfigValue<Boolean> debugWireframeRendering()
{ return new DhApiConfigValue<Boolean, Boolean>(Debugging.debugWireframeRendering); }
}
@@ -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 <https://www.gnu.org/licenses/>.
*/
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<Double> farFogStartDistance()
{ return new DhApiConfigValue<Double, Double>(Fog.AdvancedFog.farFogStart); }
@Override
public IDhApiConfigValue<Double> farFogEndDistance()
{ return new DhApiConfigValue<Double, Double>(Fog.AdvancedFog.farFogEnd); }
@Override
public IDhApiConfigValue<Double> farFogMinThickness()
{ return new DhApiConfigValue<Double, Double>(Fog.AdvancedFog.farFogMin); }
@Override
public IDhApiConfigValue<Double> farFogMaxThickness()
{ return new DhApiConfigValue<Double, Double>(Fog.AdvancedFog.farFogMax); }
@Override
public IDhApiConfigValue<EFogFalloff> farFogFalloff()
{ return new DhApiConfigValue<EFogFalloff, EFogFalloff>(Fog.AdvancedFog.farFogFalloff); }
@Override
public IDhApiConfigValue<Double> farFogDensity()
{ return new DhApiConfigValue<Double, Double>(Fog.AdvancedFog.farFogDensity); }
}
@@ -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 <https://www.gnu.org/licenses/>.
*/
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<EFogDistance> distance()
{ return new DhApiConfigValue<>(Fog.distance); }
@Override
public IDhApiConfigValue<EFogDrawMode> drawMode()
{ return new DhApiConfigValue<>(Fog.drawMode); }
@Override
public IDhApiConfigValue<EFogColorMode> color()
{ return new DhApiConfigValue<>(Fog.colorMode); }
@Override
public IDhApiConfigValue<Boolean> disableVanillaFog()
{ return new DhApiConfigValue<>(Fog.disableVanillaFog); }
}
@@ -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<EGpuUploadMethod> getGpuUploadMethod()
public IDhApiConfigValue<EGpuUploadMethod> gpuUploadMethod()
{ return new DhApiConfigValue<>(Config.Client.Advanced.GpuBuffers.gpuUploadMethod); }
public IDhApiConfigValue<Integer> getBufferUploadTimeoutPerMegabyteInMilliseconds()
public IDhApiConfigValue<Integer> gpuUploadPerMegabyteInMilliseconds()
{ return new DhApiConfigValue<>(GpuBuffers.gpuUploadPerMegabyteInMilliseconds); }
}
@@ -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<Integer> getChunkRenderDistance()
{ return new DhApiConfigValue<>(Quality.lodChunkRenderDistance); }
public IDhApiConfigValue<Integer> chunkRenderDistance()
{ return new DhApiConfigValue<Integer, Integer>(Quality.lodChunkRenderDistance); }
@Override
public IDhApiConfigValue<Boolean> getRenderingEnabled()
{ return new DhApiConfigValue<ERendererMode, Boolean>(Debugging.rendererMode, new RenderModeEnabledConverter()); }
public IDhApiConfigValue<Boolean> renderingEnabled()
{ return new DhApiConfigValue<Boolean, Boolean>(Config.Client.quickEnableRendering); }
@Override
public IDhApiConfigValue<ERendererMode> getRenderingMode()
{ return new DhApiConfigValue<>(Debugging.rendererMode); }
public IDhApiConfigValue<ERendererMode> renderingMode()
{ return new DhApiConfigValue<ERendererMode, ERendererMode>(Debugging.rendererMode); }
@@ -66,20 +72,37 @@ public class DhApiGraphicsConfig implements IDhApiGraphicsConfig
//==================//
@Override
public IDhApiConfigValue<EHorizontalResolution> getMaxDetailLevel()
{ return new DhApiConfigValue<>(Quality.drawResolution); }
public IDhApiConfigValue<EMaxHorizontalResolution> maxHorizontalResolution()
{ return new DhApiConfigValue<EMaxHorizontalResolution, EMaxHorizontalResolution>(Quality.maxHorizontalResolution); }
@Override
public IDhApiConfigValue<EVerticalQuality> getVerticalQuality()
{ return new DhApiConfigValue<>(Quality.verticalQuality); }
public IDhApiConfigValue<EVerticalQuality> verticalQuality()
{ return new DhApiConfigValue<EVerticalQuality, EVerticalQuality>(Quality.verticalQuality); }
@Override
public IDhApiConfigValue<EHorizontalQuality> getHorizontalQualityDropoff()
{ return new DhApiConfigValue<>(Quality.horizontalQuality); }
public IDhApiConfigValue<EHorizontalQuality> horizontalQuality()
{ return new DhApiConfigValue<EHorizontalQuality, EHorizontalQuality>(Quality.horizontalQuality); }
@Override
public IDhApiConfigValue<Boolean> ambientOcclusion()
{ return new DhApiConfigValue<Boolean, Boolean>(Quality.ssao); }
@Override
public IDhApiConfigValue<ETransparency> transparency()
{ return new DhApiConfigValue<ETransparency, ETransparency>(Quality.transparency); }
@Override
public IDhApiConfigValue<EBlocksToAvoid> blocksToAvoid()
{ return new DhApiConfigValue<EBlocksToAvoid, EBlocksToAvoid>(Quality.blocksToIgnore); }
@Override
public IDhApiConfigValue<Boolean> tintWithAvoidedBlocks()
{ return new DhApiConfigValue<Boolean, Boolean>(Quality.tintWithAvoidedBlocks); }
// TODO re-implement
// @Override
// public IDhApiConfigValue<Integer> getBiomeBlending()
// { return new DhApiConfigValue<>(Quality.lodBiomeBlending); }
// { return new DhApiConfigValue<Integer, Integer>(Quality.lodBiomeBlending); }
@@ -89,35 +112,39 @@ public class DhApiGraphicsConfig implements IDhApiGraphicsConfig
// @Override
// public IDhApiConfigValue<Boolean> getDisableDirectionalCulling()
// { return new DhApiConfigValue<>(AdvancedGraphics.disableDirectionalCulling); }
// { return new DhApiConfigValue<Boolean, Boolean>(AdvancedGraphics.disableDirectionalCulling); }
@Override
public IDhApiConfigValue<Boolean> getUseExtendedNearClipPlane()
{ return new DhApiConfigValue<>(AdvancedGraphics.overdrawPrevention); }
public IDhApiConfigValue<EOverdrawPrevention> overdrawPrevention()
{ return new DhApiConfigValue<EOverdrawPrevention, EOverdrawPrevention>(AdvancedGraphics.overdrawPrevention); }
@Override
public IDhApiConfigValue<Double> getBrightnessMultiplier()
{ return new DhApiConfigValue<>(AdvancedGraphics.brightnessMultiplier); }
public IDhApiConfigValue<Double> brightnessMultiplier()
{ return new DhApiConfigValue<Double, Double>(AdvancedGraphics.brightnessMultiplier); }
@Override
public IDhApiConfigValue<Double> getSaturationMultiplier()
{ return new DhApiConfigValue<>(AdvancedGraphics.saturationMultiplier); }
public IDhApiConfigValue<Double> saturationMultiplier()
{ return new DhApiConfigValue<Double, Double>(AdvancedGraphics.saturationMultiplier); }
@Override
public IDhApiConfigValue<Boolean> getCaveCullingEnabled()
{ return new DhApiConfigValue<>(AdvancedGraphics.enableCaveCulling); }
public IDhApiConfigValue<Boolean> caveCullingEnabled()
{ return new DhApiConfigValue<Boolean, Boolean>(AdvancedGraphics.enableCaveCulling); }
@Override
public IDhApiConfigValue<Integer> getCaveCullingHeight()
{ return new DhApiConfigValue<>(AdvancedGraphics.caveCullingHeight); }
public IDhApiConfigValue<Integer> caveCullingHeight()
{ return new DhApiConfigValue<Integer, Integer>(AdvancedGraphics.caveCullingHeight); }
@Override
public IDhApiConfigValue<Integer> getEarthCurvatureRatio()
{ return new DhApiConfigValue<>(AdvancedGraphics.earthCurveRatio); }
public IDhApiConfigValue<Integer> earthCurvatureRatio()
{ return new DhApiConfigValue<Integer, Integer>(AdvancedGraphics.earthCurveRatio); }
@Override
public IDhApiConfigValue<Boolean> getEnableLodOnlyMode()
{ return new DhApiConfigValue<>(Debugging.lodOnlyMode); }
public IDhApiConfigValue<Boolean> lodOnlyMode()
{ return new DhApiConfigValue<Boolean, Boolean>(Debugging.lodOnlyMode); }
@Override
public IDhApiConfigValue<Double> lodBias()
{ return new DhApiConfigValue<Double, Double>(AdvancedGraphics.lodBias); }
@@ -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 <https://www.gnu.org/licenses/>.
*/
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. <br><br>
*
* 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<EFogDistance> getFogDistance()
{ return new DhApiConfigValue<>(Fog.fogDistance); }
@Override
public IDhApiConfigValue<EFogDrawMode> getFogRender()
{ return new DhApiConfigValue<>(Fog.fogDrawMode); }
@Override
public IDhApiConfigValue<EFogColorMode> getFogColor()
{ return new DhApiConfigValue<>(Fog.fogColorMode); }
@Override
public IDhApiConfigValue<Boolean> getDisableVanillaFog()
{ return new DhApiConfigValue<>(Fog.disableVanillaFog); }
//=======================//
// advanced fog settings //
//=======================//
@Override
public IDhApiConfigValue<Double> getFogStartDistance()
{ return new DhApiConfigValue<>(Fog.AdvancedFog.farFogStart); }
@Override
public IDhApiConfigValue<Double> getFogEndDistance()
{ return new DhApiConfigValue<>(Fog.AdvancedFog.farFogEnd); }
@Override
public IDhApiConfigValue<Double> getFogMinThickness()
{ return new DhApiConfigValue<>(Fog.AdvancedFog.farFogMin); }
@Override
public IDhApiConfigValue<Double> getFogMaxThickness()
{ return new DhApiConfigValue<>(Fog.AdvancedFog.farFogMax); }
@Override
public IDhApiConfigValue<EFogFalloff> getFarFogFalloff()
{ return new DhApiConfigValue<>(Fog.AdvancedFog.farFogFalloff); }
@Override
public IDhApiConfigValue<Double> getFogDensity()
{ return new DhApiConfigValue<>(Fog.AdvancedFog.farFogDensity); }
//=====================//
// height fog settings //
//=====================//
@Override
public IDhApiConfigValue<EHeightFogMixMode> getHeightFogMixMode()
{ return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogMixMode); }
@Override
public IDhApiConfigValue<EHeightFogMode> getHeightFogMode()
{ return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogMode); }
@Override
public IDhApiConfigValue<Double> getHeightFogBaseHeight()
{ return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogHeight); }
@Override
public IDhApiConfigValue<Double> getHeightFogStartingHeightPercent()
{ return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogStart); }
@Override
public IDhApiConfigValue<Double> getHeightFogEndingHeightPercent()
{ return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogEnd); }
@Override
public IDhApiConfigValue<Double> getHeightFogMinThickness()
{ return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogMin); }
@Override
public IDhApiConfigValue<Double> getHeightFogMaxThickness()
{ return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogMax); }
@Override
public IDhApiConfigValue<EFogFalloff> getHeightFogFalloff()
{ return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogFalloff); }
@Override
public IDhApiConfigValue<Double> getHeightFogDensity()
{ return new DhApiConfigValue<>(Fog.AdvancedFog.HeightFog.heightFogDensity); }
}
@@ -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 <https://www.gnu.org/licenses/>.
*/
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<EHeightFogMixMode> heightFogMixMode()
{ return new DhApiConfigValue<EHeightFogMixMode, EHeightFogMixMode>(Fog.AdvancedFog.HeightFog.heightFogMixMode); }
@Override
public IDhApiConfigValue<EHeightFogMode> heightFogMode()
{ return new DhApiConfigValue<EHeightFogMode, EHeightFogMode>(Fog.AdvancedFog.HeightFog.heightFogMode); }
@Override
public IDhApiConfigValue<Double> heightFogBaseHeight()
{ return new DhApiConfigValue<Double, Double>(Fog.AdvancedFog.HeightFog.heightFogBaseHeight); }
@Override
public IDhApiConfigValue<Double> heightFogStartingHeightPercent()
{ return new DhApiConfigValue<Double, Double>(Fog.AdvancedFog.HeightFog.heightFogStart); }
@Override
public IDhApiConfigValue<Double> heightFogEndingHeightPercent()
{ return new DhApiConfigValue<Double, Double>(Fog.AdvancedFog.HeightFog.heightFogEnd); }
@Override
public IDhApiConfigValue<Double> heightFogMinThickness()
{ return new DhApiConfigValue<Double, Double>(Fog.AdvancedFog.HeightFog.heightFogMin); }
@Override
public IDhApiConfigValue<Double> heightFogMaxThickness()
{ return new DhApiConfigValue<Double, Double>(Fog.AdvancedFog.HeightFog.heightFogMax); }
@Override
public IDhApiConfigValue<EFogFalloff> heightFogFalloff()
{ return new DhApiConfigValue<EFogFalloff, EFogFalloff>(Fog.AdvancedFog.HeightFog.heightFogFalloff); }
@Override
public IDhApiConfigValue<Double> heightFogDensity()
{ return new DhApiConfigValue<Double, Double>(Fog.AdvancedFog.HeightFog.heightFogDensity); }
}
@@ -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 <https://www.gnu.org/licenses/>.
*/
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<Integer> worldGeneratorThreads()
{ return new DhApiConfigValue<Integer, Integer>(MultiThreading.numberOfWorldGenerationThreads); }
@Override
public IDhApiConfigValue<Integer> bufferBuilderThreads()
{ return new DhApiConfigValue<Integer, Integer>(MultiThreading.numberOfBufferBuilderThreads); }
@Override
public IDhApiConfigValue<Integer> fileHandlerThreads()
{ return new DhApiConfigValue<Integer, Integer>(MultiThreading.numberOfFileHandlerThreads); }
@Override
public IDhApiConfigValue<Integer> dataConverterThreads()
{ return new DhApiConfigValue<Integer, Integer>(MultiThreading.numberOfDataConverterThreads); }
@Override
public IDhApiConfigValue<Integer> chunkLodConverterThreads()
{ return new DhApiConfigValue<Integer, Integer>(MultiThreading.numberOfChunkLodConverterThreads); }
}
@@ -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<EServerFolderNameMode> getFolderSavingMode()
{ return new DhApiConfigValue<>(Multiplayer.serverFolderNameMode); }
public IDhApiConfigValue<EServerFolderNameMode> folderSavingMode()
{ return new DhApiConfigValue<EServerFolderNameMode, EServerFolderNameMode>(Multiplayer.serverFolderNameMode); }
public IDhApiConfigValue<Double> getMultiverseSimilarityRequirement()
{ return new DhApiConfigValue<>(Multiplayer.multiDimensionRequiredSimilarity); }
public IDhApiConfigValue<Double> multiverseSimilarityRequirement()
{ return new DhApiConfigValue<Double, Double>(Multiplayer.multiverseSimilarityRequiredPercent); }
}
@@ -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<Integer> getWorldGeneratorThread()
{ return new DhApiConfigValue<>(MultiThreading.numberOfWorldGenerationThreads); }
public IDhApiConfigValue<Boolean> noiseEnabled()
{ return new DhApiConfigValue<Boolean, Boolean>(NoiseTextureSettings.noiseEnabled); }
@Override
public IDhApiConfigValue<Integer> getBufferBuilderThread()
{ return new DhApiConfigValue<>(MultiThreading.numberOfBufferBuilderThreads); }
public IDhApiConfigValue<Integer> noiseSteps()
{ return new DhApiConfigValue<Integer, Integer>(NoiseTextureSettings.noiseSteps); }
@Override
public IDhApiConfigValue<Integer> getFileHandlerThread()
{ return new DhApiConfigValue<>(MultiThreading.numberOfFileHandlerThreads); }
public IDhApiConfigValue<Double> noiseIntensity()
{ return new DhApiConfigValue<Double, Double>(NoiseTextureSettings.noiseIntensity); }
@Override
public IDhApiConfigValue<Integer> getDataConverterThread()
{ return new DhApiConfigValue<>(MultiThreading.numberOfDataConverterThreads); }
public IDhApiConfigValue<Double> noiseDropoff()
{ return new DhApiConfigValue<Double, Double>(NoiseTextureSettings.noiseDropoff); }
}
@@ -17,8 +17,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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. <br><br>
*
* 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<Boolean> getEnableDistantWorldGeneration()
public IDhApiConfigValue<Boolean> enableDistantWorldGeneration()
{ return new DhApiConfigValue<>(WorldGenerator.enableDistantGeneration); }
@Override
public IDhApiConfigValue<EDhApiDistantGeneratorMode> getDistantGeneratorMode()
public IDhApiConfigValue<EDhApiDistantGeneratorMode> distantGeneratorMode()
{ return new DhApiConfigValue<>(WorldGenerator.distantGeneratorMode); }
@Deprecated
@Override
public IDhApiConfigValue<EBlocksToAvoid> getBlocksToAvoid()
{ return new DhApiConfigValue<>(Config.Client.Advanced.Graphics.Quality.blocksToIgnore); }
@Deprecated
@Override
public IDhApiConfigValue<Boolean> getTintWithAvoidedBlocks()
{ return new DhApiConfigValue<>(Config.Client.Advanced.Graphics.Quality.tintWithAvoidedBlocks); }
public IDhApiConfigValue<ELightGenerationMode> lightingEngine()
{ return new DhApiConfigValue<>(WorldGenerator.lightingEngine); }
}
@@ -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)
{
@@ -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<Boolean> quickEnableRendering = new ConfigEntry.Builder<Boolean>()
@@ -147,20 +128,20 @@ public class Config
public static class Quality
{
public static ConfigEntry<EHorizontalResolution> drawResolution = new ConfigEntry.Builder<EHorizontalResolution>()
.set(EHorizontalResolution.BLOCK)
public static ConfigEntry<EMaxHorizontalResolution> maxHorizontalResolution = new ConfigEntry.Builder<EMaxHorizontalResolution>()
.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<Integer> horizontalScale = new ConfigEntry.Builder<Integer>()
.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<Boolean> ssao = new ConfigEntry.Builder<Boolean>()
.set(true)
.comment("Enable Screen Space Ambient Occlusion")
@@ -261,7 +233,7 @@ public class Config
public static class Fog
{
public static ConfigEntry<EFogDrawMode> fogDrawMode = new ConfigEntry.Builder<EFogDrawMode>()
public static ConfigEntry<EFogDrawMode> drawMode = new ConfigEntry.Builder<EFogDrawMode>()
.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<EFogDistance> fogDistance = new ConfigEntry.Builder<EFogDistance>()
public static ConfigEntry<EFogDistance> distance = new ConfigEntry.Builder<EFogDistance>()
.set(EFogDistance.FAR)
.comment("At what distance should Fog be drawn on the LODs?")
.setPerformance(EConfigEntryPerformance.NONE)
.build();
public static ConfigEntry<EFogColorMode> fogColorMode = new ConfigEntry.Builder<EFogColorMode>()
public static ConfigEntry<EFogColorMode> colorMode = new ConfigEntry.Builder<EFogColorMode>()
.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<EHeightFogMixMode> heightFogMixMode = new ConfigEntry.Builder<EHeightFogMixMode>()
.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<Double> heightFogHeight = new ConfigEntry.Builder<Double>()
public static ConfigEntry<Double> heightFogBaseHeight = new ConfigEntry.Builder<Double>()
.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<Boolean> noiseEnable = new ConfigEntry.Builder<Boolean>()
public static ConfigEntry<Boolean> noiseEnabled = new ConfigEntry.Builder<Boolean>()
.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<Double> multiDimensionRequiredSimilarity = new ConfigEntry.Builder<Double>()
public static ConfigEntry<Double> multiverseSimilarityRequiredPercent = new ConfigEntry.Builder<Double>()
.setMinDefaultMax(0.0, 0.0, 1.0)
.comment(""
+ "AKA: Multiverse support. \n"
@@ -805,6 +775,19 @@ public class Config
+ THREAD_NOTE)
.build();
public static final ConfigEntry<Integer> numberOfChunkLodConverterThreads = new ConfigEntry.Builder<Integer>()
.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
@@ -958,15 +941,15 @@ public class Config
+ ERendererMode.DISABLED + ": Disable rendering")
.build();
public static ConfigEntry<EDebugMode> debugMode = new ConfigEntry.Builder<EDebugMode>()
.set(EDebugMode.OFF)
public static ConfigEntry<EDebugRendering> debugRendering = new ConfigEntry.Builder<EDebugRendering>()
.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();
@@ -1076,6 +1059,7 @@ public class Config
}
// TODO implement
public static class ResetConfirmation
{
public static ConfigUIComment resetConfirmationNote = new ConfigUIComment();
@@ -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;
@@ -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<EQualityPreset, EHorizontalResolution> drawResolution = new ConfigEntryWithPresetOptions<>(Config.Client.Advanced.Graphics.Quality.drawResolution,
new HashMap<EQualityPreset, EHorizontalResolution>()
private final ConfigEntryWithPresetOptions<EQualityPreset, EMaxHorizontalResolution> drawResolution = new ConfigEntryWithPresetOptions<>(Config.Client.Advanced.Graphics.Quality.maxHorizontalResolution,
new HashMap<EQualityPreset, EMaxHorizontalResolution>()
{{
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<EQualityPreset, EVerticalQuality> verticalQuality = new ConfigEntryWithPresetOptions<>(Config.Client.Advanced.Graphics.Quality.verticalQuality,
new HashMap<EQualityPreset, EVerticalQuality>()
@@ -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<EThreadPreset, Integer> chunkLodConverters = new ConfigEntryWithPresetOptions<>(Config.Client.Advanced.MultiThreading.numberOfChunkLodConverterThreads,
new HashMap<EThreadPreset, Integer>()
{{
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<EThreadPreset, ?> config : this.configList)
@@ -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;
@@ -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<Integer> configListener;
@@ -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
@@ -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;
}
@@ -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);
@@ -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<DhChunkPos, IChunkWrapper> latestChunkToBuild = new ConcurrentHashMap<>();
private final ConcurrentLinkedDeque<Task> taskToBuild = new ConcurrentLinkedDeque<>();
private final AtomicInteger runningCount = new AtomicInteger(0);
private int threadCount = -1;
private ExecutorService executorThreadPool = null;
private ConfigChangeListener<Integer> configListener;
//==============//
// constructors //
//==============//
public ChunkToLodBuilder() { this.setupExecutorService(); }
//=================//
// data generation //
//=================//
public CompletableFuture<ChunkSizedFullDataAccessor> tryGenerateData(IChunkWrapper chunkWrapper)
{
final DhChunkPos chunkPos;
final CompletableFuture<ChunkSizedFullDataAccessor> future;
Task(DhChunkPos chunkPos, CompletableFuture<ChunkSizedFullDataAccessor> future)
{
this.chunkPos = chunkPos;
this.future = future;
}
}
private final ConcurrentHashMap<DhChunkPos, IChunkWrapper> latestChunkToBuild = new ConcurrentHashMap<>();
private final ConcurrentLinkedDeque<Task> taskToBuild = new ConcurrentLinkedDeque<>();
private final ExecutorService executor = ThreadUtil.makeThreadPool(THREAD_COUNT, ChunkToLodBuilder.class);
private final AtomicInteger runningCount = new AtomicInteger(0);
public ChunkToLodBuilder() { }
public CompletableFuture<ChunkSizedFullDataAccessor> 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<ChunkSizedFullDataAccessor> future = new CompletableFuture<>();
// Otherwise, it means we're the first to do so. Let's submit our task to this entry.
CompletableFuture<ChunkSizedFullDataAccessor> 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<THREAD_COUNT; i++)
for (int i = 0; i< this.threadCount; i++)
{
this.runningCount.incrementAndGet();
CompletableFuture.runAsync(() ->
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. <br>
* 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. <br>
* 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<ChunkSizedFullDataAccessor> future;
Task(DhChunkPos chunkPos, CompletableFuture<ChunkSizedFullDataAccessor> future)
{
this.chunkPos = chunkPos;
this.future = future;
}
}
}
@@ -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. <br>
@@ -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<DhSectionPos, RenderMetaDataFile> filesBySectionPos = new ConcurrentHashMap<>();
private final IDhClientLevel level;
@@ -160,7 +160,7 @@ public class RenderSourceFileHandler implements ILodRenderSourceProvider
public CompletableFuture<ColumnRenderSource> 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<CompletableFuture<Void>> 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<CompletableFuture<Void>> 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();
}
@@ -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)
{
@@ -78,7 +78,7 @@ public class SubDimCompare implements Comparable<SubDimCompare>
/** 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;
}
@@ -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;
@@ -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
@@ -337,7 +337,7 @@ public class LodQuadTree extends QuadTree<LodRenderSection> 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);
}
@@ -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();
}
}
}
@@ -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 com.seibel.lod.core.util.LodUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -458,7 +459,7 @@ public class GLProxy
"Vertex Attribute Buffer Binding: " + (c.glVertexAttribBinding != 0) + " <- optional improvement\n" +
"Buffer Storage: " + (c.glBufferStorage != 0) + " <- optional improvement\n";
}
private static void logMessage(GLMessage msg)
{
GLMessage.ESeverity s = msg.severity;
@@ -466,7 +467,6 @@ public class GLProxy
msg.type == GLMessage.EType.UNDEFINED_BEHAVIOR)
{
GL_LOGGER.error("GL ERROR {} from {}: {}", msg.id, msg.source, msg.message);
LodUtil.assertNotReach();
throw new RuntimeException("GL ERROR: " + msg.toString());
}
@@ -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;
@@ -105,7 +105,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
@@ -315,7 +315,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);
@@ -23,7 +23,8 @@ public class DhClientServerWorld extends AbstractDhWorld implements IDhClientWor
private final HashSet<DhClientServerLevel> 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;
@@ -22,7 +22,8 @@ public class DhClientWorld extends AbstractDhWorld implements IDhClientWorld
private final HashMap<IClientLevelWrapper, DhClientLevel> 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);
@@ -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.",
@@ -308,15 +305,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.",
@@ -465,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":
@@ -631,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":