|  | 
| 8 | 8 | import com.mojang.blaze3d.vertex.Tesselator; | 
| 9 | 9 | import com.mojang.blaze3d.vertex.VertexFormat; | 
| 10 | 10 | import com.mojang.math.Matrix4f; | 
|  | 11 | +import com.mojang.math.Vector3f; | 
| 11 | 12 | import de.srendi.advancedperipherals.client.RenderUtil; | 
| 12 | 13 | import de.srendi.advancedperipherals.common.smartglasses.modules.overlay.objects.RenderableObject; | 
| 13 | 14 | import net.minecraft.client.renderer.GameRenderer; | 
|  | 
| 18 | 19 | public class RectangleRenderer implements ITwoDObjectRenderer { | 
| 19 | 20 | 
 | 
| 20 | 21 |     @Override | 
| 21 |  | -    public void renderBatch(List<RenderableObject> objects, ForgeGui gui, PoseStack poseStack, float partialTick, int screenWidth, int screenHeight) { | 
|  | 22 | +    public void renderBatch(List<RenderableObject> objects, ForgeGui gui, PoseStack ignored, float partialTick, int screenWidth, int screenHeight) { | 
| 22 | 23 |         RenderSystem.setShader(GameRenderer::getPositionColorShader); | 
| 23 | 24 |         BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder(); | 
| 24 | 25 | 
 | 
| 25 | 26 |         bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); | 
| 26 | 27 | 
 | 
| 27 | 28 |         for (RenderableObject obj : objects) { | 
|  | 29 | +            float rotX = obj.rotX; | 
|  | 30 | +            float rotY = obj.rotY; | 
|  | 31 | +            float rotZ = obj.rotZ; | 
|  | 32 | + | 
|  | 33 | +            PoseStack poseStack = new PoseStack(); | 
|  | 34 | + | 
|  | 35 | +            poseStack.translate(obj.x, obj.y, obj.z); | 
|  | 36 | + | 
| 28 | 37 |             poseStack.pushPose(); | 
|  | 38 | + | 
| 29 | 39 |             Matrix4f matrix = poseStack.last().pose(); | 
| 30 | 40 | 
 | 
|  | 41 | +            poseStack.mulPose(Vector3f.XP.rotationDegrees(rotX)); | 
|  | 42 | +            poseStack.mulPose(Vector3f.YP.rotationDegrees(rotY)); | 
|  | 43 | +            poseStack.mulPose(Vector3f.ZP.rotationDegrees(rotZ)); | 
|  | 44 | + | 
| 31 | 45 |             float alpha = obj.opacity; | 
| 32 | 46 |             float red = RenderUtil.getRed(obj.color); | 
| 33 | 47 |             float green = RenderUtil.getGreen(obj.color); | 
| 34 | 48 |             float blue = RenderUtil.getBlue(obj.color); | 
| 35 | 49 | 
 | 
| 36 |  | -            bufferbuilder.vertex(matrix, obj.x, obj.maxY, obj.z).color(red, green, blue, alpha).endVertex(); | 
| 37 |  | -            bufferbuilder.vertex(matrix, obj.maxX, obj.maxY, obj.z).color(red, green, blue, alpha).endVertex(); | 
| 38 |  | -            bufferbuilder.vertex(matrix, obj.maxX, obj.y, obj.z).color(red, green, blue, alpha).endVertex(); | 
| 39 |  | -            bufferbuilder.vertex(matrix, obj.x, obj.y, obj.z).color(red, green, blue, alpha).endVertex(); | 
|  | 50 | +            bufferbuilder.vertex(matrix, 0, obj.maxY - obj.y, 0).color(red, green, blue, alpha).endVertex(); | 
|  | 51 | +            bufferbuilder.vertex(matrix, obj.maxX - obj.x, obj.maxY  - obj.y, 0).color(red, green, blue, alpha).endVertex(); | 
|  | 52 | +            bufferbuilder.vertex(matrix, obj.maxX - obj.x, 0, 0).color(red, green, blue, alpha).endVertex(); | 
|  | 53 | +            bufferbuilder.vertex(matrix, 0, 0, 0).color(red, green, blue, alpha).endVertex(); | 
| 40 | 54 |             poseStack.popPose(); | 
| 41 | 55 | 
 | 
| 42 | 56 |         } | 
|  | 
0 commit comments