mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-12 16:57:32 -04:00
Fixed wrong UV mapping on 3D prints (in particular the item renderer).
This commit is contained in:
parent
5506375bf2
commit
4b354551a0
@ -141,7 +141,8 @@ object BlockRenderer extends ISimpleBlockRenderingHandler {
|
||||
}
|
||||
|
||||
// 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.overrideBlockTexture = renderer.overrideBlockTexture
|
||||
PatchedRenderBlocks.flipTexture = renderer.flipTexture
|
||||
|
@ -258,24 +258,24 @@ object ItemRenderer extends IItemRenderer {
|
||||
|
||||
// Front.
|
||||
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.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.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.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)
|
||||
|
||||
// Back.
|
||||
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.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.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.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)
|
||||
|
||||
// Top.
|
||||
@ -302,24 +302,24 @@ object ItemRenderer extends IItemRenderer {
|
||||
|
||||
// Left.
|
||||
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.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.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.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)
|
||||
|
||||
// Right.
|
||||
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.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.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.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.glEnd()
|
||||
|
Loading…
x
Reference in New Issue
Block a user