Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.polyfrost.oneconfig.api.platform.v1.ScreenPlatform;
import org.polyfrost.oneconfig.internal.ui.compose.ComposeScreen;
import org.polyfrost.oneconfig.internal.ui.compose.ComposeSupport;
import org.polyfrost.oneconfig.internal.ui.compose.GlHost;
//? if = 1.8.9
//import org.polyfrost.oneconfig.internal.legacy.LegacyPanoramaTracker;

Expand All @@ -47,6 +48,11 @@ public void runOnUiThread(Runnable action) {
else minecraft.execute(action);
}

@Override
public boolean supportsBackdropGlass() {
return !GlHost.vanillaPipeline;
}

@Override
public int viewportWidth() {
return Minecraft.getInstance().getWindow().getWidth();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
package org.polyfrost.oneconfig.internal.mixin.render;

//? if >= 1.21.11 {
import com.mojang.blaze3d.pipeline.RenderTarget;
//? if < 26.2 {
/*import com.mojang.blaze3d.vertex.VertexFormat;
import com.mojang.renderpearl.api.buffers.GpuBuffer;
*///?}
import com.mojang.renderpearl.api.buffers.GpuBufferSlice;
import com.mojang.renderpearl.api.commands.RenderPass;
import net.minecraft.client.gui.render.GuiRenderer;
//? if >= 26.1 {
Expand All @@ -9,24 +15,29 @@
//import net.minecraft.client.gui.render.state.GuiElementRenderState;
import org.polyfrost.oneconfig.internal.ui.compose.GlHost;
import org.polyfrost.oneconfig.internal.ui.compose.KeptMeshes;
import org.polyfrost.oneconfig.internal.ui.compose.LiquidGlass;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Coerce;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.List;
import java.util.function.Supplier;

@Mixin(GuiRenderer.class)
public class Mixin_GuiRendererKeptMeshes {
@Shadow @Final private List<?> draws;
@Unique private boolean oneconfig$splitting;

//? if >= 26.2 {
@Inject(method = "addElementToMesh", at = @At("TAIL"))
private void oneconfig$noteKept(GuiElementRenderState element, CallbackInfo ci) {
KeptMeshes.added(draws.get(draws.size() - 1), element);
LiquidGlass.added(draws.get(draws.size() - 1), element);
}

@Inject(method = "executeDraw", at = @At("HEAD"), cancellable = true)
Expand All @@ -39,11 +50,13 @@ public class Mixin_GuiRendererKeptMeshes {
@Inject(method = "addElementToMesh", at = @At("TAIL"))
private void oneconfig$noteKept(GuiElementRenderState element, CallbackInfo ci) {
KeptMeshes.added(meshesToDraw.size(), element);
LiquidGlass.added(meshesToDraw.size(), element);
}

@Inject(method = "recordDraws", at = @At("TAIL"))
private void oneconfig$bindKept(CallbackInfo ci) {
KeptMeshes.recorded(draws);
LiquidGlass.recorded(draws);
}

@Inject(method = "executeDraw", at = @At("HEAD"), cancellable = true)
Expand All @@ -55,9 +68,44 @@ public class Mixin_GuiRendererKeptMeshes {
}
*///?}

//? if >= 26.2 {
@Shadow
private void executeDrawRange(Supplier<String> label, RenderTarget mainRenderTarget, GpuBufferSlice dynamicTransforms, int startIndex, int endIndex) {
}

@Inject(method = "executeDrawRange", at = @At("HEAD"), cancellable = true)
private void oneconfig$splitForGlass(Supplier<String> label, RenderTarget mainRenderTarget, GpuBufferSlice dynamicTransforms, int startIndex, int endIndex, CallbackInfo ci) {
if (oneconfig$splitting || !LiquidGlass.has(draws, startIndex, endIndex)) return;
ci.cancel();
oneconfig$splitting = true;
try {
LiquidGlass.split(draws, startIndex, endIndex, mainRenderTarget, (from, to) -> executeDrawRange(label, mainRenderTarget, dynamicTransforms, from, to));
} finally {
oneconfig$splitting = false;
}
}
//?} else {
/*@Shadow
private void executeDrawRange(Supplier<String> label, RenderTarget mainRenderTarget, GpuBufferSlice fogBuffer, GpuBufferSlice dynamicTransforms, GpuBuffer indexBuffer, VertexFormat.IndexType indexType, int startIndex, int endIndex) {
}

@Inject(method = "executeDrawRange", at = @At("HEAD"), cancellable = true)
private void oneconfig$splitForGlass(Supplier<String> label, RenderTarget mainRenderTarget, GpuBufferSlice fogBuffer, GpuBufferSlice dynamicTransforms, GpuBuffer indexBuffer, VertexFormat.IndexType indexType, int startIndex, int endIndex, CallbackInfo ci) {
if (oneconfig$splitting || !LiquidGlass.has(draws, startIndex, endIndex)) return;
ci.cancel();
oneconfig$splitting = true;
try {
LiquidGlass.split(draws, startIndex, endIndex, mainRenderTarget, (from, to) -> executeDrawRange(label, mainRenderTarget, fogBuffer, dynamicTransforms, indexBuffer, indexType, from, to));
} finally {
oneconfig$splitting = false;
}
}
*///?}

@Inject(method = "render", at = @At("TAIL"))
private void oneconfig$endFrame(CallbackInfo ci) {
KeptMeshes.endFrame();
LiquidGlass.endFrame();
}
}
//?}
Loading
Loading