From 783ceeb6332d7f522c2c90617616457305cd2488 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sat, 5 Aug 2023 16:53:41 +0930 Subject: [PATCH] Some general fixes --- Readme.md | 2 +- .../core/jar/gui/BaseJFrame.java | 9 ++-- .../assets/distanthorizons/lang/en_us.json | 2 +- .../main/resources/shaders/flat_shaded.frag | 48 +++++++++---------- 4 files changed, 30 insertions(+), 31 deletions(-) diff --git a/Readme.md b/Readme.md index ba593171f..668aca089 100644 --- a/Readme.md +++ b/Readme.md @@ -17,7 +17,7 @@ It should be automatically included when pulling the full mod. LZ4 for Java (data compression)\ https://github.com/lz4/lz4-java -Json & Toml for Java (config handling)\ +NightConfig for Json & Toml (config handling)\ https://github.com/TheElectronWill/night-config SVG Salamander for SVG's\ diff --git a/core/src/main/java/com/seibel/distanthorizons/core/jar/gui/BaseJFrame.java b/core/src/main/java/com/seibel/distanthorizons/core/jar/gui/BaseJFrame.java index 546e860ab..344d792dd 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/jar/gui/BaseJFrame.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/jar/gui/BaseJFrame.java @@ -59,7 +59,7 @@ public class BaseJFrame extends JFrame { // Creates a list with all the options in it List langsToChoose = new ArrayList<>(); try( - final InputStreamReader isr = new InputStreamReader(JarUtils.accessFile("assets/lod/lang"), StandardCharsets.UTF_8); + final InputStreamReader isr = new InputStreamReader(JarUtils.accessFile("assets/distanthorizons/lang"), StandardCharsets.UTF_8); final BufferedReader br = new BufferedReader(isr) ) { List col = Collections.unmodifiableList(new ArrayList<>(Arrays.asList(br.lines().toArray()))); @@ -87,11 +87,11 @@ public class BaseJFrame extends JFrame { // Try to set the icons for them try { lightMode = new JButton(new ImageIcon( - new FlatSVGIcon(JarUtils.accessFile("assets/lod/textures/jar/themeLight.svg")).getImage() // Get the image + new FlatSVGIcon(JarUtils.accessFile("assets/distanthorizons/textures/jar/themeLight.svg")).getImage() // Get the image .getScaledInstance(themeButtonSize, themeButtonSize, Image.SCALE_DEFAULT) // Scale it to the correct size )); darkMode = new JButton(new ImageIcon( - new FlatSVGIcon(JarUtils.accessFile("assets/lod/textures/jar/themeDark.svg")).getImage() // Get the image + new FlatSVGIcon(JarUtils.accessFile("assets/distanthorizons/textures/jar/themeDark.svg")).getImage() // Get the image .getScaledInstance(themeButtonSize, themeButtonSize, Image.SCALE_DEFAULT) // Scale it to the correct size )); } catch (Exception e) {e.printStackTrace();} @@ -139,8 +139,7 @@ public class BaseJFrame extends JFrame { // This part of the code is taken from the official java docs at https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html // Specify the look and feel to use by defining the LOOKANDFEEL constant - // Valid values are: null (use the default), "Metal", "System", "Motif", - // and "GTK" + // Valid values are: null (use the default), "Metal", "System", "Motif", and "GTK" final static String LOOKANDFEEL = "GTK"; private static void initLookAndFeel() { String lookAndFeel = null; diff --git a/core/src/main/resources/assets/distanthorizons/lang/en_us.json b/core/src/main/resources/assets/distanthorizons/lang/en_us.json index c4da69c7b..1bdabf28d 100644 --- a/core/src/main/resources/assets/distanthorizons/lang/en_us.json +++ b/core/src/main/resources/assets/distanthorizons/lang/en_us.json @@ -224,7 +224,7 @@ "distanthorizons.config.client.advanced.graphics.noiseTextureSettings.noiseDropoff": "Noise Dropoff", "distanthorizons.config.client.advanced.graphics.noiseTextureSettings.noiseDropoff.@tooltip": - "How far should the noise texture render before it fades away? \n\n0.0 - the noise texture will render the entire LOD render distance. \n3.0 - the noise texture will fade away at 1/3 of the LOD render distance. ", + "Defines how far should the noise texture render before it fades away. (in blocks). \nSet to 0 to disable noise from fading away.", "distanthorizons.config.client.advanced.graphics.advancedGraphics": diff --git a/core/src/main/resources/shaders/flat_shaded.frag b/core/src/main/resources/shaders/flat_shaded.frag index 0252c0b4c..99a6b47ec 100644 --- a/core/src/main/resources/shaders/flat_shaded.frag +++ b/core/src/main/resources/shaders/flat_shaded.frag @@ -104,9 +104,9 @@ void main() vec3 vertexNormal = normalize(cross(dFdx(vPos.xyz), dFdy(vPos.xyz))); // This bit of code is required to fix the vertex position problem cus of floats in the verted world position varuable vec3 fixedVPos = vec3( - vPos.x - vertexNormal.x * 0.001, - vPos.y - vertexNormal.y * 0.001, - vPos.z - vertexNormal.z * 0.001 + vPos.x - vertexNormal.x * 0.001, + vPos.y - vertexNormal.y * 0.001, + vPos.z - vertexNormal.z * 0.001 ); @@ -116,9 +116,9 @@ void main() // Random value for each position float randomValue = rand(vec3( - quantize(fixedVPos.x, noiseSteps), - quantize(fixedVPos.y, noiseSteps), - quantize(fixedVPos.z, noiseSteps) + quantize(fixedVPos.x, noiseSteps), + quantize(fixedVPos.y, noiseSteps), + quantize(fixedVPos.z, noiseSteps) )) * 2. * noiseAmplification - noiseAmplification; @@ -129,22 +129,22 @@ void main() // Clamps it and turns it back into a vec4 if (noiseDropoff == 0) - fragColor = vec4( - clamp(newCol.r, 0., 1.), - clamp(newCol.g, 0., 1.), - clamp(newCol.b, 0., 1.), - fragColor.w - ); + fragColor = vec4( + clamp(newCol.r, 0., 1.), + clamp(newCol.g, 0., 1.), + clamp(newCol.b, 0., 1.), + fragColor.w + ); else - fragColor = mix( - vec4( - clamp(newCol.r, 0., 1.), - clamp(newCol.g, 0., 1.), - clamp(newCol.b, 0., 1.), - fragColor.w - ), fragColor, - clamp(length(vertexWorldPos) / noiseDropoff, 0., 1.) // The further away it gets, the less noise gets applied - ); + fragColor = mix( + vec4( + clamp(newCol.r, 0., 1.), + clamp(newCol.g, 0., 1.), + clamp(newCol.b, 0., 1.), + fragColor.w + ), fragColor, + clamp(length(vertexWorldPos) / noiseDropoff, 0., 1.) // The further away it gets, the less noise gets applied + ); // For testing // if (fragColor.r != 69420.) { @@ -167,15 +167,15 @@ void main() float horizontalDist = length(vertexWorldPos.xz) * fogScale; float heightDist = calculateHeightFogDepth( - vertexWorldPos.y, vertexYPos) * fogVerticalScale; + vertexWorldPos.y, vertexYPos) * fogVerticalScale; float farDist = calculateFarFogDepth(horizontalDist, - length(vertexWorldPos.xyz) * fogScale, nearFogStart); + length(vertexWorldPos.xyz) * fogScale, nearFogStart); float nearFogThickness = getNearFogThickness(horizontalDist); float farFogThickness = getFarFogThickness(farDist); float heightFogThickness = getHeightFogThickness(heightDist); float mixedFogThickness = clamp(mixFogThickness( - nearFogThickness, farFogThickness, heightFogThickness), 0.0, 1.0); + nearFogThickness, farFogThickness, heightFogThickness), 0.0, 1.0); fragColor = mix(fragColor, vec4(fogColor.rgb, 1.0), mixedFogThickness); }