From f5b1c3dc3a6dc88fca47dbbe8c8d2a3a5488913e Mon Sep 17 00:00:00 2001 From: broscolotos Date: Fri, 22 Nov 2024 22:36:23 -0600 Subject: [PATCH] Render Fix - fixed the render of 2D shapeboxes while still supporting the shadow fix. We love multiple hours of debugging \o/. --- .../java/fexcraft/tmt/slim/ModelRendererTurbo.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/fexcraft/tmt/slim/ModelRendererTurbo.java b/src/main/java/fexcraft/tmt/slim/ModelRendererTurbo.java index 851d10c51..bf3d8cb89 100644 --- a/src/main/java/fexcraft/tmt/slim/ModelRendererTurbo.java +++ b/src/main/java/fexcraft/tmt/slim/ModelRendererTurbo.java @@ -130,10 +130,10 @@ public ModelRendererTurbo(ModelBase modelbase, int textureX, int textureY, int t private TexturedPolygon textureQuad(TexturedVertex vert1, TexturedVertex vert2, TexturedVertex vert3, TexturedVertex vert4, float f, float g, float h, float j){ List verts = new ArrayList<>(); //casting to int will floor the input, this SHOULD fix the pixel offsets in weird shapeboxes - verts.add(vert1.setTexturePosition((int)h / textureWidth, (int)g / textureHeight)); - verts.add(vert2.setTexturePosition((int)f / textureWidth, (int)g / textureHeight)); - verts.add(vert3.setTexturePosition((int)f / textureWidth, (int)j / textureHeight)); - verts.add(vert4.setTexturePosition((int)h / textureWidth, (int)j / textureHeight)); + verts.add(vert1.setTexturePosition(h / textureWidth, g / textureHeight)); + verts.add(vert2.setTexturePosition(f / textureWidth, g / textureHeight)); + verts.add(vert3.setTexturePosition(f / textureWidth, j / textureHeight)); + verts.add(vert4.setTexturePosition(h / textureWidth, j / textureHeight)); return new TexturedPolygon(verts); } @@ -164,13 +164,13 @@ public ModelRendererTurbo addRectShape(float[] v, float[] v1, float[] v2, float[ TexturedVertex vert7 = new TexturedVertex(v7[0], v7[1], v7[2], 8.0F, 0.0F); if(w % 1 != 0){ - w = w < 1 ? 1 : (int)w + (w % 1 > 0.5f ? 1 : 0); + w = w < 1 ? w % 1 < 0.5f ? 0 : 1 : (int)w + (w % 1 >= 0.5f ? 1 : 0); } if(h % 1 != 0){ - h = h < 1 ? 1 : (int)h + (h % 1 > 0.5f ? 1 : 0); + h = h < 1 ? h % 1 < 0.5f ? 0 : 1 : (int)h + (h % 1 >= 0.5f ? 1 : 0); } if(d % 1 != 0){ - d = d < 1 ? 1 : (int)d + (d % 1 > 0.5f ? 1 : 0); + d = d < 1 ? d % 1 < 0.5f ? 0 : 1 : (int)d + (d % 1 >= 0.5f ? 1 : 0); } if(sides == null){ poly.add(textureQuad(vert5, vert1, vert2, vert6, textureOffsetX + d + w, textureOffsetY + d, textureOffsetX + d + w + d, textureOffsetY + d + h));