Move config enums into API and setup groundwork for config interfacing

This commit is contained in:
James Seibel
2022-09-12 22:16:13 -05:00
parent 4f1203b32c
commit c80a5b102d
63 changed files with 633 additions and 101 deletions
@@ -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.items.enums.config;
/**
* NONE, <br>
* NON_FULL, <br>
* NO_COLLISION, <br>
* BOTH, <br>
*
* @author Leonardo Amato
* @version 2022-7-1
*/
public enum EBlocksToAvoid
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
NONE(false, false),
NON_FULL(true, false),
NO_COLLISION(false, true),
BOTH(true, true);
public final boolean nonFull;
public final boolean noCollision;
EBlocksToAvoid(boolean nonFull, boolean noCollision)
{
this.nonFull = nonFull;
this.noCollision = noCollision;
}
}
@@ -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.api.items.enums.config;
/**
* CONSTANT <br>
* FREQUENT <br>
* NORMAL <br>
* RARE <br> <br>
*
* Determines how fast the buffers should be regenerated
*
* @author Leonardo Amato
* @version 9-25-2021
*/
public enum EBufferRebuildTimes
{
CONSTANT(0, 0, 0, 1),
FREQUENT(1000, 500, 2500, 1),
NORMAL(2000, 1000, 5000, 4),
RARE(5000, 2000, 10000, 16);
public final int playerMoveTimeout;
public final int renderedChunkTimeout;
public final int chunkChangeTimeout;
public final int playerMoveDistance;
EBufferRebuildTimes(int playerMoveTimeout, int renderedChunkTimeout, int chunkChangeTimeout, int playerMoveDistance)
{
this.playerMoveTimeout = playerMoveTimeout;
this.renderedChunkTimeout = renderedChunkTimeout;
this.chunkChangeTimeout = chunkChangeTimeout;
this.playerMoveDistance = playerMoveDistance;
}
}
@@ -0,0 +1,137 @@
/*
* 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.items.enums.config;
/**
* NONE <br>
* BIOME_ONLY <br>
* BIOME_ONLY_SIMULATE_HEIGHT <br>
* SURFACE <br>
* FEATURES <br>
* FULL <br><br>
*
* In order of fastest to slowest.
*
* @author James Seibel
* @author Leonardo Amato
* @version 2022-7-1
*/
public enum EDistanceGenerationMode
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/** Don't generate anything except already existing chunks */
NONE((byte) 1),
/**
* Only generate the biomes and use biome
* grass/foliage color, water color, or ice color
* to generate the color. <br>
* Doesn't generate height, everything is shown at sea level. <br>
* Multithreaded - Fastest (2-5 ms)
*/
BIOME_ONLY((byte) 2),
/**
* Same as BIOME_ONLY, except instead
* of always using sea level as the LOD height
* different biome types (mountain, ocean, forest, etc.)
* use predetermined heights to simulate having height data.
*/
BIOME_ONLY_SIMULATE_HEIGHT((byte) 3),
/**
* Generate the world surface,
* this does NOT include caves, trees,
* or structures. <br>
* Multithreaded - Faster (10-20 ms)
*/
SURFACE((byte) 4),
/**
* Generate including structures.
* NOTE: This may cause world generation bugs or instability,
* since some features can cause concurrentModification exceptions. <br>
* Multithreaded - Fast (15-20 ms)
*/
FEATURES((byte) 5),
/**
* Ask the server to generate/load each chunk.
* This is the most compatible, but causes server/simulation lag.
* This will also show player made structures if you
* are adding the mod on a pre-existing world. <br>
* Single-threaded - Slow (15-50 ms, with spikes up to 200 ms)
*/
FULL((byte) 6);
public static EDistanceGenerationMode RENDERABLE = EDistanceGenerationMode.BIOME_ONLY;
/**
* The higher the number the more complete the generation is.
*/
public final byte complexity;
EDistanceGenerationMode(byte complexity)
{
this.complexity = complexity;
}
// Note: return null if out of range
public static EDistanceGenerationMode previous(EDistanceGenerationMode mode) {
switch (mode) {
case FULL:
return EDistanceGenerationMode.FEATURES;
case FEATURES:
return EDistanceGenerationMode.SURFACE;
case SURFACE:
return EDistanceGenerationMode.BIOME_ONLY_SIMULATE_HEIGHT;
case BIOME_ONLY_SIMULATE_HEIGHT:
return EDistanceGenerationMode.BIOME_ONLY;
case BIOME_ONLY:
return EDistanceGenerationMode.NONE;
case NONE:
default:
return null;
}
}
// Note: return null if out of range
public static EDistanceGenerationMode next(EDistanceGenerationMode mode) {
switch (mode) {
case FEATURES:
return EDistanceGenerationMode.FULL;
case SURFACE:
return EDistanceGenerationMode.FEATURES;
case BIOME_ONLY_SIMULATE_HEIGHT:
return EDistanceGenerationMode.SURFACE;
case BIOME_ONLY:
return EDistanceGenerationMode.BIOME_ONLY_SIMULATE_HEIGHT;
case NONE:
return EDistanceGenerationMode.BIOME_ONLY;
case FULL:
default:
return null;
}
}
}
@@ -0,0 +1,47 @@
/*
* 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.items.enums.config;
/**
* AUTO <br>
* Near_First <br>
* Far_First <br> <br>
*
* Determines which LODs should have priority when generating
* outside the normal view distance.
*
* @author Leonardo Amato
* @version 12-1-2021
*/
public enum EGenerationPriority
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/** NEAR_FIRST when connected to servers and BALANCED when on single player */
AUTO,
NEAR_FIRST,
BALANCED,
FAR_FIRST
}
@@ -0,0 +1,74 @@
/*
* 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.items.enums.config;
/**
* AUTO, <br>
* BUFFER_STORAGE, <br>
* SUB_DATA, <br>
* BUFFER_MAPPING, <br>
* DATA <br>
*
* @author Leetom
* @author James Seibel
* @version 2022-7-2
*/
public enum EGpuUploadMethod
{
/** Picks the best option based on the GPU the user has. */
AUTO(false, false),
// commented out since it isn't currently in use
//BUFFER_STORAGE_MAPPING(true, true),
/**
* Default for NVIDIA if OpenGL 4.5 is supported. <br>
* Fast rendering, no stuttering.
*/
BUFFER_STORAGE(false, true),
/**
* Backup option for NVIDIA. <br>
* Fast rendering but may stutter when uploading.
*/
SUB_DATA(false, false),
/**
* Default option for AMD/Intel. <br>
* May end up storing buffers in System memory. <br>
* Fast rending if in GPU memory, slow if in system memory, <br>
* but won't stutter when uploading.
*/
BUFFER_MAPPING(true, false),
/**
* Backup option for AMD/Intel. <br>
* Fast rendering but may stutter when uploading.
*/
DATA(false, false);
public final boolean useEarlyMapping;
public final boolean useBufferStorage;
EGpuUploadMethod(boolean useEarlyMapping, boolean useBufferStorage) {
this.useEarlyMapping = useEarlyMapping;
this.useBufferStorage = useBufferStorage;
}
}
@@ -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.items.enums.config;
/**
* LOWEST <br>
* LOW <br>
* MEDIUM <br>
* HIGH <br> <br>
*
* this indicates the base of the quadratic function we use for the quality drop-off
*
* @author Leonardo Amato
* @version 9-29-2021
*/
public enum EHorizontalQuality
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/** 1.0 AKA Linear */
LOWEST(1.0f),
/** exponent 1.5 */
LOW(1.5f),
/** exponent 2.0 */
MEDIUM(2.0f),
/** exponent 2.2 */
HIGH(2.2f);
public final double quadraticBase;
EHorizontalQuality(double distanceUnit)
{
this.quadraticBase = distanceUnit;
}
}
@@ -0,0 +1,175 @@
/*
* 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.items.enums.config;
import java.util.ArrayList;
import java.util.Collections;
import com.seibel.lod.core.util.MathUtil;
/**
* BLOCK <Br>
* TWO_BLOCKS <Br>
* FOUR_BLOCKS <br>
* HALF_CHUNK <Br>
* CHUNK <br>
*
* @author James Seibel
* @author Leonardo Amato
* @version 2022-7-5
*/
public enum EHorizontalResolution
{
/** render 256 LODs for each chunk */
BLOCK(16, 0),
/** render 64 LODs for each chunk */
TWO_BLOCKS(8, 1),
/** render 16 LODs for each chunk */
FOUR_BLOCKS(4, 2),
/** render 4 LODs for each chunk */
HALF_CHUNK(2, 3),
/** render 1 LOD for each chunk */
CHUNK(1, 4);
/**
* How many DataPoints should
* be drawn per side, per LodChunk
*/
public final int dataPointLengthCount;
/** How wide each LOD DataPoint is */
public final int dataPointWidth;
/**
* This is the same as detailLevel in LodQuadTreeNode,
* lowest is 0 highest is 9
*/
public final byte detailLevel;
/* Start/End X/Z give the block positions
* for each individual dataPoint in a LodChunk */
public final int[] startX;
public final int[] startZ;
public final int[] endX;
public final int[] endZ;
/**
* 1st dimension: LodDetail.detailLevel <br>
* 2nd dimension: An array of all LodDetails that are less than or <br>
* equal to that detailLevel
*/
private static EHorizontalResolution[][] lowerDetailArrays;
EHorizontalResolution(int newLengthCount, int newDetailLevel)
{
detailLevel = (byte) newDetailLevel;
dataPointLengthCount = newLengthCount;
dataPointWidth = 16 / dataPointLengthCount;
startX = new int[dataPointLengthCount * dataPointLengthCount];
endX = new int[dataPointLengthCount * dataPointLengthCount];
startZ = new int[dataPointLengthCount * dataPointLengthCount];
endZ = new int[dataPointLengthCount * dataPointLengthCount];
int index = 0;
for (int x = 0; x < newLengthCount; x++)
{
for (int z = 0; z < newLengthCount; z++)
{
startX[index] = x * dataPointWidth;
startZ[index] = z * dataPointWidth;
endX[index] = (x * dataPointWidth) + dataPointWidth;
endZ[index] = (z * dataPointWidth) + dataPointWidth;
index++;
}
}
}// constructor
/**
* 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)
{
if (lowerDetailArrays == null)
{
// run first time setup
lowerDetailArrays = new EHorizontalResolution[EHorizontalResolution.values().length][];
// go through each LodDetail
for (EHorizontalResolution currentDetail : EHorizontalResolution.values())
{
ArrayList<EHorizontalResolution> lowerDetails = new ArrayList<>();
// find the details lower than currentDetail
for (EHorizontalResolution compareDetail : EHorizontalResolution.values())
{
if (currentDetail.detailLevel <= compareDetail.detailLevel)
{
lowerDetails.add(compareDetail);
}
}
// have the highest detail item first in the list
Collections.sort(lowerDetails);
Collections.reverse(lowerDetails);
lowerDetailArrays[currentDetail.detailLevel] = lowerDetails.toArray(new EHorizontalResolution[lowerDetails.size()]);
}
}
return lowerDetailArrays[detail.detailLevel];
}
/** Returns what detail level should be used at a given distance and maxDistance. */
public static EHorizontalResolution getDetailForDistance(EHorizontalResolution maxDetailLevel, int distance, int maxDistance)
{
EHorizontalResolution[] lowerDetails = getSelfAndLowerDetails(maxDetailLevel);
int distanceBetweenDetails = maxDistance / lowerDetails.length;
int index = MathUtil.clamp(0, distance / distanceBetweenDetails, lowerDetails.length - 1);
return lowerDetails[index];
}
}
@@ -0,0 +1,49 @@
/*
* 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.items.enums.config;
/**
* Low <br>
* Medium <br>
* High <br>
* <br>
* this is a quality scale for the detail drop-off
*
* @author Leonardo Amato
* @version 9-25-2021
*/
public enum EHorizontalScale
{
/** Lods are 2D with heightMap */
LOW(64),
/** Lods expand in three dimension */
MEDIUM(128),
/** Lods expand in three dimension */
HIGH(256);
public final int distanceUnit;
EHorizontalScale(int distanceUnit)
{
this.distanceUnit = distanceUnit;
}
}
@@ -0,0 +1,40 @@
/*
* 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.items.enums.config;
/**
* FAST, <br>
* FANCY,
*
* @author Leetom
* @version 2022-7-1
*/
public enum ELightGenerationMode
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/** Fake light values using a height map */
FAST,
/** Run the lighting engine though the chunk to generate proper light values */
FANCY
}
@@ -0,0 +1,45 @@
/*
* 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.items.enums.config;
import org.apache.logging.log4j.Level;
public enum ELoggerMode
{
DISABLED(Level.OFF, Level.OFF),
LOG_ALL_TO_FILE(Level.ALL, Level.OFF),
LOG_ERROR_TO_CHAT(Level.ALL, Level.ERROR),
LOG_WARNING_TO_CHAT(Level.ALL, Level.WARN),
LOG_INFO_TO_CHAT(Level.ALL, Level.INFO),
LOG_DEBUG_TO_CHAT(Level.ALL, Level.DEBUG),
LOG_ALL_TO_CHAT(Level.ALL, Level.ALL),
LOG_ERROR_TO_CHAT_AND_FILE(Level.ERROR, Level.ERROR),
LOG_WARNING_TO_CHAT_AND_FILE(Level.WARN, Level.WARN),
LOG_INFO_TO_CHAT_AND_FILE(Level.INFO, Level.INFO),
LOG_DEBUG_TO_CHAT_AND_FILE(Level.DEBUG, Level.DEBUG),
LOG_WARNING_TO_CHAT_AND_INFO_TO_FILE(Level.INFO, Level.WARN),
LOG_ERROR_TO_CHAT_AND_INFO_TO_FILE(Level.INFO, Level.ERROR),
;
public final Level levelForFile;
public final Level levelForChat;
ELoggerMode(Level levelForFile, Level levelForChat) {
this.levelForFile = levelForFile;
this.levelForChat = levelForChat;
}
}
@@ -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) 2022 Tom Lee (TomTheFurry)
* 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.items.enums.config;
/**
* AUTO, <br>
* NAME_ONLY, <br>
* NAME_IP, <br>
* NAME_IP_PORT, <br> <br>
*
* Determines how the multiplayer folders should be named.
*
* @author James Seibel
* @version 2022-7-1
*/
public enum EServerFolderNameMode
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/**
* NAME_IP for LAN connections <Br>
* NAME_IP_PORT for all others
*/
AUTO,
/** Only use the server name */
NAME_ONLY,
/**
* {SERVER_NAME} IP {IP} <br>
* Example: Minecraft Server IP 192.168.1.40
*/
NAME_IP,
/**
* {SERVER_NAME} IP {IP}:{PORT} <br>
* Example: Minecraft Server IP 192.168.1.40:25565
*/
NAME_IP_PORT,
/**
* {SERVER_NAME} IP {IP} <br>
* Example: Minecraft Server IP 192.168.1.40:25565 GameVersion 1.16.5 <Br> <br>
*
* Not normally recommended, since the game version can change if the
* server installs paper or some other jar. <br>
* This is just here to provide backwards compatibility.
*/
NAME_IP_PORT_MC_VERSION;
}
@@ -0,0 +1,41 @@
/*
* 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.items.enums.config;
/**
* NONE, GAME_SHADING
*
* @author James Seibel
* @version 7-25-2020
*/
public enum EShadingMode
{
/**
* LODs will have darker sides and bottoms to simulate
* Minecraft's fast lighting.
*/
GAME_SHADING,
/**
* LODs will use ambient occlusion to mimic Minecraft's
* Fancy lighting.
*/
AMBIENT_OCCLUSION
}
@@ -0,0 +1,54 @@
/*
* 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.items.enums.config;
/**
* NEVER, <br>
* DYNAMIC, <br>
* ALWAYS <br> <br>
*
* This represents how far the LODs should overlap with
* the vanilla Minecraft terrain.
*
* @author James Seibel
* @version 2022-6-30
*/
public enum EVanillaOverdraw
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/**
* Don't draw LODs where a minecraft chunk could be.
* Use Overdraw Offset to tweak the border thickness.
*/
NEVER,
/**
* Draw LODs over the farther minecraft chunks.
* Dynamically decides the border thickness
*/
DYNAMIC,
/** Draw LODs over all minecraft chunks. */
ALWAYS,
}
@@ -0,0 +1,124 @@
/*
* 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.items.enums.config;
/**
* heightmap <br>
* multi_lod <br>
*
* @author Leonardo Amato
* @version 2022-3-26
*/
public enum EVerticalQuality
{
LOW(
new int[] { 4, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1 },
2
),
MEDIUM(
new int[] { 6, 4, 3, 2, 2, 1, 1, 1, 1, 1, 1 },
4
),
HIGH(
new int[] { 8, 6, 4, 2, 2, 2, 2, 1, 1, 1, 1 },
6
),
ULTRA(
new int[] { 16, 8, 4, 2, 2, 2, 2, 1, 1, 1, 1 },
12
);
public final int[] maxVerticalData;
@Deprecated // Will find other ways to optimize
public final int maxConnectedLods;
EVerticalQuality(int[] maxVerticalData, int maxConnectedLods)
{
this.maxVerticalData = maxVerticalData;
this.maxConnectedLods = maxConnectedLods;
}
/** returns null if out of range */
public static EVerticalQuality previous(EVerticalQuality mode)
{
switch (mode)
{
case ULTRA:
return EVerticalQuality.HIGH;
case HIGH:
return EVerticalQuality.MEDIUM;
case MEDIUM:
return EVerticalQuality.LOW;
case LOW:
default:
return null;
}
}
/** returns null if out of range */
public static EVerticalQuality next(EVerticalQuality mode)
{
switch (mode)
{
case MEDIUM:
return EVerticalQuality.HIGH;
case LOW:
return EVerticalQuality.MEDIUM;
case HIGH:
return EVerticalQuality.ULTRA;
case ULTRA:
default:
return null;
}
}
/**
* Returns the value with the given name, case-insensitive. <br>
* Returns null if no enums match the name. <br>
* Similar to valueOf(String value)
*/
public static EVerticalQuality getByName(String name)
{
switch (name.toUpperCase())
{
case "ULTRA":
return EVerticalQuality.ULTRA;
case "HIGH":
return EVerticalQuality.HIGH;
case "MEDIUM":
return EVerticalQuality.MEDIUM;
case "LOW":
return EVerticalQuality.LOW;
default:
return null;
}
}
public int calculateMaxVerticalData(byte dataDetail) {
if (dataDetail >= maxVerticalData.length)
dataDetail = (byte) (maxVerticalData.length-1);
return maxVerticalData[dataDetail];
}
}
@@ -0,0 +1,100 @@
/*
* 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.items.enums.rendering;
/**
* OFF, <br>
* SHOW_WIREFRAME, <br>
* SHOW_DETAIL, <br>
* SHOW_DETAIL_WIREFRAME, <br>
* SHOW_GENMODE, <br>
* SHOW_GENMODE_WIREFRAME, <br>
* SHOW_OVERLAPPING_QUADS, <br>
* SHOW_OVERLAPPING_QUADS_WIREFRAME, <br>
*
* @author Leetom
* @author James Seibel
* @version 2022-7-2
*/
public enum EDebugMode
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/** LODs are rendered normally */
OFF,
/** LOD draws in wireframe. */
SHOW_WIREFRAME,
/** LOD colors are based on their detail */
SHOW_DETAIL,
/** LOD colors are based on their detail, and draws in wireframe. */
SHOW_DETAIL_WIREFRAME,
/** LOD colors are based on their gen mode. */
SHOW_GENMODE,
/** LOD colors are based on their gen mode, and draws in wireframe. */
SHOW_GENMODE_WIREFRAME,
/** Only draw overlapping LOD quads. */
SHOW_OVERLAPPING_QUADS,
/** Only draw overlapping LOD quads, and draws in wireframe. */
SHOW_OVERLAPPING_QUADS_WIREFRAME;
/** returns the next debug mode */
// Deprecated: use DebugMode.next() instead
@Deprecated
public EDebugMode getNext()
{
return next(this);
}
public static EDebugMode next(EDebugMode type) {
switch (type) {
case OFF: return SHOW_WIREFRAME;
case SHOW_WIREFRAME: return SHOW_DETAIL;
case SHOW_DETAIL: return SHOW_DETAIL_WIREFRAME;
case SHOW_DETAIL_WIREFRAME: return SHOW_GENMODE;
case SHOW_GENMODE: return SHOW_GENMODE_WIREFRAME;
case SHOW_GENMODE_WIREFRAME: return SHOW_OVERLAPPING_QUADS;
case SHOW_OVERLAPPING_QUADS: return SHOW_OVERLAPPING_QUADS_WIREFRAME;
default: return OFF;
}
}
public static EDebugMode previous(EDebugMode type) {
switch (type) {
case OFF: return SHOW_OVERLAPPING_QUADS_WIREFRAME;
case SHOW_OVERLAPPING_QUADS_WIREFRAME: return SHOW_OVERLAPPING_QUADS;
case SHOW_OVERLAPPING_QUADS: return SHOW_GENMODE_WIREFRAME;
case SHOW_GENMODE_WIREFRAME: return SHOW_GENMODE;
case SHOW_GENMODE: return SHOW_DETAIL_WIREFRAME;
case SHOW_DETAIL_WIREFRAME: return SHOW_DETAIL;
case SHOW_DETAIL: return SHOW_WIREFRAME;
default: return OFF;
}
}
}
@@ -0,0 +1,46 @@
/*
* 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.items.enums.rendering;
/**
* USE_DEFAULT_FOG_COLOR, <br>
* USE_SKY_COLOR, <br>
*
* @author James Seibel
* @version 2022-6-9
*/
public enum EFogColorMode
{
// Reminder:
// when adding items: up the API minor version
// when removing items: up the API major version
/** Fog uses Minecraft's fog color. */
USE_WORLD_FOG_COLOR,
/**
* Replicates the effect of the clear sky mod.
* Making the fog blend in with the sky better
* For it to look good you need one of the following mods:
* https://www.curseforge.com/minecraft/mc-mods/clear-skies
* https://www.curseforge.com/minecraft/mc-mods/clear-skies-forge-port
*/
USE_SKY_COLOR,
}
@@ -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.items.enums.rendering;
/**
* NEAR, FAR, or NEAR_AND_FAR.
*
* @author James Seibel
* @version 2022-6-2
*/
public enum EFogDistance
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
NEAR,
FAR,
NEAR_AND_FAR
}
@@ -0,0 +1,45 @@
/*
* 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.items.enums.rendering;
/**
* USE_OPTIFINE_FOG_SETTING, <br>
* FOG_ENABLED, <br>
* FOG_DISABLED <br>
*
* @author James Seibel
* @version 2022-6-2
*/
public enum EFogDrawMode
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/**
* Use whatever Fog setting optifine is using.
* If optifine isn't installed this defaults to FOG_ENABLED.
*/
USE_OPTIFINE_SETTING,
FOG_ENABLED,
FOG_DISABLED;
}
@@ -0,0 +1,22 @@
package com.seibel.lod.api.items.enums.rendering;
/**
* LINEAR, <br>
* EXPONENTIAL, <br>
* EXPONENTIAL_SQUARED <br>
*
* @author Leetom
* @version 2022-6-30
*/
public enum EFogFalloff
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
LINEAR,
EXPONENTIAL,
EXPONENTIAL_SQUARED,
// TEXTURE_BASED, // TODO: Impl this
}
@@ -0,0 +1,41 @@
/*
* 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.items.enums.rendering;
/**
* Minecraft, Lod_Builder, None
*
* @author James Seibel
* @version 10-1-2021
*/
public enum EGLProxyContext
{
/** Minecraft's render thread */
MINECRAFT,
/** The context we send buffers to the GPU on */
LOD_BUILDER,
/** A context that can be used for miscellaneous tasks, owned by the GLProxy */
PROXY_WORKER,
/** used to un-bind threads */
NONE,
}
@@ -0,0 +1,49 @@
/*
* 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.items.enums.rendering;
/**
* BASIC <br>
* IGNORE_HEIGHT <br>
* ADDITION <br>
* MAX <br>
* MULTIPLY <br>
* INVERSE_MULTIPLY <br>
* LIMITED_ADDITION <br>
* MULTIPLY_ADDITION <br>
* INVERSE_MULTIPLY_ADDITION <br>
* AVERAGE <br>
*
* @author Leetom
* @version 2022-4-14
*/
public enum EHeightFogMixMode
{
BASIC,
IGNORE_HEIGHT,
ADDITION,
MAX,
MULTIPLY,
INVERSE_MULTIPLY,
LIMITED_ADDITION,
MULTIPLY_ADDITION,
INVERSE_MULTIPLY_ADDITION,
AVERAGE,
}
@@ -0,0 +1,57 @@
/*
* 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.items.enums.rendering;
/**
* ABOVE_CAMERA, <br>
* BELOW_CAMERA, <br>
* ABOVE_AND_BELOW_CAMERA, <br>
* ABOVE_SET_HEIGHT, <br>
* BELOW_SET_HEIGHT, <br>
* ABOVE_AND_BELOW_SET_HEIGHT, <br>
*
* @author Leetom
* @version 6-30-2022
*/
public enum EHeightFogMode
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
ABOVE_CAMERA(true, true, false),
BELOW_CAMERA(true, false, true),
ABOVE_AND_BELOW_CAMERA(true, true, true),
ABOVE_SET_HEIGHT(false, true, false),
BELOW_SET_HEIGHT(false, false, true),
ABOVE_AND_BELOW_SET_HEIGHT(false, true, true);
public final boolean basedOnCamera;
public final boolean above;
public final boolean below;
EHeightFogMode(boolean basedOnCamera, boolean above, boolean below)
{
this.basedOnCamera = basedOnCamera;
this.above = above;
this.below = below;
}
}
@@ -0,0 +1,60 @@
/*
* 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.items.enums.rendering;
/**
* OFF, <br>
* SHOW_WIREFRAME, <br>
* SHOW_DETAIL, <br>
* SHOW_DETAIL_WIREFRAME, <br>
* SHOW_GENMODE, <br>
* SHOW_GENMODE_WIREFRAME, <br>
* SHOW_OVERLAPPING_QUADS, <br>
* SHOW_OVERLAPPING_QUADS_WIREFRAME, <br>
*
* @author Leetom
* @author James Seibel
* @version 2022-7-2
*/
public enum ETransparency
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/** */
DISABLED(false, false),
/** */
FAKE(true, true),
/** */
COMPLETE(true, false);
public final boolean tranparencyEnabled;
public final boolean fakeTransparencyEnabled;
ETransparency(boolean tranparencyEnabled, boolean fakeTransparencyEnabled)
{
this.tranparencyEnabled = tranparencyEnabled;
this.fakeTransparencyEnabled = fakeTransparencyEnabled;
}
}
@@ -0,0 +1,76 @@
/*
* 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.items.interfaces.config.both;
import com.seibel.lod.api.items.enums.config.EBlocksToAvoid;
import com.seibel.lod.api.items.enums.config.EDistanceGenerationMode;
import com.seibel.lod.api.items.enums.config.EGenerationPriority;
import com.seibel.lod.api.items.enums.config.ELightGenerationMode;
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
/**
* Distant Horizons' world generation configuration. <br><br>
*
* Note: Fake chunks are NOT saved in Minecraft's vanilla save system.
*
* @author James Seibel
* @version 2022-7-11
*/
public interface IDhApiWorldGeneration
{
/**
* Defines whether fake chunks will be generated
* outside Minecraft's vanilla render distance.
*/
IDhApiConfig<Boolean> getEnableDistantWorldGenerationConfig();
/** Defines to what level fake chunks will be generated. */
IDhApiConfig<EDistanceGenerationMode> getDistantGeneratorDetailLevelConfig();
/** Defines how generated fake chunks will be lit. */
IDhApiConfig<ELightGenerationMode> getLightingModeConfig();
/** Defines the order in which fake chunks will be generated. */
IDhApiConfig<EGenerationPriority> getGenerationPriorityConfig();
/**
* Defines what blocks will be ignored when generating LODs.
*
* TODO if this isn't deprecated before 1.7 it should probably be moved to the graphics tab
* @deprecated this method won't be needed once we transition to an ID based save system <br>
* (vs the color based system we have currently)
*/
@Deprecated
IDhApiConfig<EBlocksToAvoid> getBlocksToAvoidConfig();
/**
* 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
IDhApiConfig<Boolean> getTintWithAvoidedBlocksConfig();
}
@@ -0,0 +1,46 @@
/*
* 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.items.interfaces.config.client;
import com.seibel.lod.api.items.enums.config.EGpuUploadMethod;
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
/**
* Distant Horizons' OpenGL buffer configuration.
*
* @author James Seibel
* @version 2022-7-5
*/
public interface IDhApiBuffers
{
/** Defines how geometry data is uploaded to the GPU. */
IDhApiConfig<EGpuUploadMethod> getGpuUploadMethodConfig();
/**
* Defines how long we should wait after uploading one
* Megabyte of geometry data to the GPU before uploading
* the next Megabyte of data. <br>
* This can be set to a non-zero number to reduce stuttering caused by
* uploading buffers to the GPU.
*/
IDhApiConfig<Integer> getBufferUploadTimeoutPerMegabyteInMillisecondsConfig();
}
@@ -0,0 +1,40 @@
/*
* 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.items.interfaces.config.client;
import com.seibel.lod.api.items.enums.rendering.EDebugMode;
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
/**
* Distant Horizons' debug configuration.
*
* @author James Seibel
* @version 2022-7-5
*/
public interface IDhApiDebugging
{
/** Can be used to debug the standard fake chunk rendering. */
IDhApiConfig<EDebugMode> getDebugRenderModeConfig();
/** If enabled debug keybindings can be used. */
IDhApiConfig<Boolean> getEnableDebugKeybindingsConfig();
}
@@ -0,0 +1,137 @@
/*
* 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.items.interfaces.config.client;
import com.seibel.lod.api.items.enums.config.*;
import com.seibel.lod.api.items.enums.rendering.ERendererMode;
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
/**
* Distant Horizons' graphics/rendering configuration.
*
* @author James Seibel
* @version 2022-7-11
*/
public interface IDhApiGraphics
{
//========================//
// basic graphic settings //
//========================//
/** The distance is the radius measured in chunks. */
IDhApiConfig<Integer> getChunkRenderDistanceConfig();
/**
* Simplified version of {@link IDhApiGraphics#getRenderingModeConfig()}
* that only enables/disables the fake chunk rendering. <br><br>
*
* Changing this config also changes {@link IDhApiGraphics#getRenderingModeConfig()}'s value.
*/
IDhApiConfig<Boolean> getRenderingEnabledConfig();
/**
* Can be used to enable/disable fake chunk rendering or enable the debug renderer. <br><br>
*
* 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 IDhApiGraphics#getRenderingEnabledConfig()}'s value.
*/
IDhApiConfig<ERendererMode> getRenderingModeConfig();
//==================//
// graphic settings //
//==================//
/** Defines how detailed fake chunks are in the horizontal direction */
IDhApiConfig<EHorizontalResolution> getMaxDetailLevelConfig();
/** Defines how detailed fake chunks are in the vertical direction */
IDhApiConfig<EVerticalQuality> getVerticalQualityConfig();
/** Modifies the quadratic function fake chunks use for horizontal quality drop-off. */
IDhApiConfig<EHorizontalQuality> getHorizontalQualityDropoffConfig();
/**
* The same as vanilla Minecraft's biome blending. <br><br>
*
* 0 = blending of 1x1 aka off <br>
* 1 = blending of 3x3 <br>
* 2 = blending of 5x5 <br>
* ... <br>
*/
IDhApiConfig<Integer> getBiomeBlendingConfig();
//===========================//
// advanced graphic settings //
//===========================//
/** If directional culling is disabled fake chunks will be rendered behind the camera. */
IDhApiConfig<Boolean> getDisableDirectionalCullingConfig();
/** Determines how fake chunks are rendered in comparison to vanilla MC's chunks. */
IDhApiConfig<EVanillaOverdraw> getVanillaOverdrawConfig();
/** Modifies how far the vanilla overdraw is rendered in chunks. */
IDhApiConfig<Integer> getVanillaOverdrawOffsetConfig();
/**
* If enabled the near clip plane is extended to reduce
* overdraw and improve Z-fighting at extreme render distances. <br>
* 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.
*/
IDhApiConfig<Boolean> getUseExtendedNearClipPlaneConfig();
/**
* Modifies how bright fake chunks are. <br>
* This is done when generating the vertex data and is applied before any shaders.
*/
IDhApiConfig<Double> getBrightnessMultiplierConfig();
/**
* Modifies how saturated fake chunks are. <br>
* This is done when generating the vertex data and is applied before any shaders.
*/
IDhApiConfig<Double> getSaturationMultiplierConfig();
/** Defines if Distant Horizons should attempt to cull fake chunk cave geometry. */
IDhApiConfig<Boolean> getCaveCullingEnabledConfig();
/** Defines what height cave culling should be used below if enabled. */
IDhApiConfig<Integer> getCaveCullingHeightConfig();
/** This ratio is relative to Earth's real world curvature. */
IDhApiConfig<Integer> getEarthCurvatureRatioConfig();
/** If enabled vanilla chunk rendering is disabled and only fake chunks are rendered. */
IDhApiConfig<Boolean> getEnableLodOnlyModeConfig();
/** Defines how often the geometry should be rebuilt when the player moves. */
IDhApiConfig<EBufferRebuildTimes> getGeometryRebuildFrequencyConfig();
}
@@ -0,0 +1,130 @@
/*
* 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.items.interfaces.config.client;
import com.seibel.lod.api.items.enums.rendering.*;
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
/**
* 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-7-11
*/
public interface IDhApiGraphicsFog
{
//====================//
// basic fog settings //
//====================//
/** Defines at what distance fog is rendered on fake chunks. */
IDhApiConfig<EFogDistance> getFogDistanceConfig();
/** Should be used to enable/disable fog rendering. */
IDhApiConfig<EFogDrawMode> getFogRenderConfig();
/** Can be used to enable support with mods that change vanilla MC's fog color. */
IDhApiConfig<EFogColorMode> getFogColorConfig();
/**
* If enabled attempts to disable vanilla MC's fog on real chunks. <br>
* May not play nice with other fog editing mods.
*/
IDhApiConfig<Boolean> getDisableVanillaFogConfig();
//=======================//
// 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>
*/
IDhApiConfig<Double> getFogStartDistanceConfig();
/**
* 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>
*/
IDhApiConfig<Double> getFogEndDistanceConfig();
/** Defines how opaque the fog is at its thinnest point. */
IDhApiConfig<Double> getFogMinThicknessConfig();
/** Defines how opaque the fog is at its thickest point. */
IDhApiConfig<Double> getFogMaxThicknessConfig();
/** Defines how the fog changes in thickness. */
IDhApiConfig<EFogFalloff> getFogFalloffConfig();
/** Defines the fog density. */
IDhApiConfig<Double> getFogDensityConfig();
//=====================//
// height fog settings //
//=====================//
/** Defines how the height fog mixes. */
IDhApiConfig<EHeightFogMixMode> getHeightFogMixModeConfig();
/** Defines how the height fog is drawn relative to the camera or world. */
IDhApiConfig<EHeightFogMode> getHeightFogModeConfig();
/**
* Defines the height fog's base height if {@link IDhApiGraphicsFog#getHeightFogModeConfig()}
* is set to use a specific height.
*/
IDhApiConfig<Double> getHeightFogBaseHeightConfig();
/** Defines the height fog's starting height as a percent of the world height. */
IDhApiConfig<Double> getHeightFogStartingHeightPercentConfig();
/** Defines the height fog's ending height as a percent of the world height. */
IDhApiConfig<Double> getHeightFogEndingHeightPercentConfig();
/** Defines how opaque the height fog is at its thinnest point. */
IDhApiConfig<Double> getHeightFogMinThicknessConfig();
/** Defines how opaque the height fog is at its thickest point. */
IDhApiConfig<Double> getHeightFogMaxThicknessConfig();
/** Defines how the height fog changes in thickness. */
IDhApiConfig<EFogFalloff> getHeightFogFalloffConfig();
/** Defines the height fog's density. */
IDhApiConfig<Double> getHeightFogDensityConfig();
}
@@ -0,0 +1,52 @@
/*
* 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.items.interfaces.config.client;
import com.seibel.lod.api.items.enums.config.EServerFolderNameMode;
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
/**
* Distant Horizons' client-side multiplayer configuration.
*
* @author James Seibel
* @version 2022-7-5
*/
public interface IDhApiMultiplayer
{
/**
* Defines how multiplayer server folders are named. <br>
* Note: Changing this while connected to a multiplayer world will cause undefined behavior!
*/
IDhApiConfig<EServerFolderNameMode> getFolderSavingModeConfig();
/**
* Defines the necessary similarity (as a percent) that two potential levels
* need in order to be considered the same. <br> <br>
*
* Setting this to zero causes every level of a specific dimension type to be consider
* the same level. <br>
* Setting this to a non-zero value allows for usage in servers that user Multiverse
* or similar mods.
*/
IDhApiConfig<Double> getMultiverseSimilarityRequirementConfig();
}
@@ -0,0 +1,63 @@
/*
* 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.items.interfaces.config.client;
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
/**
* Distant Horizons' threading configuration.
*
* @author James Seibel
* @version 2022-7-5
*/
public interface IDhApiThreading
{
/**
* Defines how many world generator threads are used to generate
* terrain outside Minecraf'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>
*
* 0.1 = 1 thread active 10% of the time <br>
* 0.5 = 1 thread active 50% of the time <br>
* 1.0 = 1 thread active 100% of the time <br>
* 1.5 = 2 threads active 100% of the time (partial values are rounded up) <br>
* 2.0 = 2 threads active 100% of the time <br>
*
* @deprecated this (and the related config) should be replaced with an int
* count of threads and then a double percent active config.
*/
@Deprecated
IDhApiConfig<Double> getWorldGeneratorThreadConfig();
// TODO the above should be replaced with these
// IDhApiConfig<Integer> getWorldGeneratorThreadConfig()
// { return new DhApiConfig<>(Threading.numberOfWorldGenerationThreads); }
// IDhApiConfig<Double> getWorldGeneratorThreadActivePercentConfig()
// { return new DhApiConfig<>(Threading.ToBeDetermined); }
/** Defines how many buffer (GPU Terrain data) builder threads are used. */
IDhApiConfig<Integer> getBufferBuilderThreadConfig();
}
@@ -1,4 +1,4 @@
package com.seibel.lod.api.methods.config;
package com.seibel.lod.api.items.objects.config;
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
import com.seibel.lod.core.interfaces.config.IConfigEntry;