diff --git a/src/main/java/com/gtnewhorizons/angelica/render/CloudRenderer.java b/src/main/java/com/gtnewhorizons/angelica/render/CloudRenderer.java index 2eb382b38..10377de57 100644 --- a/src/main/java/com/gtnewhorizons/angelica/render/CloudRenderer.java +++ b/src/main/java/com/gtnewhorizons/angelica/render/CloudRenderer.java @@ -64,6 +64,8 @@ public class CloudRenderer implements IResourceManagerReloadListener { private VertexBuffer vbo; private int cloudMode = -1; private int renderDistance = -1; + private int cloudElevation = -1; + private int scaleMult = -1; private DynamicTexture COLOR_TEX = null; @@ -82,9 +84,8 @@ public class CloudRenderer implements IResourceManagerReloadListener { return instance; } - private int getScale() { - return cloudMode == 2 ? 12 : 8; + return (cloudMode == 2 ? 12 : 8) * scaleMult; } private float ceilToScale(float value) { @@ -139,11 +140,12 @@ public class CloudRenderer implements IResourceManagerReloadListener { tessellator.pos(sectX0, 0, sectZ1).tex(u0, v1).color(bCol, bCol, bCol, ALPHA).endVertex(); if (fancy) { + final int height = HEIGHT * scaleMult; // Top - tessellator.pos(sectX0, HEIGHT, sectZ0).tex(u0, v0).color(1, 1, 1, ALPHA).endVertex(); - tessellator.pos(sectX0, HEIGHT, sectZ1).tex(u0, v1).color(1, 1, 1, ALPHA).endVertex(); - tessellator.pos(sectX1, HEIGHT, sectZ1).tex(u1, v1).color(1, 1, 1, ALPHA).endVertex(); - tessellator.pos(sectX1, HEIGHT, sectZ0).tex(u1, v0).color(1, 1, 1, ALPHA).endVertex(); + tessellator.pos(sectX0, height, sectZ0).tex(u0, v0).color(1, 1, 1, ALPHA).endVertex(); + tessellator.pos(sectX0, height, sectZ1).tex(u0, v1).color(1, 1, 1, ALPHA).endVertex(); + tessellator.pos(sectX1, height, sectZ1).tex(u1, v1).color(1, 1, 1, ALPHA).endVertex(); + tessellator.pos(sectX1, height, sectZ0).tex(u1, v0).color(1, 1, 1, ALPHA).endVertex(); float slice; float sliceCoord0; @@ -157,8 +159,8 @@ public class CloudRenderer implements IResourceManagerReloadListener { if (slice > -CULL_DIST) { slice += INSET; tessellator.pos(slice, 0, sectZ1).tex(sliceCoord0, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); - tessellator.pos(slice, HEIGHT, sectZ1).tex(sliceCoord1, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); - tessellator.pos(slice, HEIGHT, sectZ0).tex(sliceCoord1, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); + tessellator.pos(slice, height, sectZ1).tex(sliceCoord1, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); + tessellator.pos(slice, height, sectZ0).tex(sliceCoord1, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); tessellator.pos(slice, 0, sectZ0).tex(sliceCoord0, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); slice -= INSET; } @@ -168,8 +170,8 @@ public class CloudRenderer implements IResourceManagerReloadListener { if (slice <= CULL_DIST) { slice -= INSET; tessellator.pos(slice, 0, sectZ0).tex(sliceCoord0, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); - tessellator.pos(slice, HEIGHT, sectZ0).tex(sliceCoord1, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); - tessellator.pos(slice, HEIGHT, sectZ1).tex(sliceCoord1, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); + tessellator.pos(slice, height, sectZ0).tex(sliceCoord1, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); + tessellator.pos(slice, height, sectZ1).tex(sliceCoord1, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); tessellator.pos(slice, 0, sectZ1).tex(sliceCoord0, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex(); slice += INSET; } @@ -183,8 +185,8 @@ public class CloudRenderer implements IResourceManagerReloadListener { if (slice > -CULL_DIST) { slice += INSET; tessellator.pos(sectX0, 0, slice).tex(u0, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); - tessellator.pos(sectX0, HEIGHT, slice).tex(u0, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); - tessellator.pos(sectX1, HEIGHT, slice).tex(u1, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); + tessellator.pos(sectX0, height, slice).tex(u0, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); + tessellator.pos(sectX1, height, slice).tex(u1, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); tessellator.pos(sectX1, 0, slice).tex(u1, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); slice -= INSET; } @@ -194,8 +196,8 @@ public class CloudRenderer implements IResourceManagerReloadListener { if (slice <= CULL_DIST) { slice -= INSET; tessellator.pos(sectX1, 0, slice).tex(u1, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); - tessellator.pos(sectX1, HEIGHT, slice).tex(u1, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); - tessellator.pos(sectX0, HEIGHT, slice).tex(u0, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); + tessellator.pos(sectX1, height, slice).tex(u1, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); + tessellator.pos(sectX0, height, slice).tex(u0, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); tessellator.pos(sectX0, 0, slice).tex(u0, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex(); slice += INSET; } @@ -238,21 +240,32 @@ public class CloudRenderer implements IResourceManagerReloadListener { public void checkSettings() { GraphicsQualityOff cloudGraphicsQuality = (GraphicsQualityOff)Settings.MODE_CLOUDS.option.getStore(); - final int cloudQualitySetting = cloudGraphicsQuality == GraphicsQualityOff.FANCY + final int cloudQualitySetting = cloudGraphicsQuality == GraphicsQualityOff.FANCY || cloudGraphicsQuality == GraphicsQualityOff.DEFAULT && mc.gameSettings.fancyGraphics ? 2 : 1; - boolean newEnabled = mc.gameSettings.shouldRenderClouds() + final boolean newEnabled = mc.gameSettings.shouldRenderClouds() && mc.theWorld != null && mc.theWorld.provider.isSurfaceWorld(); + final int targetDistance = Math.max(mc.gameSettings.renderDistanceChunks, (int)Settings.RENDER_DISTANCE_CLOUDS.option.getStore()); + final int cloudScaleMult = (int)Settings.CLOUD_SCALE.option.getStore(); if (isBuilt() && (!newEnabled || cloudQualitySetting != cloudMode - || mc.gameSettings.renderDistanceChunks != renderDistance)) { + || targetDistance != renderDistance + || cloudScaleMult != scaleMult)) { dispose(); } cloudMode = cloudQualitySetting; - renderDistance = mc.gameSettings.renderDistanceChunks; + renderDistance = targetDistance; + scaleMult = cloudScaleMult; + + cloudElevation = mc.theWorld == null ? 128 : (int)mc.theWorld.provider.getCloudHeight(); + //Allows the setting to work with RFG and similar without hardcoding. + //The minimum height check is so stuff like Aether cloud height doesn't get messed up. + if(cloudElevation >= 96) { + cloudElevation = (int)Settings.CLOUD_HEIGHT.option.getStore(); + } if (newEnabled && !isBuilt()) { build(); @@ -268,7 +281,7 @@ public class CloudRenderer implements IResourceManagerReloadListener { double totalOffset = cloudTicks + partialTicks; double x = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks + totalOffset * 0.03; - double y = mc.theWorld.provider.getCloudHeight() - (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks) + 0.33; + double y = cloudElevation - (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks) + 0.33; double z = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks; int scale = getScale(); diff --git a/src/main/java/jss/notfine/core/Settings.java b/src/main/java/jss/notfine/core/Settings.java index bbebada7b..ce2a59b81 100644 --- a/src/main/java/jss/notfine/core/Settings.java +++ b/src/main/java/jss/notfine/core/Settings.java @@ -40,7 +40,7 @@ public enum Settings { SettingsManager.cloudsUpdated(); } }, - CLOUD_SCALE(new NotFineOptionSlider(4, 2, 20, 1, null)), + CLOUD_SCALE(new NotFineOptionSlider(1, 1, 3, 1, null)), DOWNFALL_DISTANCE(new NotFineOptionCycling<>(DownfallQuality.DEFAULT, OptionImpact.MEDIUM)) { @Override public void applyChanges() { @@ -112,7 +112,7 @@ public enum Settings { }, PARTICLES_ENC_TABLE(new NotFineOptionSlider(1, 0, 16, 1, OptionImpact.LOW)), PARTICLES_VOID(new NotFineOptionTickBox(true, OptionImpact.LOW)), - RENDER_DISTANCE_CLOUDS(new NotFineOptionSlider(4, 4, 64, 2, OptionImpact.VARIES)) { + RENDER_DISTANCE_CLOUDS(new NotFineOptionSlider(4, 4, 64, 1, OptionImpact.VARIES)) { @Override public void applyChanges() { SettingsManager.cloudsUpdated(); @@ -172,8 +172,7 @@ public enum Settings { @Override public Control getControl() { - //TODO: Don't hardcode CLOUD_SCALE check. - return new SliderControl(this, min, max, step, setting != Settings.CLOUD_SCALE ? ControlValueFormatter.number() : NotFineControlValueFormatter.multiplied(0.25f)); + return new SliderControl(this, min, max, step, ControlValueFormatter.number()); } @Override diff --git a/src/main/java/jss/notfine/core/SettingsManager.java b/src/main/java/jss/notfine/core/SettingsManager.java index 7bc96dcf9..156c596c0 100644 --- a/src/main/java/jss/notfine/core/SettingsManager.java +++ b/src/main/java/jss/notfine/core/SettingsManager.java @@ -57,8 +57,8 @@ public class SettingsManager { public static void cloudsUpdated() { if(Settings.MODE_CLOUDS.option.getStore() != GraphicsQualityOff.OFF) { - minimumFarPlaneDistance = 32 * (int)Settings.RENDER_DISTANCE_CLOUDS.option.getStore(); - minimumFarPlaneDistance += Math.abs((int)Settings.CLOUD_HEIGHT.option.getStore()); + minimumFarPlaneDistance = 32 * ((int)Settings.RENDER_DISTANCE_CLOUDS.option.getStore()); + minimumFarPlaneDistance += (int)Settings.CLOUD_HEIGHT.option.getStore(); mc.gameSettings.clouds = true; } else { minimumFarPlaneDistance = 128; diff --git a/src/main/java/jss/notfine/gui/NotFineGameOptionPages.java b/src/main/java/jss/notfine/gui/NotFineGameOptionPages.java index 5f23e589d..7fab2e815 100644 --- a/src/main/java/jss/notfine/gui/NotFineGameOptionPages.java +++ b/src/main/java/jss/notfine/gui/NotFineGameOptionPages.java @@ -206,9 +206,9 @@ public class NotFineGameOptionPages { .add(Settings.MODE_SKY.option) .add(Settings.MODE_SUN_MOON.option) .add(Settings.MODE_CLOUDS.option) - //.add(Settings.RENDER_DISTANCE_CLOUDS.option) + .add(Settings.RENDER_DISTANCE_CLOUDS.option) .add(Settings.CLOUD_HEIGHT.option) - //.add(Settings.CLOUD_SCALE.option) + .add(Settings.CLOUD_SCALE.option) .add(Settings.MODE_CLOUD_TRANSLUCENCY.option) .add(Settings.MODE_STARS.option) .add(Settings.TOTAL_STARS.option) diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java index 19b2cd524..745a9cfd1 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java @@ -81,9 +81,9 @@ public class SodiumGameOptionPages { firstGroupBuilder.add(Settings.MODE_LIGHT_FLICKER.option) .add(Settings.MODE_SKY.option) .add(Settings.MODE_SUN_MOON.option) - //.add(Settings.RENDER_DISTANCE_CLOUDS.option) + .add(Settings.RENDER_DISTANCE_CLOUDS.option) .add(Settings.CLOUD_HEIGHT.option) - //.add(Settings.CLOUD_SCALE.option) + .add(Settings.CLOUD_SCALE.option) .add(Settings.MODE_CLOUD_TRANSLUCENCY.option) .add(Settings.MODE_STARS.option) .add(Settings.TOTAL_STARS.option) diff --git a/src/main/resources/assets/notfine/lang/en_US.lang b/src/main/resources/assets/notfine/lang/en_US.lang index 0978d8f97..13a3ea63e 100644 --- a/src/main/resources/assets/notfine/lang/en_US.lang +++ b/src/main/resources/assets/notfine/lang/en_US.lang @@ -10,7 +10,7 @@ options.graphics.smart=Smart options.graphics.ultra=Ultra options.off=Off options.on=On -options.cloud_height=Cloud Height +options.cloud_height=Cloud Elevation options.cloud_scale=Cloud Scale options.gui_background=Background options.downfall_distance=Weather Effects @@ -33,7 +33,7 @@ options.mode_water=Water options.mode_vignette=Vignette options.particles_enc_table=Enchantment Particles options.particles_void=Void Particles -options.render_distance_clouds=Cloud Render Distance +options.render_distance_clouds=Minimum Cloud Distance options.title.detail=Detail Settings options.title.other=Other Settings options.title.particle=Particle Settings