|
20 | 20 | package gregapi.render; |
21 | 21 |
|
22 | 22 | import static gregapi.data.CS.*; |
| 23 | +import static gregapi.util.UT.shouldFlipNegYTextures; |
23 | 24 |
|
24 | 25 | import org.lwjgl.opengl.GL11; |
25 | 26 |
|
@@ -248,11 +249,11 @@ public static boolean doRenderYNeg(IIcon aIcon, RenderBlocks aRenderer, Block aB |
248 | 249 | if (aBlock.getRenderBlockPass() > 0) { |
249 | 250 | double tOldValue = aRenderer.renderMinY; |
250 | 251 | aRenderer.renderMinY -= (aRenderer.renderFromInside?-1:+1)*OFFSET_Y_NEG; |
251 | | - renderFixedNegativeYFacing(aIcon, aRenderer, aBlock, aX, aY, aZ); |
| 252 | + renderFixedNegativeYFacing(aIcon, aRenderer, aBlock, aX, aY, aZ, aChangedBlockBounds); |
252 | 253 | aRenderer.renderMinY = tOldValue; |
253 | 254 | OFFSET_Y_NEG += OFFSET_ADD; |
254 | 255 | } else { |
255 | | - renderFixedNegativeYFacing(aIcon, aRenderer, aBlock, aX, aY, aZ); |
| 256 | + renderFixedNegativeYFacing(aIcon, aRenderer, aBlock, aX, aY, aZ, aChangedBlockBounds); |
256 | 257 | } |
257 | 258 | return T; |
258 | 259 | } |
@@ -285,13 +286,15 @@ public static boolean doRenderZNeg(IIcon aIcon, RenderBlocks aRenderer, Block aB |
285 | 286 | return T; |
286 | 287 | } |
287 | 288 |
|
288 | | - public static void renderFixedNegativeYFacing(IIcon aIcon, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { |
| 289 | + public static void renderFixedNegativeYFacing(IIcon aIcon, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, boolean aChangedBlockBounds) { |
289 | 290 | if (aRenderer.hasOverrideBlockTexture()) aIcon = aRenderer.overrideBlockTexture; |
290 | 291 | // double tMaxX1 = aIcon.getInterpolatedU(aRenderer.renderMaxX * 16.0); |
291 | 292 | // double tMinX1 = aIcon.getInterpolatedU(aRenderer.renderMinX * 16.0); |
292 | 293 | // double tMaxZ1 = aIcon.getInterpolatedV(aRenderer.renderMinZ * 16.0); |
293 | 294 | // double tMinZ1 = aIcon.getInterpolatedV(aRenderer.renderMaxZ * 16.0); |
294 | | - |
| 295 | + |
| 296 | + boolean shouldFlipTexture = shouldFlipNegYTextures(aIcon.getIconName(), aChangedBlockBounds); |
| 297 | + |
295 | 298 | double tMaxX1 = aIcon.getInterpolatedU(aRenderer.renderMaxX * 16.0); |
296 | 299 | double tMinX1 = aIcon.getInterpolatedU(aRenderer.renderMinX * 16.0); |
297 | 300 | double tMaxZ1 = aIcon.getInterpolatedV(aRenderer.renderMaxZ * 16.0); |
@@ -358,21 +361,21 @@ public static void renderFixedNegativeYFacing(IIcon aIcon, RenderBlocks aRendere |
358 | 361 | if (aRenderer.enableAO) { |
359 | 362 | Tessellator.instance.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft); |
360 | 363 | Tessellator.instance.setBrightness(aRenderer.brightnessTopLeft); |
361 | | - Tessellator.instance.addVertexWithUV(tMinX3, tMinY3, tMaxZ3, tMinX2, tMinZ2); |
| 364 | + Tessellator.instance.addVertexWithUV(tMinX3, tMinY3, tMaxZ3, tMinX2, shouldFlipTexture ? tMinZ2 : tMaxZ2); |
362 | 365 | Tessellator.instance.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft); |
363 | 366 | Tessellator.instance.setBrightness(aRenderer.brightnessBottomLeft); |
364 | | - Tessellator.instance.addVertexWithUV(tMinX3, tMinY3, tMinZ3, tMinX1, tMaxZ1); |
| 367 | + Tessellator.instance.addVertexWithUV(tMinX3, tMinY3, tMinZ3, tMinX1, shouldFlipTexture ? tMaxZ1 : tMinZ1); |
365 | 368 | Tessellator.instance.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight); |
366 | 369 | Tessellator.instance.setBrightness(aRenderer.brightnessBottomRight); |
367 | | - Tessellator.instance.addVertexWithUV(tMaxX3, tMinY3, tMinZ3, tMaxX2, tMaxZ2); |
| 370 | + Tessellator.instance.addVertexWithUV(tMaxX3, tMinY3, tMinZ3, tMaxX2, shouldFlipTexture ? tMaxZ2 : tMinZ2); |
368 | 371 | Tessellator.instance.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight); |
369 | 372 | Tessellator.instance.setBrightness(aRenderer.brightnessTopRight); |
370 | | - Tessellator.instance.addVertexWithUV(tMaxX3, tMinY3, tMaxZ3, tMaxX1, tMinZ1); |
| 373 | + Tessellator.instance.addVertexWithUV(tMaxX3, tMinY3, tMaxZ3, tMaxX1, shouldFlipTexture ? tMinZ1 : tMaxZ1); |
371 | 374 | } else { |
372 | | - Tessellator.instance.addVertexWithUV(tMinX3, tMinY3, tMaxZ3, tMinX2, tMinZ2); |
373 | | - Tessellator.instance.addVertexWithUV(tMinX3, tMinY3, tMinZ3, tMinX1, tMaxZ1); |
374 | | - Tessellator.instance.addVertexWithUV(tMaxX3, tMinY3, tMinZ3, tMaxX2, tMaxZ2); |
375 | | - Tessellator.instance.addVertexWithUV(tMaxX3, tMinY3, tMaxZ3, tMaxX1, tMinZ1); |
| 375 | + Tessellator.instance.addVertexWithUV(tMinX3, tMinY3, tMaxZ3, tMinX2, shouldFlipTexture ? tMinZ2 : tMaxZ2); |
| 376 | + Tessellator.instance.addVertexWithUV(tMinX3, tMinY3, tMinZ3, tMinX1, shouldFlipTexture ? tMaxZ1 : tMinZ1); |
| 377 | + Tessellator.instance.addVertexWithUV(tMaxX3, tMinY3, tMinZ3, tMaxX2, shouldFlipTexture ? tMaxZ2 : tMinZ2); |
| 378 | + Tessellator.instance.addVertexWithUV(tMaxX3, tMinY3, tMaxZ3, tMaxX1, shouldFlipTexture ? tMinZ1 : tMaxZ1); |
376 | 379 | } |
377 | 380 | } |
378 | 381 |
|
|
0 commit comments