breadcrumbs module

breadcrumbs: Minecraft 26.3 cheat module, full source for every implementation (4 clients: Meteor Client, MelaHack (ThunderHack fork), OfflineClient, …).

4 implementationsRenderRENDER

Full module source: 4 implementations

Every implementation below is the complete module file, verbatim. Expand a client to read its code.

Meteor ClientRendersrc/main/java/meteordevelopment/meteorclient/systems/modules/render/Breadcrumbs.javaJava · 137 lines · 4.2 KB

Displays a trail behind where you have walked.

Settingscolormax-sectionssection-length
Breadcrumbs.javaJava · Minecraft 26.2 · 137 lines · 4.2 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
3
 * Copyright (c) Meteor Development.
4
 */
5
6
package meteordevelopment.meteorclient.systems.modules.render;
7
8
import meteordevelopment.meteorclient.events.render.Render3DEvent;
9
import meteordevelopment.meteorclient.events.world.TickEvent;
10
import meteordevelopment.meteorclient.settings.*;
11
import meteordevelopment.meteorclient.systems.modules.Categories;
12
import meteordevelopment.meteorclient.systems.modules.Module;
13
import meteordevelopment.meteorclient.utils.misc.Pool;
14
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
15
import meteordevelopment.orbit.EventHandler;
16
import net.minecraft.world.level.dimension.DimensionType;
17
18
import java.util.ArrayDeque;
19
import java.util.Queue;
20
21
public class Breadcrumbs extends Module {
22
    private final SettingGroup sgGeneral = settings.getDefaultGroup();
23
24
    private final Setting<SettingColor> color = sgGeneral.add(new ColorSetting.Builder()
25
        .name("color")
26
        .description("The color of the Breadcrumbs trail.")
27
        .defaultValue(new SettingColor(225, 25, 25))
28
        .build()
29
    );
30
31
    private final Setting<Integer> maxSections = sgGeneral.add(new IntSetting.Builder()
32
        .name("max-sections")
33
        .description("The maximum number of sections.")
34
        .defaultValue(1000)
35
        .min(1)
36
        .sliderRange(1, 5000)
37
        .build()
38
    );
39
40
    private final Setting<Double> sectionLength = sgGeneral.add(new DoubleSetting.Builder()
41
        .name("section-length")
42
        .description("The section length in blocks.")
43
        .defaultValue(0.5)
44
        .min(0)
45
        .sliderMax(1)
46
        .build()
47
    );
48
49
    private final Pool<Section> sectionPool = new Pool<>(Section::new);
50
    private final Queue<Section> sections = new ArrayDeque<>();
51
52
    private Section section;
53
54
    private DimensionType lastDimension;
55
56
    public Breadcrumbs() {
57
        super(Categories.Render, "breadcrumbs", "Displays a trail behind where you have walked.");
58
    }
59
60
    @Override
61
    public void onActivate() {
62
        section = sectionPool.get();
63
        section.set1();
64
65
        lastDimension = mc.level.dimensionType();
66
    }
67
68
    @Override
69
    public void onDeactivate() {
70
        sectionPool.freeAll(sections);
71
        sections.clear();
72
    }
73
74
    @EventHandler
75
    private void onTick(TickEvent.Post event) {
76
        if (!mc.getConnection().hasClientLoaded()) return;
77
78
        if (lastDimension != mc.level.dimensionType()) {
79
            sectionPool.freeAll(sections);
80
            sections.clear();
81
        }
82
83
        if (isFarEnough(section.x1, section.y1, section.z1)) {
84
            section.set2();
85
86
            if (sections.size() >= maxSections.get()) {
87
                Section section = sections.poll();
88
                if (section != null) sectionPool.free(section);
89
            }
90
91
            sections.add(section);
92
            section = sectionPool.get();
93
            section.set1();
94
        }
95
96
        lastDimension = mc.level.dimensionType();
97
    }
98
99
    @EventHandler
100
    private void onRender(Render3DEvent event) {
101
        int iLast = -1;
102
103
        for (Section section : sections) {
104
            event.renderer.lines.ensureLineCapacity();
105
106
            if (iLast == -1) {
107
                iLast = event.renderer.lines.vec3(section.x1, section.y1, section.z1).color(color.get()).next();
108
            }
109
110
            int i = event.renderer.lines.vec3(section.x2, section.y2, section.z2).color(color.get()).next();
111
            event.renderer.lines.line(iLast, i);
112
            iLast = i;
113
        }
114
    }
115
116
    private boolean isFarEnough(double x, double y, double z) {
117
        return Math.abs(mc.player.getX() - x) >= sectionLength.get() || Math.abs(mc.player.getY() - y) >= sectionLength.get() || Math.abs(mc.player.getZ() - z) >= sectionLength.get();
118
    }
119
120
    private class Section {
121
        public float x1, y1, z1;
122
        public float x2, y2, z2;
123
124
        public void set1() {
125
            x1 = (float) mc.player.getX();
126
            y1 = (float) mc.player.getY();
127
            z1 = (float) mc.player.getZ();
128
        }
129
130
        public void set2() {
131
            x2 = (float) mc.player.getX();
132
            y2 = (float) mc.player.getY();
133
            z2 = (float) mc.player.getZ();
134
        }
135
    }
136
}
137
MelaHack (ThunderHack fork)RENDERsrc/main/java/thunder/hack/features/modules/render/BreadCrumbs.javaJava · 86 lines · 3.3 KB

Line on your movements.

SettingsThroughWallsListLimitColorModeColor
BreadCrumbs.javaJava · Minecraft 26.2 · 86 lines · 3.3 KB · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.render;
2
3
import com.mojang.blaze3d.vertex.BufferBuilder;
4
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
5
import com.mojang.blaze3d.vertex.PoseStack;
6
import thunder.hack.utility.render.Tesselator;
7
import com.mojang.blaze3d.vertex.VertexFormat;
8
9
import thunder.hack.utility.render.compat.RenderSystem;
10
import meteordevelopment.orbit.EventHandler;
11
import thunder.hack.utility.render.ShaderProgramKeys;
12
import thunder.hack.utility.render.BufferRenderer;
13
import net.minecraft.world.phys.Vec3;
14
import thunder.hack.events.impl.EventPostSync;
15
import thunder.hack.features.modules.Module;
16
import thunder.hack.features.modules.client.HudEditor;
17
import thunder.hack.setting.Setting;
18
import thunder.hack.setting.impl.ColorSetting;
19
import thunder.hack.utility.render.Render2DEngine;
20
import thunder.hack.utility.render.Render3DEngine;
21
22
import java.awt.*;
23
import java.util.List;
24
import java.util.concurrent.CopyOnWriteArrayList;
25
26
public class BreadCrumbs extends Module {
27
    public BreadCrumbs() {
28
        super("BreadCrumbs", Category.RENDER);
29
    }
30
31
    private final Setting<Boolean> throughWalls = new Setting<>("ThroughWalls", true);
32
    private final Setting<Integer> limit = new Setting<>("ListLimit", 1000, 10, 99999);
33
    private final List<Vec3> positions = new CopyOnWriteArrayList<>();
34
    private final Setting<Mode> lmode = new Setting<>("ColorMode", Mode.Sync);
35
    private final Setting<ColorSetting> color = new Setting<>("Color", new ColorSetting(3649978), v -> lmode.getValue() == Mode.Custom);
36
37
    private enum Mode {
38
        Custom, Sync
39
    }
40
41
    public void onRender3D(PoseStack stack) {
42
        Render3DEngine.setupRender();
43
44
        if (throughWalls.getValue())
45
            RenderSystem.disableDepthTest();
46
47
        RenderSystem.disableCull();
48
        RenderSystem.lineWidth(1f);
49
        RenderSystem.setShader(ShaderProgramKeys.RENDERTYPE_LINES);
50
        BufferBuilder buffer = Tesselator.getInstance().begin(com.mojang.blaze3d.PrimitiveTopology.LINES, DefaultVertexFormat.POSITION_COLOR);
51
52
        for (int i = 0; i < positions.size(); i++) {
53
            Vec3 vec1 = null;
54
            try {
55
                vec1 = positions.get(i - 1);
56
            } catch (Exception ignored) {
57
            }
58
            Vec3 vec2 = positions.get(i);
59
            if (vec1 != null && vec2 != null) {
60
                Color c = lmode.getValue() == Mode.Sync ? HudEditor.getColor(i) : color.getValue().getColorObject();
61
                if (i < 10) c = Render2DEngine.injectAlpha(c, (int) (c.getAlpha() * (i / 10f)));
62
                PoseStack matrices = Render3DEngine.matrixFrom(vec1.x(), vec1.y(), vec1.z());
63
                Render3DEngine.vertexLine(matrices, buffer, 0f, 0f, 0f, (float) (vec2.x() - vec1.x()), (float) (vec2.y() - vec1.y()), (float) (vec2.z() - vec1.z()), c);
64
            }
65
        }
66
67
        Render2DEngine.endBuilding(buffer);
68
69
        RenderSystem.enableCull();
70
        if (throughWalls.getValue())
71
            RenderSystem.enableDepthTest();
72
        Render3DEngine.endRender();
73
    }
74
75
    @EventHandler
76
    public void postSync(EventPostSync e) {
77
        if (positions.size() > limit.getValue()) positions.remove(0);
78
        positions.add(new Vec3(mc.player.getX(), mc.player.getBoundingBox().minY, mc.player.getZ()));
79
    }
80
81
    @Override
82
    public void onDisable() {
83
        positions.clear();
84
    }
85
}
86
OfflineClientRENDERsrc/main/java/com/jellypudding/offlineclient/modules/render/Breadcrumbs.javaJava · 190 lines · 6.3 KB

Draws a trail behind you to lead you back.

SettingsThrough wallsColourKeep trailSave trailSpacingFadeMax points
Breadcrumbs.javaJava · Minecraft 26.2 · 190 lines · 6.3 KB · complete file, verbatimOriginal ↗
1
package com.jellypudding.offlineclient.modules.render;
2
3
import com.jellypudding.offlineclient.OfflineClient;
4
import com.jellypudding.offlineclient.event.Subscribe;
5
import com.jellypudding.offlineclient.event.events.Render3DEvent;
6
import com.jellypudding.offlineclient.event.events.TickEvent;
7
import com.jellypudding.offlineclient.module.Category;
8
import com.jellypudding.offlineclient.module.Module;
9
import com.jellypudding.offlineclient.render.DrawBatch;
10
import com.jellypudding.offlineclient.setting.BoolSetting;
11
import com.jellypudding.offlineclient.setting.ColorSetting;
12
import com.jellypudding.offlineclient.setting.NumberSetting;
13
import com.jellypudding.offlineclient.util.ColorUtil;
14
import net.minecraft.resources.ResourceKey;
15
import net.minecraft.world.level.Level;
16
import net.minecraft.world.phys.Vec3;
17
18
import java.io.IOException;
19
import java.nio.file.Files;
20
import java.nio.file.Path;
21
import java.util.ArrayDeque;
22
import java.util.Deque;
23
24
public final class Breadcrumbs extends Module {
25
26
    // Ticks between disk writes.
27
    private static final int SAVE_INTERVAL = 600;
28
29
    private final BoolSetting throughWalls = new BoolSetting("Through walls",
30
        "Show the trail through blocks.", true);
31
    private final ColorSetting color = new ColorSetting("Colour",
32
        "Trail colour.", 190, false);
33
    private final BoolSetting keepTrail = new BoolSetting("Keep trail",
34
        "The trail survives toggling the module off and on.", true);
35
    private final BoolSetting persist = new BoolSetting("Save trail",
36
        "The trail is written to disk and comes back next session.", false);
37
    private final NumberSetting spacing = new NumberSetting("Spacing",
38
        "How far you move before a new point is added.", 0.5, 0.1, 4, 0.1, " blocks").min(0.05);
39
    private final BoolSetting fade = new BoolSetting("Fade",
40
        "Older parts of the trail draw fainter.", false);
41
    private final NumberSetting maxPoints = new NumberSetting("Max points",
42
        "How many points the trail keeps before the oldest drop off.", 10000, 100, 10000, 100, " points")
43
        .min(10).max(100000);
44
45
    private final Deque<Vec3> trail = new ArrayDeque<>();
46
    private ResourceKey<Level> dimension;
47
    private int sinceSave;
48
49
    public Breadcrumbs() {
50
        super("Breadcrumbs", "Draws a trail behind you to lead you back.", Category.RENDER);
51
        addSettings(throughWalls, color, keepTrail, persist, spacing, fade, maxPoints);
52
        searchTags("trail", "path", "waypoint");
53
    }
54
55
    @Override
56
    public String getSuffix() {
57
        return count(trail.size());
58
    }
59
60
    @Override
61
    protected void onEnable() {
62
        if (!keepTrail.isOn()) {
63
            trail.clear();
64
        }
65
        sinceSave = 0;
66
        if (persist.isOn() && inGame()) {
67
            // A trail kept from another world would be drawn at the wrong coordinates
68
            // and then saved over this world.
69
            if (dimension != mc.level.dimension()) {
70
                trail.clear();
71
            }
72
            dimension = mc.level.dimension();
73
            if (trail.isEmpty()) {
74
                load();
75
            }
76
        }
77
    }
78
79
    @Override
80
    protected void onDisable() {
81
        if (persist.isOn()) {
82
            save();
83
        }
84
    }
85
86
    @Subscribe
87
    private void onTick(TickEvent event) {
88
        if (!inGame()) {
89
            return;
90
        }
91
        // A portal or a rejoin swaps the dimension key.
92
        if (mc.level.dimension() != dimension) {
93
            if (persist.isOn() && dimension != null) {
94
                save();
95
            }
96
            dimension = mc.level.dimension();
97
            trail.clear();
98
            if (persist.isOn()) {
99
                load();
100
            }
101
        }
102
103
        if (persist.isOn() && ++sinceSave >= SAVE_INTERVAL) {
104
            sinceSave = 0;
105
            save();
106
        }
107
108
        Vec3 pos = mc.player.position().add(0, 0.1, 0);
109
        double step = spacing.getValue();
110
        if (!trail.isEmpty() && trail.peekLast().distanceToSqr(pos) < step * step) {
111
            return;
112
        }
113
        trail.addLast(pos);
114
        trim();
115
    }
116
117
    @Subscribe
118
    private void onRender3D(Render3DEvent event) {
119
        int total = trail.size();
120
        if (total < 2) {
121
            return;
122
        }
123
        DrawBatch batch = event.getBatch();
124
        int argb = color.getColor();
125
        boolean through = throughWalls.isOn();
126
        boolean fading = fade.isOn();
127
        Vec3 previous = null;
128
        int i = 0;
129
        for (Vec3 point : trail) {
130
            if (previous != null) {
131
                batch.line(previous, point, fading ? ColorUtil.fade(argb, i / (float) total) : argb, through);
132
            }
133
            previous = point;
134
            i++;
135
        }
136
    }
137
138
    private void trim() {
139
        while (trail.size() > maxPoints.getInt()) {
140
            trail.removeFirst();
141
        }
142
    }
143
144
    // One point per line as three plain numbers.
145
    private void save() {
146
        if (dimension == null) {
147
            return;
148
        }
149
        StringBuilder text = new StringBuilder();
150
        for (Vec3 point : trail) {
151
            text.append(point.x).append(' ').append(point.y).append(' ').append(point.z).append('\n');
152
        }
153
        try {
154
            Path file = fileFor(dimension);
155
            Files.createDirectories(file.getParent());
156
            Files.writeString(file, text.toString());
157
        } catch (IOException e) {
158
            OfflineClient.LOG.error("Failed to save trail", e);
159
        }
160
    }
161
162
    private void load() {
163
        if (dimension == null) {
164
            return;
165
        }
166
        Path file = fileFor(dimension);
167
        if (!Files.exists(file)) {
168
            return;
169
        }
170
        try {
171
            for (String line : Files.readAllLines(file)) {
172
                String[] parts = line.split(" ");
173
                if (parts.length != 3) {
174
                    continue;
175
                }
176
                trail.addLast(new Vec3(Double.parseDouble(parts[0]),
177
                    Double.parseDouble(parts[1]), Double.parseDouble(parts[2])));
178
                trim();
179
            }
180
        } catch (IOException | NumberFormatException e) {
181
            OfflineClient.LOG.error("Failed to read trail", e);
182
        }
183
    }
184
185
    private Path fileFor(ResourceKey<Level> key) {
186
        String name = key.identifier().toString().replace(':', '_').replace('/', '_');
187
        return mc.gameDirectory.toPath().resolve("offlineclient").resolve("trails").resolve(name + ".txt");
188
    }
189
}
190
LiquidBounce (Kotlin)RENDERsrc/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/render/ModuleBreadcrumbs.ktKotlin · 226 lines · 7.9 KB

Leaves a trace behind you.

SettingsOnlyOwnColorRainbowHeightAliveFade
ModuleBreadcrumbs.ktKotlin · Minecraft 26.2 · 226 lines · 7.9 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
3
 *
4
 * Copyright (c) 2015 - 2026 CCBlueX
5
 *
6
 * LiquidBounce is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * LiquidBounce is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
18
 */
19
package net.ccbluex.liquidbounce.features.module.modules.render
20
21
import com.mojang.blaze3d.vertex.VertexConsumer
22
import it.unimi.dsi.fastutil.objects.ObjectFloatMutablePair
23
import it.unimi.dsi.fastutil.objects.ObjectFloatPair
24
import net.ccbluex.fastutil.component1
25
import net.ccbluex.fastutil.component2
26
import net.ccbluex.fastutil.mapToArray
27
import net.ccbluex.liquidbounce.config.types.group.ToggleableValueGroup
28
import net.ccbluex.liquidbounce.event.events.GameTickEvent
29
import net.ccbluex.liquidbounce.event.events.WorldChangeEvent
30
import net.ccbluex.liquidbounce.event.events.WorldRenderEvent
31
import net.ccbluex.liquidbounce.event.handler
32
import net.ccbluex.liquidbounce.features.module.ClientModule
33
import net.ccbluex.liquidbounce.features.module.ModuleCategories
34
import net.ccbluex.liquidbounce.render.ClientRenderPipelines
35
import net.ccbluex.liquidbounce.render.addVertex
36
import net.ccbluex.liquidbounce.render.drawCustomMesh
37
import net.ccbluex.liquidbounce.render.renderEnvironment
38
import net.ccbluex.liquidbounce.render.engine.type.Color4b
39
import net.ccbluex.liquidbounce.render.utils.rainbow
40
import net.ccbluex.liquidbounce.utils.math.copy
41
import net.minecraft.world.entity.Entity
42
import net.minecraft.world.phys.Vec3
43
import org.joml.Matrix4fc
44
import org.joml.Vector3f
45
import org.joml.Vector4f
46
import java.util.ArrayDeque
47
import java.util.IdentityHashMap
48
49
/**
50
 * Breadcrumbs module
51
 *
52
 * Leaves traces behind players.
53
 */
54
object ModuleBreadcrumbs : ClientModule("Breadcrumbs", ModuleCategories.RENDER, aliases = listOf("PlayerTrails")) {
55
56
    private val onlyOwn by boolean("OnlyOwn", true)
57
    private val color by color("Color", Color4b(70, 119, 255, 120))
58
    private val colorRainbow by boolean("Rainbow", false)
59
    private val height by float("Height", 0.5f, 0f..2f)
60
61
    private object TemporaryValueGroup : ToggleableValueGroup(this, "Temporary", true) {
62
        val alive by int("Alive", 900, 10..10000, "ms")
63
        val fade by boolean("Fade", true)
64
    }
65
66
    init {
67
        tree(TemporaryValueGroup)
68
    }
69
70
    private val trails = IdentityHashMap<Entity, Trail>()
71
    private val lastPositions = IdentityHashMap<Entity, Vec3>()
72
73
    override fun onDisabled() {
74
        clear()
75
    }
76
77
    val renderHandler = handler<WorldRenderEvent> { event ->
78
        if (trails.isEmpty()) {
79
            return@handler
80
        }
81
82
        val color = if (colorRainbow) rainbow() else color
83
84
        val time = System.currentTimeMillis()
85
        val colorF = color.toVector4f()
86
        val lines = height == 0f
87
88
        event.renderEnvironment {
89
            drawCustomMesh(if (lines) {
90
                ClientRenderPipelines.lines(noDepthTest = true)
91
            } else {
92
                ClientRenderPipelines.quads(noDepthTest = true)
93
            }) {
94
                val renderData = RenderData(poseStack.last().pose(), this, colorF, lines)
95
                trails.forEach { (entity, trail) ->
96
                    trail.verifyAndRenderTrail(renderData, event.camera.position(), entity, time)
97
                }
98
            }
99
        }
100
    }
101
102
    /**
103
     * Updates all trails.
104
     */
105
    @Suppress("unused")
106
    val updateHandler = handler<GameTickEvent> {
107
        val time = System.currentTimeMillis()
108
109
        if (onlyOwn) {
110
            updateEntityTrail(time, player)
111
            trails.keys.removeIf { it !== player && it.isAlive }
112
            return@handler
113
        }
114
115
        val actualPresent = world.players()
116
        actualPresent.forEach { player -> updateEntityTrail(time, player) }
117
        trails.keys.removeIf { key ->
118
            actualPresent.none { it === key } || !key.isAlive
119
        }
120
    }
121
122
    private fun updateEntityTrail(time: Long, entity: Entity) {
123
        val last = lastPositions[entity]
124
        if (last != null && entity.position() == last) {
125
            return
126
        }
127
128
        lastPositions[entity] = entity.position().copy()
129
        trails.getOrPut(entity, ::Trail).positions.add(TrailPart(entity.position(), time))
130
    }
131
132
    @Suppress("unused")
133
    private val worldChangeHandler = handler<WorldChangeEvent> {
134
        clear()
135
    }
136
137
    private fun clear() {
138
        lastPositions.clear()
139
        trails.clear()
140
    }
141
142
    @JvmRecord
143
    private data class TrailPart(val pos: Vec3, val creationTime: Long)
144
145
    private class RenderData(
146
        val pose: Matrix4fc,
147
        val bufferBuilder: VertexConsumer,
148
        val color: Vector4f,
149
        val lines: Boolean
150
    )
151
152
    private class Trail {
153
154
        val positions = ArrayDeque<TrailPart>()
155
156
        fun verifyAndRenderTrail(renderData: RenderData, cameraPos: Vec3, entity: Entity, time: Long) {
157
            val aliveDurationF = TemporaryValueGroup.alive.toFloat()
158
            val initialAlpha = renderData.color.w
159
160
            if (TemporaryValueGroup.enabled) {
161
                val aliveDuration = TemporaryValueGroup.alive.toLong()
162
                val expirationTime = time - aliveDuration
163
164
                // Remove outdated positions, the positions are ordered by time (ascending)
165
                while (positions.isNotEmpty() && positions.peekFirst().creationTime < expirationTime) {
166
                    positions.removeFirst()
167
                }
168
            }
169
170
            if (positions.isEmpty()) {
171
                return
172
            }
173
174
            val shouldFade = TemporaryValueGroup.fade && TemporaryValueGroup.enabled
175
            val pointsWithAlpha = positions.mapToArray { position ->
176
                val alpha = if (shouldFade) {
177
                    val deltaTime = time - position.creationTime
178
                    val multiplier = (1F - deltaTime.toFloat() / aliveDurationF)
179
                    multiplier * initialAlpha
180
                } else {
181
                    initialAlpha
182
                }
183
184
                val point = calculateRelativePos(cameraPos, position.pos)
185
                ObjectFloatMutablePair.of(point, alpha)
186
            }
187
188
            val interpolatedPos = entity.getPosition(mc.deltaTracker.getGameTimeDeltaPartialTick(true))
189
            val point = calculateRelativePos(cameraPos, interpolatedPos)
190
            pointsWithAlpha.last().left(point)
191
192
            addVerticesToBuffer(renderData, pointsWithAlpha)
193
        }
194
195
        private fun calculateRelativePos(cameraPos: Vec3, pos: Vec3): Vector3f {
196
            return Vector3f().set(
197
                pos.x - cameraPos.x,
198
                pos.y - cameraPos.y,
199
                pos.z - cameraPos.z,
200
            )
201
        }
202
203
        private fun addVerticesToBuffer(renderData: RenderData, list: Array<out ObjectFloatPair<Vector3f>>) {
204
            val red = renderData.color.x
205
            val green = renderData.color.y
206
            val blue = renderData.color.z
207
208
            with(renderData.bufferBuilder) {
209
                for (i in 1..<list.size) {
210
                    val (v0, alpha0) = list[i]
211
                    val (v2, alpha2) = list[i - 1]
212
213
                    addVertex(renderData.pose, v0).setColor(red, green, blue, alpha0)
214
                    addVertex(renderData.pose, v2).setColor(red, green, blue, alpha2)
215
                    if (!renderData.lines) {
216
                        addVertex(renderData.pose, v2.x, v2.y + height, v2.z).setColor(red, green, blue, alpha2)
217
                        addVertex(renderData.pose, v0.x, v0.y + height, v0.z).setColor(red, green, blue, alpha0)
218
                    }
219
                }
220
            }
221
        }
222
223
    }
224
225
}
226