PrimitiveTopology .java

com.mojang.renderpearl.api.pipeline.PrimitiveTopology (enum): members: LINES, DEBUG_LINES, DEBUG_LINE_STRIP, POINTS, TRIANGLES, TRIANGLE_STRIP, QUADS.

com.mojang.renderpearl.api.pipelineenum35 linesclient992 B

API Surface (1)

int indexCount(final int vertexCount)

Fields & Constants (3)

primitiveLength
primitiveStride
connectedPrimitives

Full Source

PrimitiveTopology.java35 lines · Minecraft 26.3 · verbatim
1
package com.mojang.renderpearl.api.pipeline;
2
3
import net.fabricmc.api.EnvType;
4
import net.fabricmc.api.Environment;
5
6
@Environment(EnvType.CLIENT)
7
public enum PrimitiveTopology {
8
	LINES(2, 2, false),
9
	DEBUG_LINES(2, 2, false),
10
	DEBUG_LINE_STRIP(2, 1, true),
11
	POINTS(1, 1, false),
12
	TRIANGLES(3, 3, false),
13
	TRIANGLE_STRIP(3, 1, true),
14
	TRIANGLE_FAN(3, 1, true),
15
	QUADS(4, 4, false);
16
17
	public final int primitiveLength;
18
	public final int primitiveStride;
19
	public final boolean connectedPrimitives;
20
21
	PrimitiveTopology(final int primitiveLength, final int primitiveStride, final boolean connectedPrimitives) {
22
		this.primitiveLength = primitiveLength;
23
		this.primitiveStride = primitiveStride;
24
		this.connectedPrimitives = connectedPrimitives;
25
	}
26
27
	public int indexCount(final int vertexCount) {
28
		return switch (this) {
29
			case LINES, QUADS -> vertexCount / 4 * 6;
30
			case DEBUG_LINES, DEBUG_LINE_STRIP, POINTS, TRIANGLES, TRIANGLE_STRIP, TRIANGLE_FAN -> vertexCount;
31
			default -> 0;
32
		};
33
	}
34
}
35

Decompiled Minecraft 26.3 source of PrimitiveTopology (com/mojang/renderpearl/api/pipeline/PrimitiveTopology.java) with Mojang official mappings, stored verbatim on the site.