CompactVectorArray .java

com.mojang.blaze3d.vertex.CompactVectorArray (class): members: VECTOR_SIZE, OFFSET_X, OFFSET_Z, OFFSET_Y, getZ, contents, getY, getX, set, size, get.

com.mojang.blaze3d.vertexclass50 linesclient1.3 KB

API Surface (7)

int size()
void set(final int index, final Vector3fc v)
void set(final int index, final float x, final float y, final float z)
Vector3f get(final int index, final Vector3f output)
float getX(final int index)
float getY(final int index)
float getZ(final int index)

Fields & Constants (5)

VECTOR_SIZE
OFFSET_X
OFFSET_Y
OFFSET_Z
contents

Full Source

CompactVectorArray.java50 lines · Minecraft 26.3 · verbatim
1
package com.mojang.blaze3d.vertex;
2
3
import net.fabricmc.api.EnvType;
4
import net.fabricmc.api.Environment;
5
import org.joml.Vector3f;
6
import org.joml.Vector3fc;
7
8
@Environment(EnvType.CLIENT)
9
public class CompactVectorArray {
10
	private static final int VECTOR_SIZE = 3;
11
	private static final int OFFSET_X = 0;
12
	private static final int OFFSET_Y = 1;
13
	private static final int OFFSET_Z = 2;
14
	private final float[] contents;
15
16
	public CompactVectorArray(final int count) {
17
		this.contents = new float[3 * count];
18
	}
19
20
	public int size() {
21
		return this.contents.length / 3;
22
	}
23
24
	public void set(final int index, final Vector3fc v) {
25
		this.set(index, v.x(), v.y(), v.z());
26
	}
27
28
	public void set(final int index, final float x, final float y, final float z) {
29
		this.contents[3 * index + 0] = x;
30
		this.contents[3 * index + 1] = y;
31
		this.contents[3 * index + 2] = z;
32
	}
33
34
	public Vector3f get(final int index, final Vector3f output) {
35
		return output.set(this.contents[3 * index + 0], this.contents[3 * index + 1], this.contents[3 * index + 2]);
36
	}
37
38
	public float getX(final int index) {
39
		return this.contents[3 * index + 0];
40
	}
41
42
	public float getY(final int index) {
43
		return this.contents[3 * index + 1];
44
	}
45
46
	public float getZ(final int index) {
47
		return this.contents[3 * index + 2];
48
	}
49
}
50

Decompiled Minecraft 26.3 source of CompactVectorArray (com/mojang/blaze3d/vertex/CompactVectorArray.java) with Mojang official mappings, stored verbatim on the site.