@@ -3,11 +3,18 @@ package com.lambda.graphics
33import com.lambda.Lambda.mc
44import com.lambda.event.EventFlow.post
55import com.lambda.event.events.RenderEvent
6+ import com.lambda.event.events.TickEvent
7+ import com.lambda.event.listener.SafeListener.Companion.listener
8+ import com.lambda.graphics.animation.Animation.Companion.exp
9+ import com.lambda.graphics.animation.AnimationTicker
10+ import com.lambda.graphics.buffer.FrameBuffer
611import com.lambda.graphics.gl.GlStateUtils.setupGL
712import com.lambda.graphics.gl.Matrices
813import com.lambda.graphics.gl.Matrices.resetMatrices
914import com.lambda.graphics.renderer.esp.global.StaticESP
1015import com.lambda.graphics.renderer.esp.global.DynamicESP
16+ import com.lambda.graphics.shader.Shader
17+ import com.lambda.module.modules.client.ClickGui
1118import com.lambda.module.modules.client.GuiSettings
1219import com.lambda.util.math.Vec2d
1320import com.mojang.blaze3d.systems.RenderSystem.getProjectionMatrix
@@ -16,9 +23,22 @@ import org.joml.Matrix4f
1623object RenderMain {
1724 val projectionMatrix = Matrix4f ()
1825 val modelViewMatrix: Matrix4f get() = Matrices .peek()
19-
2026 var screenSize = Vec2d .ZERO
2127
28+ private val hudAnimation0 = with (AnimationTicker ()) {
29+ listener<TickEvent .Pre > {
30+ tick()
31+ }
32+
33+ exp(0.0 , 1.0 , {
34+ if (mc.currentScreen == null ) ClickGui .closeSpeed else ClickGui .openSpeed
35+ }) { mc.currentScreen == null }
36+ }
37+
38+ private val frameBuffer = FrameBuffer ()
39+ private val shader = Shader (" post/cgui_animation" , " renderer/pos_tex" )
40+ private val hudAnimation by hudAnimation0
41+
2242 @JvmStatic
2343 fun render2D () {
2444 resetMatrices(Matrix4f ().translate(0f , 0f , - 3000f ))
@@ -28,6 +48,7 @@ object RenderMain {
2848 RenderEvent .GUI .Fixed ().post()
2949
3050 rescale(GuiSettings .scale)
51+ drawHUD()
3152 RenderEvent .GUI .Scaled (GuiSettings .scale).post()
3253 }
3354 }
@@ -54,4 +75,19 @@ object RenderMain {
5475 screenSize = Vec2d (scaledWidth, scaledHeight)
5576 projectionMatrix.setOrtho(0f , scaledWidth.toFloat(), scaledHeight.toFloat(), 0f , 1000f , 21000f )
5677 }
78+
79+ private fun drawHUD () {
80+ if (hudAnimation < 0.001 ) return
81+
82+ if (hudAnimation > 0.999 ) {
83+ RenderEvent .GUI .HUD (GuiSettings .scale).post()
84+ return
85+ }
86+
87+ frameBuffer.write {
88+ RenderEvent .GUI .HUD (GuiSettings .scale).post()
89+ }.read(shader) {
90+ it[" u_Progress" ] = hudAnimation
91+ }
92+ }
5793}
0 commit comments