parent
991972216e
commit
32b8215435
@ -8,19 +8,23 @@ import com.mojang.blaze3d.systems.RenderSystem
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder
|
||||
import com.mojang.blaze3d.vertex.BufferUploader
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat
|
||||
import com.mojang.blaze3d.vertex.Tesselator
|
||||
import com.mojang.blaze3d.vertex.VertexBuffer
|
||||
import com.mojang.blaze3d.vertex.VertexFormat
|
||||
import com.mojang.math.Matrix4f
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectFunction
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.renderer.FogRenderer
|
||||
import net.minecraft.client.renderer.GameRenderer
|
||||
import net.minecraft.core.Vec3i
|
||||
import net.minecraft.world.level.levelgen.XoroshiroRandomSource
|
||||
import org.lwjgl.opengl.GL14
|
||||
import ru.dbotthepony.mc.otm.ClientConfig
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
|
||||
import ru.dbotthepony.mc.otm.capability.matteryPlayer
|
||||
import ru.dbotthepony.mc.otm.client.minecraft
|
||||
import ru.dbotthepony.mc.otm.core.RGBAColor
|
||||
import ru.dbotthepony.mc.otm.core.component1
|
||||
import ru.dbotthepony.mc.otm.core.component2
|
||||
import ru.dbotthepony.mc.otm.core.component3
|
||||
@ -453,10 +457,6 @@ object GlitchRenderer {
|
||||
glitchBuffer.resize(minecraft.window.width, minecraft.window.height, Minecraft.ON_OSX)
|
||||
}
|
||||
|
||||
glitchBuffer.bindWrite(true)
|
||||
RenderSystem.clearColor(0f, 0f, 0f, 1f)
|
||||
RenderSystem.clear(GlConst.GL_COLOR_BUFFER_BIT, Minecraft.ON_OSX)
|
||||
|
||||
if (System.nanoTime() - lastGlitch >= nextGlitch) {
|
||||
makeGlitch()
|
||||
}
|
||||
@ -465,9 +465,41 @@ object GlitchRenderer {
|
||||
makeColorGlitch()
|
||||
}
|
||||
|
||||
if (!Minecraft.useShaderTransparency()) {
|
||||
glitchBuffer.bindWrite(true)
|
||||
RenderSystem.clearColor(FogRenderer.fogRed, FogRenderer.fogGreen, FogRenderer.fogBlue, 1f)
|
||||
RenderSystem.clear(GlConst.GL_COLOR_BUFFER_BIT, Minecraft.ON_OSX)
|
||||
|
||||
// fix main rendertarget transparency (which is everything on screen that is not covered by anything, unless running Fabulous! graphics option)
|
||||
// this is required because Minecraft's builtin fragement shaders are stupid
|
||||
// and discard fully transparent fragments
|
||||
// when, in fact, alpha channel is just another color channel, and it's meaning is dictated
|
||||
// by render context, and it is not strictly "transparency"
|
||||
// the downside of this is RGBA8888 texture double copy, requiring a lot of video memory bandwidth
|
||||
// and no, trying to render "fog" solid color overlay quad over main rendertarget with proper blend mode
|
||||
RenderSystem.setShaderTexture(0, minecraft.mainRenderTarget.colorTextureId)
|
||||
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ZERO, GlStateManager.DestFactor.ONE)
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader)
|
||||
|
||||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
||||
draw(0.0, 0.0)
|
||||
minecraft.mainRenderTarget.bindWrite(true)
|
||||
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader)
|
||||
|
||||
RenderSystem.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO)
|
||||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
||||
RenderSystem.setShaderTexture(0, glitchBuffer.colorTextureId)
|
||||
draw(0.0, 0.0)
|
||||
}
|
||||
|
||||
glitchBuffer.bindWrite(true)
|
||||
RenderSystem.clearColor(0f, 0f, 0f, 1f)
|
||||
RenderSystem.clear(GlConst.GL_COLOR_BUFFER_BIT, Minecraft.ON_OSX)
|
||||
|
||||
// distort colors by sampling main frame buffer (raw stage)
|
||||
RenderSystem.setShaderTexture(0, minecraft.mainRenderTarget.colorTextureId)
|
||||
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_DST_ALPHA)
|
||||
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ZERO, GlStateManager.DestFactor.ONE)
|
||||
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader)
|
||||
|
||||
|
@ -174,3 +174,7 @@ public net.minecraft.client.renderer.RenderStateShard f_110127_ # WEATHER_TARGET
|
||||
public net.minecraft.client.renderer.RenderStateShard$LineStateShard
|
||||
|
||||
public net.minecraft.world.inventory.AbstractContainerMenu m_38897_(Lnet/minecraft/world/inventory/Slot;)Lnet/minecraft/world/inventory/Slot; # addSlot
|
||||
|
||||
public net.minecraft.client.renderer.FogRenderer f_109012_ # fogBlue
|
||||
public net.minecraft.client.renderer.FogRenderer f_109011_ # fogGreen
|
||||
public net.minecraft.client.renderer.FogRenderer f_109010_ # fogRed
|
||||
|
Loading…
Reference in New Issue
Block a user