From 92fa904cc655cf388bfa3e7932404daf83122c6c Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 5 May 2021 16:55:01 -0500 Subject: [PATCH] Setup the config and enum for multiple LOD drawing modes --- .../com/backsun/lod/enums/LodDrawMode.java | 26 +++++++++++++++ .../java/com/backsun/lod/util/LodConfig.java | 33 ++++++++++++------- 2 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 src/main/java/com/backsun/lod/enums/LodDrawMode.java diff --git a/src/main/java/com/backsun/lod/enums/LodDrawMode.java b/src/main/java/com/backsun/lod/enums/LodDrawMode.java new file mode 100644 index 000000000..d2e4824ec --- /dev/null +++ b/src/main/java/com/backsun/lod/enums/LodDrawMode.java @@ -0,0 +1,26 @@ +package com.backsun.lod.enums; + +/** + * + * + * @author James Seibel + * @version 05-05-2021 + */ +public enum LodDrawMode +{ + // used for position + + /** Chunks are rendered as + * rectangular prisms. */ + CUBIC, + + /** Chunks smoothly transition between + * each other. */ + TRIANGULAR, + + /** Chunks smoothly transition between + * each other, unless a neighboring chunk + * is at a significantly different height. */ + DYNAMIC; + +} diff --git a/src/main/java/com/backsun/lod/util/LodConfig.java b/src/main/java/com/backsun/lod/util/LodConfig.java index b0172182d..e066d1049 100644 --- a/src/main/java/com/backsun/lod/util/LodConfig.java +++ b/src/main/java/com/backsun/lod/util/LodConfig.java @@ -8,6 +8,7 @@ import org.apache.logging.log4j.LogManager; import com.backsun.lod.ModInfo; import com.backsun.lod.enums.FogDistance; +import com.backsun.lod.enums.LodDrawMode; import com.electronwill.nightconfig.core.file.CommentedFileConfig; import com.electronwill.nightconfig.core.io.WritingMode; @@ -19,7 +20,7 @@ import net.minecraftforge.fml.config.ModConfig; /** * * @author James Seibel - * @version 02-27-2021 + * @version 05-05-2021 */ @Mod.EventBusSubscriber public class LodConfig @@ -32,32 +33,42 @@ public class LodConfig public ForgeConfigSpec.BooleanValue drawCheckerBoard; + public ForgeConfigSpec.EnumValue lodDrawMode; + Client(ForgeConfigSpec.Builder builder) { builder.comment(ModInfo.MODNAME + " configuration settings").push("client"); drawLODs = builder - .comment("If false LODs will not be drawn, \n" - + "however they will still be generated \n" - + "and saved to file for later use.") + .comment(" If false LODs will not be drawn, \n" + + " however they will still be generated \n" + + " and saved to file for later use.") .define("drawLODs", true); fogDistance = builder .comment("\n" - + "At what distance should Fog be drawn on the LODs? \n" - + "If fog cuts off ubruptly or you are using Optifine's \"fast\" \n" - + "fog option set this to " + FogDistance.NEAR.toString() + " or " + FogDistance.FAR.toString() + ".") + + " At what distance should Fog be drawn on the LODs? \n" + + " If fog cuts off ubruptly or you are using Optifine's \"fast\" \n" + + " fog option set this to " + FogDistance.NEAR.toString() + " or " + FogDistance.FAR.toString() + ".") .defineEnum("fogDistance", FogDistance.NEAR_AND_FAR); drawCheckerBoard = builder .comment("\n" - + "If false the LODs will draw with their normal world colors. \n" - + "If true they will draw as a black and white checkerboard. \n" - + "This can be used for debugging or imagining you are playing a \n" - + "giant game of chess ;)") + + " If false the LODs will draw with their normal world colors. \n" + + " If true they will draw as a black and white checkerboard. \n" + + " This can be used for debugging or imagining you are playing a \n" + + " giant game of chess ;)") .define("drawCheckerBoard", false); + lodDrawMode = builder + .comment("\n" + + " How should the LODs be drawn? \n" + + " " + LodDrawMode.CUBIC.toString() + ": LOD Chunks are drawn as rectangular prisms (boxes). \n" + + " " + LodDrawMode.TRIANGULAR.toString() + ": LOD Chunks smoothly transition between other. \n" + + " " + LodDrawMode.DYNAMIC.toString() + ": LOD Chunks smoothly transition between other, unless a neighboring chunk is at a significantly different height. ") + .defineEnum("lodDrawMode", LodDrawMode.CUBIC); + builder.pop(); } }