diff options
author | Linnea Gräf <nea@nea.moe> | 2024-03-24 00:43:16 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-03-24 00:43:16 +0100 |
commit | a84da715497215848797719fe528c2f5c1d4aed3 (patch) | |
tree | 3be839c8cf6fb080b7307919d94bb82666f79a7b /src/main/kotlin/moe/nea/firmament/util | |
parent | 55586a64d7037cdc557b8b2c337d284ddb1ac981 (diff) | |
download | Firmament-a84da715497215848797719fe528c2f5c1d4aed3.tar.gz Firmament-a84da715497215848797719fe528c2f5c1d4aed3.tar.bz2 Firmament-a84da715497215848797719fe528c2f5c1d4aed3.zip |
Add ordered waypoints (ColeWeight compat)
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/util')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/util/render/RenderInWorldContext.kt | 10 |
1 files changed, 10 insertions, 0 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 897fabb..ecaf3f9 100644 --- a/src/main/kotlin/moe/nea/firmament/util/render/RenderInWorldContext.kt +++ b/src/main/kotlin/moe/nea/firmament/util/render/RenderInWorldContext.kt @@ -1,5 +1,6 @@ /* * SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe> + * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe> * * SPDX-License-Identifier: GPL-3.0-or-later */ @@ -44,6 +45,10 @@ class RenderInWorldContext private constructor( val effectiveFov = (MC.instance.gameRenderer as AccessorGameRenderer).getFov_firmament(camera, tickDelta, true) val effectiveFovScaleFactor = 1 / tan(toRadians(effectiveFov) / 2) + fun color(color: me.shedaniel.math.Color) { + color(color.red / 255F, color.green / 255f, color.blue / 255f, color.alpha / 255f) + } + fun color(red: Float, green: Float, blue: Float, alpha: Float) { RenderSystem.setShaderColor(red, green, blue, alpha) } @@ -140,6 +145,11 @@ class RenderInWorldContext private constructor( line(points.toList(), lineWidth) } + fun tracer(toWhere: Vec3d, lineWidth: Float = 3f) { + val cameraForward = Vector3f(0f, 0f, 1f).rotate(camera.rotation) + line(camera.pos.add(Vec3d(cameraForward)), toWhere, lineWidth = 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()) |