mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-03 14:38:50 +00:00
Use separate texture target for alpha buffer rounding
This commit is contained in:
1 parent
352a77f052
commit
172f75c647
2 files changed
+22
-1
No files matched your search
@@ -115,7 +115,6 @@ public class FlashbackConfig {
|
|||||||
|
|
||||||
private transient int saveDelay = 0;
|
private transient int saveDelay = 0;
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public OptionInstance<?>[] createOptionInstances() {
|
public OptionInstance<?>[] createOptionInstances() {
|
||||||
List<OptionInstance<?>> options = new ArrayList<>();
|
List<OptionInstance<?>> options = new ArrayList<>();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
|
|||||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||||
import com.mojang.blaze3d.pipeline.RenderTarget;
|
import com.mojang.blaze3d.pipeline.RenderTarget;
|
||||||
|
import com.mojang.blaze3d.pipeline.TextureTarget;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.BufferBuilder;
|
import com.mojang.blaze3d.vertex.BufferBuilder;
|
||||||
@@ -79,6 +80,14 @@ public abstract class MixinLevelRenderer {
|
|||||||
ReplayUI.lastViewQuaternion = camera.rotation();
|
ReplayUI.lastViewQuaternion = camera.rotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
private RenderTarget roundAlphaBuffer = null;
|
||||||
|
|
||||||
|
@Inject(method = "close", at = @At("HEAD"))
|
||||||
|
public void close(CallbackInfo ci) {
|
||||||
|
this.roundAlphaBuffer.destroyBuffers();
|
||||||
|
}
|
||||||
|
|
||||||
@Inject(method = "renderSectionLayer", at = @At("HEAD"), cancellable = true, require = 0)
|
@Inject(method = "renderSectionLayer", at = @At("HEAD"), cancellable = true, require = 0)
|
||||||
public void renderSectionLayer(RenderType renderType, double d, double e, double f, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) {
|
public void renderSectionLayer(RenderType renderType, double d, double e, double f, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) {
|
||||||
EditorState editorState = EditorStateManager.getCurrent();
|
EditorState editorState = EditorStateManager.getCurrent();
|
||||||
@@ -95,6 +104,15 @@ public abstract class MixinLevelRenderer {
|
|||||||
RenderTarget main = Minecraft.getInstance().mainRenderTarget;
|
RenderTarget main = Minecraft.getInstance().mainRenderTarget;
|
||||||
|
|
||||||
RenderSystem.assertOnRenderThread();
|
RenderSystem.assertOnRenderThread();
|
||||||
|
if (this.roundAlphaBuffer == null) {
|
||||||
|
this.roundAlphaBuffer = new TextureTarget(main.width, main.height, false);
|
||||||
|
} else if (this.roundAlphaBuffer.width != main.width || this.roundAlphaBuffer.height != main.height) {
|
||||||
|
this.roundAlphaBuffer.destroyBuffers();
|
||||||
|
this.roundAlphaBuffer = new TextureTarget(main.width, main.height, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.roundAlphaBuffer.bindWrite(true);
|
||||||
|
|
||||||
GlStateManager._disableDepthTest();
|
GlStateManager._disableDepthTest();
|
||||||
GlStateManager._depthMask(false);
|
GlStateManager._depthMask(false);
|
||||||
GlStateManager._viewport(0, 0, main.viewWidth, main.viewHeight);
|
GlStateManager._viewport(0, 0, main.viewWidth, main.viewHeight);
|
||||||
@@ -109,6 +127,10 @@ public abstract class MixinLevelRenderer {
|
|||||||
bufferBuilder.addVertex(0.0f, 1.0f, 0.0f);
|
bufferBuilder.addVertex(0.0f, 1.0f, 0.0f);
|
||||||
BufferUploader.draw(bufferBuilder.buildOrThrow());
|
BufferUploader.draw(bufferBuilder.buildOrThrow());
|
||||||
shaderInstance.clear();
|
shaderInstance.clear();
|
||||||
|
|
||||||
|
main.bindWrite(true);
|
||||||
|
this.roundAlphaBuffer.blitToScreen(main.width, main.height);
|
||||||
|
|
||||||
GlStateManager._enableBlend();
|
GlStateManager._enableBlend();
|
||||||
GlStateManager._depthMask(true);
|
GlStateManager._depthMask(true);
|
||||||
GlStateManager._enableDepthTest();
|
GlStateManager._enableDepthTest();
|
||||||
|
|||||||
Reference in new issue
Block a user