/* * Decompiled with CFR 0.152. * * Could not load the following classes: * org.joml.Matrix3x2fc * org.joml.Matrix4f * org.joml.Matrix4fc * org.joml.Vector2f * org.joml.Vector3f * org.joml.Vector3fc * org.lwjgl.system.MemoryStack */ package com.mojang.blaze3d.vertex; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.PoseStack; import java.nio.ByteBuffer; import java.nio.IntBuffer; import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.util.ARGB; import org.joml.Matrix3x2fc; import org.joml.Matrix4f; import org.joml.Matrix4fc; import org.joml.Vector2f; import org.joml.Vector3f; import org.joml.Vector3fc; import org.lwjgl.system.MemoryStack; public interface VertexConsumer { public VertexConsumer addVertex(float var1, float var2, float var3); public VertexConsumer setColor(int var1, int var2, int var3, int var4); public VertexConsumer setColor(int var1); public VertexConsumer setUv(float var1, float var2); public VertexConsumer setUv1(int var1, int var2); public VertexConsumer setUv2(int var1, int var2); public VertexConsumer setNormal(float var1, float var2, float var3); public VertexConsumer setLineWidth(float var1); default public void addVertex(float x, float y, float z, int color, float u, float v, int overlayCoords, int lightCoords, float nx, float ny, float nz) { this.addVertex(x, y, z); this.setColor(color); this.setUv(u, v); this.setOverlay(overlayCoords); this.setLight(lightCoords); this.setNormal(nx, ny, nz); } default public VertexConsumer setColor(float r, float g, float b, float a) { return this.setColor((int)(r * 255.0f), (int)(g * 255.0f), (int)(b * 255.0f), (int)(a * 255.0f)); } default public VertexConsumer setLight(int packedLightCoords) { return this.setUv2(packedLightCoords & 0xFFFF, packedLightCoords >> 16 & 0xFFFF); } default public VertexConsumer setOverlay(int packedOverlayCoords) { return this.setUv1(packedOverlayCoords & 0xFFFF, packedOverlayCoords >> 16 & 0xFFFF); } default public void putBulkData(PoseStack.Pose pose, BakedQuad quad, float r, float g, float b, float a, int lightCoords, int overlayCoords) { this.putBulkData(pose, quad, new float[]{1.0f, 1.0f, 1.0f, 1.0f}, r, g, b, a, new int[]{lightCoords, lightCoords, lightCoords, lightCoords}, overlayCoords, false); } default public void putBulkData(PoseStack.Pose pose, BakedQuad quad, float[] brightness, float r, float g, float b, float a, int[] lightmapCoord, int overlayCoords, boolean useQuadColor) { int[] data = quad.vertices(); Vector3fc normalVec = quad.direction().getUnitVec3f(); Matrix4f matrix = pose.pose(); Vector3f normal = pose.transformNormal(normalVec, new Vector3f()); int integerSize = 8; int vertices = data.length / 8; int alpha = (int)(a * 255.0f); int lightEmission = quad.lightEmission(); try (MemoryStack stack = MemoryStack.stackPush();){ ByteBuffer quadBuffer = stack.malloc(DefaultVertexFormat.BLOCK.getVertexSize()); IntBuffer quadIntBuffer = quadBuffer.asIntBuffer(); for (int vertex = 0; vertex < vertices; ++vertex) { float b1; float g1; float r1; quadIntBuffer.clear(); quadIntBuffer.put(data, vertex * 8, 8); float x = quadBuffer.getFloat(0); float y = quadBuffer.getFloat(4); float z = quadBuffer.getFloat(8); if (useQuadColor) { float ro = quadBuffer.get(12) & 0xFF; float go = quadBuffer.get(13) & 0xFF; float bo = quadBuffer.get(14) & 0xFF; r1 = ro * brightness[vertex] * r; g1 = go * brightness[vertex] * g; b1 = bo * brightness[vertex] * b; } else { r1 = brightness[vertex] * r * 255.0f; g1 = brightness[vertex] * g * 255.0f; b1 = brightness[vertex] * b * 255.0f; } int color = ARGB.color(alpha, (int)r1, (int)g1, (int)b1); int light = LightTexture.lightCoordsWithEmission(lightmapCoord[vertex], lightEmission); float u = quadBuffer.getFloat(16); float v = quadBuffer.getFloat(20); Vector3f pos = matrix.transformPosition(x, y, z, new Vector3f()); this.addVertex(pos.x(), pos.y(), pos.z(), color, u, v, overlayCoords, light, normal.x(), normal.y(), normal.z()); } } } default public VertexConsumer addVertex(Vector3fc position) { return this.addVertex(position.x(), position.y(), position.z()); } default public VertexConsumer addVertex(PoseStack.Pose pose, Vector3f position) { return this.addVertex(pose, position.x(), position.y(), position.z()); } default public VertexConsumer addVertex(PoseStack.Pose pose, float x, float y, float z) { return this.addVertex((Matrix4fc)pose.pose(), x, y, z); } default public VertexConsumer addVertex(Matrix4fc pose, float x, float y, float z) { Vector3f pos = pose.transformPosition(x, y, z, new Vector3f()); return this.addVertex(pos.x(), pos.y(), pos.z()); } default public VertexConsumer addVertexWith2DPose(Matrix3x2fc pose, float x, float y) { Vector2f pos = pose.transformPosition(x, y, new Vector2f()); return this.addVertex(pos.x(), pos.y(), 0.0f); } default public VertexConsumer setNormal(PoseStack.Pose pose, float x, float y, float z) { Vector3f normal = pose.transformNormal(x, y, z, new Vector3f()); return this.setNormal(normal.x(), normal.y(), normal.z()); } default public VertexConsumer setNormal(PoseStack.Pose pose, Vector3f normal) { return this.setNormal(pose, normal.x(), normal.y(), normal.z()); } }