Skip to content

Commit

Permalink
opsi
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySemicolon authored and mrsterner committed Jun 13, 2024
1 parent b24d985 commit 891b475
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
88 changes: 44 additions & 44 deletions src/main/java/team/lodestar/lodestone/handlers/RenderHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 891b475

Please sign in to comment.