Skip to content

Commit

Permalink
Background Tessellator
Browse files Browse the repository at this point in the history
  • Loading branch information
MukjepScarlet committed Dec 22, 2024
1 parent 4f15fee commit 5f6ab12
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ package net.ccbluex.liquidbounce.utils.render.shader
import net.ccbluex.liquidbounce.LiquidBounce.CLIENT_NAME
import net.ccbluex.liquidbounce.utils.client.ClientUtils.LOGGER
import net.ccbluex.liquidbounce.utils.client.MinecraftInstance.Companion.mc
import net.ccbluex.liquidbounce.utils.render.drawWithTessellatorWorldRenderer
import net.ccbluex.liquidbounce.utils.render.shader.shaders.BackgroundShader
import net.minecraft.client.gui.Gui
import net.minecraft.client.renderer.GlStateManager.color
import net.minecraft.client.renderer.Tessellator
import net.minecraft.client.renderer.texture.DynamicTexture
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
import net.minecraft.util.ResourceLocation
Expand Down Expand Up @@ -88,14 +88,13 @@ private class ShaderBackground(backgroundFile: File) : Background(backgroundFile
if (shaderInitialized) {
shader.startShader()

val instance = Tessellator.getInstance()
val worldRenderer = instance.worldRenderer
worldRenderer.begin(7, DefaultVertexFormats.POSITION)
worldRenderer.pos(0.0, height.toDouble(), 0.0).endVertex()
worldRenderer.pos(width.toDouble(), height.toDouble(), 0.0).endVertex()
worldRenderer.pos(width.toDouble(), 0.0, 0.0).endVertex()
worldRenderer.pos(0.0, 0.0, 0.0).endVertex()
instance.draw()
drawWithTessellatorWorldRenderer {
begin(7, DefaultVertexFormats.POSITION)
pos(0.0, height.toDouble(), 0.0).endVertex()
pos(width.toDouble(), height.toDouble(), 0.0).endVertex()
pos(width.toDouble(), 0.0, 0.0).endVertex()
pos(0.0, 0.0, 0.0).endVertex()
}

shader.stopShader()
}
Expand Down

0 comments on commit 5f6ab12

Please sign in to comment.