diff --git a/gradle.properties b/gradle.properties index abf8a756..e33025ed 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,7 +24,7 @@ parchment_version=2023.09.03-1.20.1 # Mod Properties mod_name=Lodestone mod_id=lodestone -mod_version=1.5.5 +mod_version=1.5.6 mod_license=GPLv3 mod_group_id=team.lodestar.lodestone # The authors of the mod. This is a simple text string that is used for display purposes in the mod list. diff --git a/src/main/java/team/lodestar/lodestone/handlers/RenderHandler.java b/src/main/java/team/lodestar/lodestone/handlers/RenderHandler.java index f622ff5e..da6b5f92 100644 --- a/src/main/java/team/lodestar/lodestone/handlers/RenderHandler.java +++ b/src/main/java/team/lodestar/lodestone/handlers/RenderHandler.java @@ -63,21 +63,22 @@ public static void onClientSetup() { } public static void setupLodestoneRenderTargets() { - Minecraft minecraft = Minecraft.getInstance(); - try { - PostChain postChain = new PostChain(minecraft.getTextureManager(), minecraft.getResourceManager(), minecraft.getMainRenderTarget(), LodestoneLib.lodestonePath("shaders/lodestone_post_chain.json")); - postChain.resize(minecraft.getWindow().getWidth(), minecraft.getWindow().getHeight()); - LODESTONE_DEPTH_CACHE = postChain.getTempTarget("lodestone_depth_cache"); - - LODESTONE_TRANSLUCENT = postChain.getTempTarget("lodestone_translucent"); - LODESTONE_TRANSLUCENT_PARTICLE = postChain.getTempTarget("lodestone_translucent_particle"); - LODESTONE_ADDITIVE = postChain.getTempTarget("lodestone_additive"); - LODESTONE_ADDITIVE_PARTICLE = postChain.getTempTarget("lodestone_additive_particle"); - - LODESTONE_POST_CHAIN = postChain; - } - catch (Exception exception) { - throw new RuntimeException(exception); + if (ClientConfig.EXPERIMENTAL_FABULOUS_LAYERING.getConfigValue()) { + Minecraft minecraft = Minecraft.getInstance(); + try { + PostChain postChain = new PostChain(minecraft.getTextureManager(), minecraft.getResourceManager(), minecraft.getMainRenderTarget(), LodestoneLib.lodestonePath("shaders/lodestone_post_chain.json")); + postChain.resize(minecraft.getWindow().getWidth(), minecraft.getWindow().getHeight()); + LODESTONE_DEPTH_CACHE = postChain.getTempTarget("lodestone_depth_cache"); + + LODESTONE_TRANSLUCENT = postChain.getTempTarget("lodestone_translucent"); + LODESTONE_TRANSLUCENT_PARTICLE = postChain.getTempTarget("lodestone_translucent_particle"); + LODESTONE_ADDITIVE = postChain.getTempTarget("lodestone_additive"); + LODESTONE_ADDITIVE_PARTICLE = postChain.getTempTarget("lodestone_additive_particle"); + + LODESTONE_POST_CHAIN = postChain; + } catch (Exception exception) { + throw new RuntimeException(exception); + } } } @@ -106,6 +107,11 @@ public static void resize(int width, int height) { } public static void endBatchesEarly() { + if (ClientConfig.EXPERIMENTAL_FABULOUS_LAYERING.getConfigValue()) { + endBatchesExperimental(DELAYED_RENDER); + endBatchesExperimental(LATE_DELAYED_RENDER); + return; + } endBatches(DELAYED_RENDER); endBatches(LATE_DELAYED_RENDER); } @@ -136,48 +142,42 @@ public static void endBatches(LodestoneRenderLayer renderLayer) { endBufferedRendering(); } - public static void endBatchesExperimental(LodestoneRenderLayer renderLayer,boolean isFabulous) { + public static void endBatchesExperimental(LodestoneRenderLayer renderLayer) { LevelRenderer levelRenderer = Minecraft.getInstance().levelRenderer; Matrix4f last = new Matrix4f(RenderSystem.getModelViewMatrix()); - if (isFabulous) { - LODESTONE_DEPTH_CACHE.copyDepthFrom(Minecraft.getInstance().getMainRenderTarget()); - LODESTONE_TRANSLUCENT_PARTICLE.clear(Minecraft.ON_OSX); - LODESTONE_TRANSLUCENT_PARTICLE.copyDepthFrom(Minecraft.getInstance().getMainRenderTarget()); - LODESTONE_TRANSLUCENT_PARTICLE.bindWrite(false); - } + LODESTONE_DEPTH_CACHE.copyDepthFrom(Minecraft.getInstance().getMainRenderTarget()); + LODESTONE_TRANSLUCENT_PARTICLE.clear(Minecraft.ON_OSX); + LODESTONE_TRANSLUCENT_PARTICLE.copyDepthFrom(Minecraft.getInstance().getMainRenderTarget()); + LODESTONE_TRANSLUCENT_PARTICLE.bindWrite(false); + beginBufferedRendering(); renderBufferedParticles(renderLayer, true); if (RenderHandler.MATRIX4F != null) { RenderSystem.getModelViewMatrix().set(MATRIX4F); } - if (isFabulous) { - LODESTONE_TRANSLUCENT_PARTICLE.unbindWrite(); - LODESTONE_TRANSLUCENT.clear(Minecraft.ON_OSX); - LODESTONE_TRANSLUCENT.copyDepthFrom(Minecraft.getInstance().getMainRenderTarget()); - LODESTONE_TRANSLUCENT.bindWrite(false); - } + LODESTONE_TRANSLUCENT_PARTICLE.unbindWrite(); + LODESTONE_TRANSLUCENT.clear(Minecraft.ON_OSX); + LODESTONE_TRANSLUCENT.copyDepthFrom(Minecraft.getInstance().getMainRenderTarget()); + LODESTONE_TRANSLUCENT.bindWrite(false); + renderBufferedBatches(renderLayer, true); - if (isFabulous) { - LODESTONE_TRANSLUCENT.unbindWrite(); - LODESTONE_ADDITIVE.clear(Minecraft.ON_OSX); - LODESTONE_ADDITIVE.copyDepthFrom(Minecraft.getInstance().getMainRenderTarget()); - LODESTONE_ADDITIVE.bindWrite(false); - } + LODESTONE_TRANSLUCENT.unbindWrite(); + LODESTONE_ADDITIVE.clear(Minecraft.ON_OSX); + LODESTONE_ADDITIVE.copyDepthFrom(Minecraft.getInstance().getMainRenderTarget()); + LODESTONE_ADDITIVE.bindWrite(false); + renderBufferedBatches(renderLayer, false); RenderSystem.getModelViewMatrix().set(last); - if (isFabulous) { - LODESTONE_ADDITIVE.unbindWrite(); - LODESTONE_ADDITIVE_PARTICLE.clear(Minecraft.ON_OSX); - LODESTONE_ADDITIVE_PARTICLE.copyDepthFrom(Minecraft.getInstance().getMainRenderTarget()); - LODESTONE_ADDITIVE_PARTICLE.bindWrite(false); - } + LODESTONE_ADDITIVE.unbindWrite(); + LODESTONE_ADDITIVE_PARTICLE.clear(Minecraft.ON_OSX); + LODESTONE_ADDITIVE_PARTICLE.copyDepthFrom(Minecraft.getInstance().getMainRenderTarget()); + LODESTONE_ADDITIVE_PARTICLE.bindWrite(false); + renderBufferedParticles(renderLayer, false); endBufferedRendering(); - if (isFabulous) { - LODESTONE_ADDITIVE_PARTICLE.unbindWrite(); - levelRenderer.getCloudsTarget().bindWrite(false); - } + LODESTONE_ADDITIVE_PARTICLE.unbindWrite(); + levelRenderer.getCloudsTarget().bindWrite(false); } public static void cacheFogData(float start, float end, FogShape shape) {