Skip to content

Commit

Permalink
generalize binding framebuffer to every time its called when blur is …
Browse files Browse the repository at this point in the history
…working
  • Loading branch information
Wyvest committed Jul 4, 2024
1 parent 5f62b67 commit 66ea9ae
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 69 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod_name = PolyBlur
mod_id = polyblur
mod_version = 1.0.1
mod_version = 1.0.2
mod_archives_name=PolyBlur

# Gradle Configuration -- DO NOT TOUCH THESE VALUES.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class MonkeyBlur {
private final Minecraft mc = Minecraft.getMinecraft();

public MonkeyBuffer frameBuffer = null;
public boolean drawingBuffer = false;
public Shader monkeyblurShader = null;

private final FloatBuffer projection = BufferUtils.createFloatBuffer(16);
Expand Down Expand Up @@ -78,6 +79,7 @@ public void startFrame() {

bindFb();
clearFb();
drawingBuffer = true;
}

public void endFrame() {
Expand Down Expand Up @@ -106,10 +108,9 @@ public void endFrame() {
previousCameraPosY = cameraPosY;
previousCameraPosZ = cameraPosZ;
}
drawingBuffer = false;
if (!isEnabled()) return;

//mc.renderGlobal.renderEntityOutlineFramebuffer();

unbindFb();

if (monkeyblurShader == null) {
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/org/polyfrost/polyblur/mixin/FramebufferMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.polyfrost.polyblur.mixin;

import net.minecraft.client.Minecraft;
import net.minecraft.client.shader.Framebuffer;
import org.polyfrost.polyblur.blurs.monkey.MonkeyBlur;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(Framebuffer.class)
public class FramebufferMixin {

@Unique private final Framebuffer polyBlur$self = (Framebuffer) (Object) this;

@Inject(method = "bindFramebuffer", at = @At("TAIL"))
private void onBindFramebuffer(boolean p_147610_1_, CallbackInfo ci) {
if (MonkeyBlur.instance.drawingBuffer && polyBlur$self == Minecraft.getMinecraft().getFramebuffer()) {
MonkeyBlur.instance.bindFb();
}
}
}
19 changes: 0 additions & 19 deletions src/main/java/org/polyfrost/polyblur/mixin/RenderGlobalMixin.java

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 2 additions & 4 deletions src/main/resources/mixins.polyblur.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
"BlurModMixin",
"EntityRendererMixin",
"EntityRendererMixin_PhosphorBlur",
"FramebufferMixin",
"MinecraftMixin",
"OptifineConfigMixin",
"RenderGlobalMixin",
"SBAEntityOutlineRendererMixin",
"ShaderGroupAccessor",
"SkyHanniEntityOutlineRendererMixin"
"ShaderGroupAccessor"
]
}

0 comments on commit 66ea9ae

Please sign in to comment.