From f6f8fef556e74f24187ad2a6296f573024a378b3 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Fri, 8 Nov 2024 17:52:10 +0100 Subject: Fix line renderer --- src/main/kotlin/util/render/FirmamentShaders.kt | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/main/kotlin/util/render') diff --git a/src/main/kotlin/util/render/FirmamentShaders.kt b/src/main/kotlin/util/render/FirmamentShaders.kt index 5147088..ba67dbb 100644 --- a/src/main/kotlin/util/render/FirmamentShaders.kt +++ b/src/main/kotlin/util/render/FirmamentShaders.kt @@ -3,14 +3,28 @@ package moe.nea.firmament.util.render import net.minecraft.client.gl.Defines import net.minecraft.client.gl.ShaderProgramKey import net.minecraft.client.render.RenderPhase +import net.minecraft.client.render.VertexFormat import net.minecraft.client.render.VertexFormats import moe.nea.firmament.Firmament +import moe.nea.firmament.annotations.Subscribe +import moe.nea.firmament.events.DebugInstantiateEvent +import moe.nea.firmament.util.MC object FirmamentShaders { + val shaders = mutableListOf() + private fun shader(name: String, format: VertexFormat, defines: Defines): ShaderProgramKey { + val key = ShaderProgramKey(Firmament.identifier(name), format, defines) + shaders.add(key) + return key + } - val _LINES: ShaderProgramKey = - ShaderProgramKey(Firmament.identifier("rendertype_lines"), VertexFormats.LINES, Defines.EMPTY) - val LINES = RenderPhase.ShaderProgram(_LINES) + val LINES = RenderPhase.ShaderProgram(shader("core/rendertype_lines", VertexFormats.LINES, Defines.EMPTY)) + @Subscribe + fun debugLoad(event: DebugInstantiateEvent) { + shaders.forEach { + MC.instance.shaderLoader.getOrCreateProgram(it) + } + } } -- cgit