diff options
author | Linnea Gräf <nea@nea.moe> | 2024-01-18 00:10:25 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-01-18 17:55:53 +0100 |
commit | d7902e06cd7285c72cd4ea2be6f18ead56a8775e (patch) | |
tree | fe07a4644bd889a4402d66105e0e6679f104cfb2 /src/main/kotlin/moe/nea/firmament/util | |
parent | ac151c8ebc4c5546795cdbf5b0c179183e2c71d1 (diff) | |
download | Firmament-d7902e06cd7285c72cd4ea2be6f18ead56a8775e.tar.gz Firmament-d7902e06cd7285c72cd4ea2be6f18ead56a8775e.tar.bz2 Firmament-d7902e06cd7285c72cd4ea2be6f18ead56a8775e.zip |
Add Ancestral Spade solver
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/util')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/util/render/RenderInWorldContext.kt | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/util/render/RenderInWorldContext.kt b/src/main/kotlin/moe/nea/firmament/util/render/RenderInWorldContext.kt index aa54979..20f9de8 100644 --- a/src/main/kotlin/moe/nea/firmament/util/render/RenderInWorldContext.kt +++ b/src/main/kotlin/moe/nea/firmament/util/render/RenderInWorldContext.kt @@ -147,12 +147,16 @@ class RenderInWorldContext private constructor( } fun line(vararg points: Vec3d, lineWidth: Float = 10F) { + line(points.toList(), lineWidth) + } + + fun line(points: List<Vec3d>, lineWidth: Float = 10F) { RenderSystem.setShader(GameRenderer::getRenderTypeLinesProgram) RenderSystem.lineWidth(lineWidth / pow(camera.pos.squaredDistanceTo(points.first()), 0.25).toFloat()) buffer.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES) buffer.fixedColor(255, 255, 255, 255) - points.toList().zipWithNext().forEach { (a, b) -> + points.zipWithNext().forEach { (a, b) -> doLine(matrixStack.peek(), buffer, a.x, a.y, a.z, b.x, b.y, b.z) } buffer.unfixColor() @@ -173,7 +177,7 @@ class RenderInWorldContext private constructor( ) { val normal = Vector3f(x.toFloat(), y.toFloat(), z.toFloat()) .sub(i.toFloat(), j.toFloat(), k.toFloat()) - .mul(-1F) + .normalize() buf.vertex(matrix.positionMatrix, i.toFloat(), j.toFloat(), k.toFloat()) .normal(matrix.normalMatrix, normal.x, normal.y, normal.z).next() buf.vertex(matrix.positionMatrix, x.toFloat(), y.toFloat(), z.toFloat()) |