diff options
author | Léa Gris <lea.gris@noiraude.net> | 2020-12-04 16:40:24 +0100 |
---|---|---|
committer | Léa Gris <lea.gris@noiraude.net> | 2020-12-12 17:05:18 +0100 |
commit | b3789aebb681711a91ec51cdd390a47dc36282dd (patch) | |
tree | 8e4c275624a966c4482b90ad85cda2375c6a63b9 /src/main/java/gregtech/api/objects/GT_SidedTexture.java | |
parent | d66962ed18b3f8d15889ce0b5545427311b24f94 (diff) | |
download | GT5-Unofficial-b3789aebb681711a91ec51cdd390a47dc36282dd.tar.gz GT5-Unofficial-b3789aebb681711a91ec51cdd390a47dc36282dd.tar.bz2 GT5-Unofficial-b3789aebb681711a91ec51cdd390a47dc36282dd.zip |
fix(rendering): UV Mapping on tiles
- Fix all faces use the same UV mapping and orientation to be same as standard
vanilla full blocks Vanilla blocks's face rendering.
- Fix the orientation of bottom-face's arrow overlay with fixed UV of the
`GT_MetaTileEntity_Buffer` type machines (filters, buffers, regulators)
- Fix UV mapping of item pipes restrictor overlay
- Fix UV mapping of fluid pipes blocked input overlay orientation on all sides
- Fix UV mappiong of thick covers
- Remove the now useless and broken custom UVMapped vertices at the bottom face.

Diffstat (limited to 'src/main/java/gregtech/api/objects/GT_SidedTexture.java')
-rw-r--r-- | src/main/java/gregtech/api/objects/GT_SidedTexture.java | 98 |
1 files changed, 29 insertions, 69 deletions
diff --git a/src/main/java/gregtech/api/objects/GT_SidedTexture.java b/src/main/java/gregtech/api/objects/GT_SidedTexture.java index 2b4f144393..ab88225781 100644 --- a/src/main/java/gregtech/api/objects/GT_SidedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_SidedTexture.java @@ -7,7 +7,6 @@ import gregtech.api.interfaces.ITexture; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.IIcon; public class GT_SidedTexture implements ITexture, IColorModulationContainer { private final IIconContainer[] mIconContainer; @@ -45,115 +44,76 @@ public class GT_SidedTexture implements ITexture, IColorModulationContainer { @Override public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.field_152631_f = true; aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer[5].getIcon()); if (mIconContainer[5].getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); + tessellator.setColorRGBA(153, 153, 153, 255); aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer[5].getOverlayIcon()); } + aRenderer.field_152631_f = false; } @Override public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer[4].getIcon()); if (mIconContainer[4].getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); + tessellator.setColorRGBA(153, 153, 153, 255); aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer[4].getOverlayIcon()); } } @Override public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 1.0F), (int) (mRGBa[1] * 1.0F), (int) (mRGBa[2] * 1.0F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 1.0F), (int) (mRGBa[1] * 1.0F), (int) (mRGBa[2] * 1.0F), mAllowAlpha ? 255 - mRGBa[3] : 255); aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer[1].getIcon()); if (mIconContainer[1].getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(255, 255, 255, 255); + tessellator.setColorRGBA(255, 255, 255, 255); aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer[1].getOverlayIcon()); } } @Override public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255); - IIcon aIcon = mIconContainer[0].getIcon(); - - float d_16 = 16.0F; - float d3 = (float)aIcon.getInterpolatedU(aRenderer.renderMaxX * d_16); - float d4 = (float)aIcon.getInterpolatedU(aRenderer.renderMinX * d_16); - float d5 = (float)aIcon.getInterpolatedV(aRenderer.renderMinZ * d_16); - float d6 = (float)aIcon.getInterpolatedV(aRenderer.renderMaxZ * d_16); - - if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - d3 = aIcon.getMaxU(); - d4 = aIcon.getMinU(); - } - - if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - d5 = aIcon.getMinV(); - d6 = aIcon.getMaxV(); - } - - float d11 = aX + (float)aRenderer.renderMinX; - float d12 = aX + (float)aRenderer.renderMaxX; - float d13 = aY + (float)aRenderer.renderMinY; - float d14 = aZ + (float)aRenderer.renderMinZ; - float d15 = aZ + (float)aRenderer.renderMaxZ; - - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d15, (double)d3, (double)d6); - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d14, (double)d3, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d14, (double)d4, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d15, (double)d4, (double)d6); - - if ((aIcon = mIconContainer[0].getOverlayIcon()) != null) { - Tessellator.instance.setColorRGBA(128, 128, 128, 255); - - d3 = (float)aIcon.getInterpolatedU(aRenderer.renderMaxX * d_16); - d4 = (float)aIcon.getInterpolatedU(aRenderer.renderMinX * d_16); - d5 = (float)aIcon.getInterpolatedV(aRenderer.renderMinZ * d_16); - d6 = (float)aIcon.getInterpolatedV(aRenderer.renderMaxZ * d_16); - - if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - d3 = aIcon.getMaxU(); - d4 = aIcon.getMinU(); - } - - if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - d5 = aIcon.getMinV(); - d6 = aIcon.getMaxV(); - } - - d11 = aX + (float)aRenderer.renderMinX; - d12 = aX + (float)aRenderer.renderMaxX; - d13 = aY + (float)aRenderer.renderMinY; - d14 = aZ + (float)aRenderer.renderMinZ; - d15 = aZ + (float)aRenderer.renderMaxZ; - - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d15, (double)d3, (double)d6); - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d14, (double)d3, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d14, (double)d4, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d15, (double)d4, (double)d6); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.field_152631_f = true; + aRenderer.flipTexture = true; + aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, mIconContainer[1].getIcon()); + if (mIconContainer[0].getOverlayIcon() != null) { + tessellator.setColorRGBA(128, 128, 128, 255); + aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, mIconContainer[1].getOverlayIcon()); } + aRenderer.field_152631_f = false; + aRenderer.flipTexture = false; } @Override public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer[3].getIcon()); if (mIconContainer[3].getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); + tessellator.setColorRGBA(204, 204, 204, 255); aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer[3].getOverlayIcon()); } } @Override public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.field_152631_f = true; aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer[2].getIcon()); if (mIconContainer[2].getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); + tessellator.setColorRGBA(204, 204, 204, 255); aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer[2].getOverlayIcon()); } + aRenderer.field_152631_f = false; } @Override |