| 1 | package com.mojang.blaze3d.vertex;
|
| 2 |
|
| 3 | import com.mojang.renderpearl.api.GpuFormat;
|
| 4 | import com.mojang.renderpearl.api.vertex.VertexFormat;
|
| 5 | import net.fabricmc.api.EnvType;
|
| 6 | import net.fabricmc.api.Environment;
|
| 7 |
|
| 8 | @Environment(EnvType.CLIENT)
|
| 9 | public class DefaultVertexFormat {
|
| 10 | public static final String POSITION_SEMANTIC_NAME = "Position";
|
| 11 | public static final String COLOR_SEMANTIC_NAME = "Color";
|
| 12 | public static final String UV0_SEMANTIC_NAME = "UV0";
|
| 13 | public static final String UV1_SEMANTIC_NAME = "UV1";
|
| 14 | public static final String UV2_SEMANTIC_NAME = "UV2";
|
| 15 | public static final String UV3_SEMANTIC_NAME = "UV3";
|
| 16 | public static final String NORMAL_SEMANTIC_NAME = "Normal";
|
| 17 | public static final String LINE_WIDTH_SEMANTIC_NAME = "LineWidth";
|
| 18 | public static final String CHUNK_POSITION_SEMANTIC_NAME = "ChunkPosition";
|
| 19 | public static final String CHUNK_VISIBILITY_SEMANTIC_NAME = "ChunkVisibility";
|
| 20 | private static final GpuFormat POSITION_FORMAT = GpuFormat.RGB32_FLOAT;
|
| 21 | private static final GpuFormat COLOR_FORMAT = GpuFormat.RGBA8_UNORM;
|
| 22 | private static final GpuFormat UV0_FORMAT = GpuFormat.RG32_FLOAT;
|
| 23 | private static final GpuFormat UV1_FORMAT = GpuFormat.RG16_SINT;
|
| 24 | private static final GpuFormat UV2_FORMAT = GpuFormat.RG16_SINT;
|
| 25 | private static final GpuFormat UV3_FORMAT = GpuFormat.RG32_FLOAT;
|
| 26 | private static final GpuFormat NORMAL_FORMAT = GpuFormat.RGBA8_SNORM;
|
| 27 | private static final GpuFormat LINE_WIDTH_FORMAT = GpuFormat.R32_FLOAT;
|
| 28 | private static final GpuFormat CHUNK_POSITION_FORMAT = GpuFormat.RGB32_SINT;
|
| 29 | private static final GpuFormat CHUNK_VISIBILITY_FORMAT = GpuFormat.R32_FLOAT;
|
| 30 | public static final VertexFormat BLOCK = VertexFormat.builder(0)
|
| 31 | .addAttribute("Position", POSITION_FORMAT)
|
| 32 | .addAttribute("Color", COLOR_FORMAT)
|
| 33 | .addAttribute("UV0", UV0_FORMAT)
|
| 34 | .addAttribute("UV2", UV2_FORMAT)
|
| 35 | .build();
|
| 36 | public static final VertexFormat CHUNK_DATA_INSTANCED = VertexFormat.builder(1)
|
| 37 | .addAttribute("ChunkPosition", CHUNK_POSITION_FORMAT)
|
| 38 | .addAttribute("ChunkVisibility", CHUNK_VISIBILITY_FORMAT)
|
| 39 | .build();
|
| 40 | public static final VertexFormat ENTITY = VertexFormat.builder(0)
|
| 41 | .addAttribute("Position", POSITION_FORMAT)
|
| 42 | .addAttribute("Color", COLOR_FORMAT)
|
| 43 | .addAttribute("UV0", UV0_FORMAT)
|
| 44 | .addAttribute("UV1", UV1_FORMAT)
|
| 45 | .addAttribute("UV2", UV2_FORMAT)
|
| 46 | .addAttribute("Normal", NORMAL_FORMAT)
|
| 47 | .build();
|
| 48 | public static final VertexFormat ENTITY_GLINT_SPECIAL = VertexFormat.builder(0)
|
| 49 | .addAttribute("Position", POSITION_FORMAT)
|
| 50 | .addAttribute("Color", COLOR_FORMAT)
|
| 51 | .addAttribute("UV0", UV0_FORMAT)
|
| 52 | .addAttribute("UV1", UV1_FORMAT)
|
| 53 | .addAttribute("UV2", UV2_FORMAT)
|
| 54 | .addAttribute("UV3", UV3_FORMAT)
|
| 55 | .addAttribute("Normal", NORMAL_FORMAT)
|
| 56 | .build();
|
| 57 | public static final VertexFormat PARTICLE = VertexFormat.builder(0)
|
| 58 | .addAttribute("Position", POSITION_FORMAT)
|
| 59 | .addAttribute("UV0", UV0_FORMAT)
|
| 60 | .addAttribute("Color", COLOR_FORMAT)
|
| 61 | .addAttribute("UV2", UV2_FORMAT)
|
| 62 | .build();
|
| 63 | public static final VertexFormat POSITION = VertexFormat.builder(0).addAttribute("Position", POSITION_FORMAT).build();
|
| 64 | public static final VertexFormat POSITION_COLOR = VertexFormat.builder(0)
|
| 65 | .addAttribute("Position", POSITION_FORMAT)
|
| 66 | .addAttribute("Color", COLOR_FORMAT)
|
| 67 | .build();
|
| 68 | public static final VertexFormat POSITION_COLOR_NORMAL = VertexFormat.builder(0)
|
| 69 | .addAttribute("Position", POSITION_FORMAT)
|
| 70 | .addAttribute("Color", COLOR_FORMAT)
|
| 71 | .addAttribute("Normal", NORMAL_FORMAT)
|
| 72 | .build();
|
| 73 | public static final VertexFormat POSITION_COLOR_LIGHTMAP = VertexFormat.builder(0)
|
| 74 | .addAttribute("Position", POSITION_FORMAT)
|
| 75 | .addAttribute("Color", COLOR_FORMAT)
|
| 76 | .addAttribute("UV2", UV2_FORMAT)
|
| 77 | .build();
|
| 78 | public static final VertexFormat POSITION_TEX = VertexFormat.builder(0).addAttribute("Position", POSITION_FORMAT).addAttribute("UV0", UV0_FORMAT).build();
|
| 79 | public static final VertexFormat POSITION_TEX_COLOR = VertexFormat.builder(0)
|
| 80 | .addAttribute("Position", POSITION_FORMAT)
|
| 81 | .addAttribute("UV0", UV0_FORMAT)
|
| 82 | .addAttribute("Color", COLOR_FORMAT)
|
| 83 | .build();
|
| 84 | public static final VertexFormat POSITION_COLOR_TEX_LIGHTMAP = VertexFormat.builder(0)
|
| 85 | .addAttribute("Position", POSITION_FORMAT)
|
| 86 | .addAttribute("Color", COLOR_FORMAT)
|
| 87 | .addAttribute("UV0", UV0_FORMAT)
|
| 88 | .addAttribute("UV2", UV2_FORMAT)
|
| 89 | .build();
|
| 90 | public static final VertexFormat POSITION_TEX_LIGHTMAP_COLOR = VertexFormat.builder(0)
|
| 91 | .addAttribute("Position", POSITION_FORMAT)
|
| 92 | .addAttribute("UV0", UV0_FORMAT)
|
| 93 | .addAttribute("UV2", UV2_FORMAT)
|
| 94 | .addAttribute("Color", COLOR_FORMAT)
|
| 95 | .build();
|
| 96 | public static final VertexFormat POSITION_TEX_COLOR_NORMAL = VertexFormat.builder(0)
|
| 97 | .addAttribute("Position", POSITION_FORMAT)
|
| 98 | .addAttribute("UV0", UV0_FORMAT)
|
| 99 | .addAttribute("Color", COLOR_FORMAT)
|
| 100 | .addAttribute("Normal", NORMAL_FORMAT)
|
| 101 | .build();
|
| 102 | public static final VertexFormat POSITION_COLOR_LINE_WIDTH = VertexFormat.builder(0)
|
| 103 | .addAttribute("Position", POSITION_FORMAT)
|
| 104 | .addAttribute("Color", COLOR_FORMAT)
|
| 105 | .addAttribute("LineWidth", LINE_WIDTH_FORMAT)
|
| 106 | .build();
|
| 107 | public static final VertexFormat POSITION_COLOR_NORMAL_LINE_WIDTH = VertexFormat.builder(0)
|
| 108 | .addAttribute("Position", POSITION_FORMAT)
|
| 109 | .addAttribute("Color", COLOR_FORMAT)
|
| 110 | .addAttribute("Normal", NORMAL_FORMAT)
|
| 111 | .addAttribute("LineWidth", LINE_WIDTH_FORMAT)
|
| 112 | .build();
|
| 113 | }
|
| 114 |
|