diff options
| author | Linnea Gräf <nea@nea.moe> | 2025-07-17 11:52:28 +0200 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2025-07-17 11:52:28 +0200 |
| commit | 25f0e7fd62db22036969120843165f4759530b8f (patch) | |
| tree | 262ed44e0e68464ba99f7650fed8df102c982fe5 /src/main/kotlin/util/render/RenderCircleProgress.kt | |
| parent | 13d64762bbf110fbc52719fb9d93490648199dd2 (diff) | |
| download | Firmament-25f0e7fd62db22036969120843165f4759530b8f.tar.gz Firmament-25f0e7fd62db22036969120843165f4759530b8f.tar.bz2 Firmament-25f0e7fd62db22036969120843165f4759530b8f.zip | |
feat: Launch on 1.21.7
Diffstat (limited to 'src/main/kotlin/util/render/RenderCircleProgress.kt')
| -rw-r--r-- | src/main/kotlin/util/render/RenderCircleProgress.kt | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main/kotlin/util/render/RenderCircleProgress.kt b/src/main/kotlin/util/render/RenderCircleProgress.kt index 81dde6f..2c875f8 100644 --- a/src/main/kotlin/util/render/RenderCircleProgress.kt +++ b/src/main/kotlin/util/render/RenderCircleProgress.kt @@ -4,7 +4,7 @@ import com.mojang.blaze3d.systems.RenderSystem import com.mojang.blaze3d.vertex.VertexFormat import io.github.notenoughupdates.moulconfig.platform.next import java.util.OptionalInt -import org.joml.Matrix4f +import org.joml.Matrix3x2f import util.render.CustomRenderLayers import net.minecraft.client.gui.DrawContext import net.minecraft.client.render.BufferBuilder @@ -19,7 +19,7 @@ object RenderCircleProgress { fun renderCircularSlice( drawContext: DrawContext, - layer: RenderLayer, + layer: RenderLayer.MultiPhase, u1: Float, u2: Float, v1: Float, @@ -28,13 +28,12 @@ object RenderCircleProgress { color: Int = -1, innerCutoutRadius: Float = 0F ) { - drawContext.draw() val sections = angleRadians.nonNegligibleSubSectionsAlignedWith((τ / 8f).toFloat()) .zipWithNext().toList() BufferAllocator(layer.vertexFormat.vertexSize * sections.size * 3).use { allocator -> val bufferBuilder = BufferBuilder(allocator, VertexFormat.DrawMode.TRIANGLES, layer.vertexFormat) - val matrix: Matrix4f = drawContext.matrices.peek().positionMatrix + val matrix: Matrix3x2f = drawContext.matrices for ((sectionStart, sectionEnd) in sections) { val firstPoint = Projections.Two.projectAngleOntoUnitBox(sectionStart.toDouble()) @@ -69,14 +68,15 @@ object RenderCircleProgress { val indexBufferConstructor = RenderSystem.getSequentialBuffer(VertexFormat.DrawMode.TRIANGLES) val indexBuffer = indexBufferConstructor.getIndexBuffer(buffer.drawParameters.indexCount) RenderSystem.getDevice().createCommandEncoder().createRenderPass( - MC.instance.framebuffer.colorAttachment, + { "Firmament Circle Renderer" }, + MC.instance.framebuffer.colorAttachmentView, OptionalInt.empty(), ).use { renderPass -> renderPass.setPipeline(layer.pipeline) - renderPass.setUniform("InnerCutoutRadius", innerCutoutRadius) +// renderPass.setUniform("InnerCutoutRadius", innerCutoutRadius) renderPass.setIndexBuffer(indexBuffer, indexBufferConstructor.indexType) renderPass.setVertexBuffer(0, vertexBuffer) - renderPass.drawIndexed(0, buffer.drawParameters.indexCount) + renderPass.drawIndexed(0, 0, buffer.drawParameters.indexCount, 1) } } } |
