From a84da715497215848797719fe528c2f5c1d4aed3 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Sun, 24 Mar 2024 00:43:16 +0100 Subject: Add ordered waypoints (ColeWeight compat) --- .../moe/nea/firmament/util/render/RenderInWorldContext.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/main/kotlin/moe/nea/firmament/util') 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 + * SPDX-FileCopyrightText: 2024 Linnea Gräf * * 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, lineWidth: Float = 10F) { RenderSystem.setShader(GameRenderer::getRenderTypeLinesProgram) RenderSystem.lineWidth(lineWidth / pow(camera.pos.squaredDistanceTo(points.first()), 0.25).toFloat()) -- cgit