Fixed wrong UV mapping on 3D prints (in particular the item renderer).

This commit is contained in:
Florian Nücke 2015-03-30 16:45:45 +02:00
parent 5506375bf2
commit 4b354551a0
2 changed files with 18 additions and 17 deletions

View File

@ -141,7 +141,8 @@ object BlockRenderer extends ISimpleBlockRenderingHandler {
} }
// The texture flip this works around only seems to occur for blocks with custom block renderers? // The texture flip this works around only seems to occur for blocks with custom block renderers?
def patchedRenderer(renderer: RenderBlocks, block: Block) = if (block.isInstanceOf[Hologram] || block.isInstanceOf[Printer]) { def patchedRenderer(renderer: RenderBlocks, block: Block) =
if (block.isInstanceOf[Hologram] || block.isInstanceOf[Printer] || block.isInstanceOf[Print]) {
PatchedRenderBlocks.blockAccess = renderer.blockAccess PatchedRenderBlocks.blockAccess = renderer.blockAccess
PatchedRenderBlocks.overrideBlockTexture = renderer.overrideBlockTexture PatchedRenderBlocks.overrideBlockTexture = renderer.overrideBlockTexture
PatchedRenderBlocks.flipTexture = renderer.flipTexture PatchedRenderBlocks.flipTexture = renderer.flipTexture

View File

@ -258,24 +258,24 @@ object ItemRenderer extends IItemRenderer {
// Front. // Front.
GL11.glNormal3f(0, 0, 1) GL11.glNormal3f(0, 0, 1)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minX * 16), texture.getInterpolatedV(bounds.minY * 16)) GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minX * 16), texture.getInterpolatedV(16 - bounds.minY * 16))
GL11.glVertex3d(bounds.minX, bounds.minY, bounds.maxZ) GL11.glVertex3d(bounds.minX, bounds.minY, bounds.maxZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxX * 16), texture.getInterpolatedV(bounds.minY * 16)) GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxX * 16), texture.getInterpolatedV(16 - bounds.minY * 16))
GL11.glVertex3d(bounds.maxX, bounds.minY, bounds.maxZ) GL11.glVertex3d(bounds.maxX, bounds.minY, bounds.maxZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxX * 16), texture.getInterpolatedV(bounds.maxY * 16)) GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxX * 16), texture.getInterpolatedV(16 - bounds.maxY * 16))
GL11.glVertex3d(bounds.maxX, bounds.maxY, bounds.maxZ) GL11.glVertex3d(bounds.maxX, bounds.maxY, bounds.maxZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minX * 16), texture.getInterpolatedV(bounds.maxY * 16)) GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minX * 16), texture.getInterpolatedV(16 - bounds.maxY * 16))
GL11.glVertex3d(bounds.minX, bounds.maxY, bounds.maxZ) GL11.glVertex3d(bounds.minX, bounds.maxY, bounds.maxZ)
// Back. // Back.
GL11.glNormal3f(0, 0, -1) GL11.glNormal3f(0, 0, -1)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxX * 16), texture.getInterpolatedV(bounds.minY * 16)) GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxX * 16), texture.getInterpolatedV(16 - bounds.minY * 16))
GL11.glVertex3d(bounds.maxX, bounds.minY, bounds.minZ) GL11.glVertex3d(bounds.maxX, bounds.minY, bounds.minZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minX * 16), texture.getInterpolatedV(bounds.minY * 16)) GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minX * 16), texture.getInterpolatedV(16 - bounds.minY * 16))
GL11.glVertex3d(bounds.minX, bounds.minY, bounds.minZ) GL11.glVertex3d(bounds.minX, bounds.minY, bounds.minZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minX * 16), texture.getInterpolatedV(bounds.maxY * 16)) GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minX * 16), texture.getInterpolatedV(16 - bounds.maxY * 16))
GL11.glVertex3d(bounds.minX, bounds.maxY, bounds.minZ) GL11.glVertex3d(bounds.minX, bounds.maxY, bounds.minZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxX * 16), texture.getInterpolatedV(bounds.maxY * 16)) GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxX * 16), texture.getInterpolatedV(16 - bounds.maxY * 16))
GL11.glVertex3d(bounds.maxX, bounds.maxY, bounds.minZ) GL11.glVertex3d(bounds.maxX, bounds.maxY, bounds.minZ)
// Top. // Top.
@ -302,24 +302,24 @@ object ItemRenderer extends IItemRenderer {
// Left. // Left.
GL11.glNormal3f(1, 0, 0) GL11.glNormal3f(1, 0, 0)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxY * 16), texture.getInterpolatedV(bounds.maxZ * 16)) GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxZ * 16), texture.getInterpolatedV(16 - bounds.maxY * 16))
GL11.glVertex3d(bounds.maxX, bounds.maxY, bounds.maxZ) GL11.glVertex3d(bounds.maxX, bounds.maxY, bounds.maxZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minY * 16), texture.getInterpolatedV(bounds.maxZ * 16)) GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxZ * 16), texture.getInterpolatedV(16 - bounds.minY * 16))
GL11.glVertex3d(bounds.maxX, bounds.minY, bounds.maxZ) GL11.glVertex3d(bounds.maxX, bounds.minY, bounds.maxZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minY * 16), texture.getInterpolatedV(bounds.minZ * 16)) GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minZ * 16), texture.getInterpolatedV(16 - bounds.minY * 16))
GL11.glVertex3d(bounds.maxX, bounds.minY, bounds.minZ) GL11.glVertex3d(bounds.maxX, bounds.minY, bounds.minZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxY * 16), texture.getInterpolatedV(bounds.minZ * 16)) GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minZ * 16), texture.getInterpolatedV(16 - bounds.maxY * 16))
GL11.glVertex3d(bounds.maxX, bounds.maxY, bounds.minZ) GL11.glVertex3d(bounds.maxX, bounds.maxY, bounds.minZ)
// Right. // Right.
GL11.glNormal3f(-1, 0, 0) GL11.glNormal3f(-1, 0, 0)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minY * 16), texture.getInterpolatedV(bounds.maxZ * 16)) GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxZ * 16), texture.getInterpolatedV(16 - bounds.minY * 16))
GL11.glVertex3d(bounds.minX, bounds.minY, bounds.maxZ) GL11.glVertex3d(bounds.minX, bounds.minY, bounds.maxZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxY * 16), texture.getInterpolatedV(bounds.maxZ * 16)) GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxZ * 16), texture.getInterpolatedV(16 - bounds.maxY * 16))
GL11.glVertex3d(bounds.minX, bounds.maxY, bounds.maxZ) GL11.glVertex3d(bounds.minX, bounds.maxY, bounds.maxZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.maxY * 16), texture.getInterpolatedV(bounds.minZ * 16)) GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minZ * 16), texture.getInterpolatedV(16 - bounds.maxY * 16))
GL11.glVertex3d(bounds.minX, bounds.maxY, bounds.minZ) GL11.glVertex3d(bounds.minX, bounds.maxY, bounds.minZ)
GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minY * 16), texture.getInterpolatedV(bounds.minZ * 16)) GL11.glTexCoord2f(texture.getInterpolatedU(bounds.minZ * 16), texture.getInterpolatedV(16 - bounds.minY * 16))
GL11.glVertex3d(bounds.minX, bounds.minY, bounds.minZ) GL11.glVertex3d(bounds.minX, bounds.minY, bounds.minZ)
GL11.glEnd() GL11.glEnd()