From a31607ae7d0214101679a1ecf1ae8032a5257eda Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 9 Apr 2013 21:20:31 -0400 Subject: [PATCH] Fix compilation derp, and clean up rotation helper. --- .../fml/client/OpenGL43TextureHelper.java | 1 - client/cpw/mods/fml/client/TextureHelper.java | 26 ++++++++++++------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/client/cpw/mods/fml/client/OpenGL43TextureHelper.java b/client/cpw/mods/fml/client/OpenGL43TextureHelper.java index 17b83a11a9..994dc34cf1 100644 --- a/client/cpw/mods/fml/client/OpenGL43TextureHelper.java +++ b/client/cpw/mods/fml/client/OpenGL43TextureHelper.java @@ -1,7 +1,6 @@ package cpw.mods.fml.client; import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL43; import net.minecraft.client.renderer.texture.Texture; import net.minecraft.client.renderer.texture.TextureStitched; diff --git a/client/cpw/mods/fml/client/TextureHelper.java b/client/cpw/mods/fml/client/TextureHelper.java index 1bbeb80395..358b965f2a 100644 --- a/client/cpw/mods/fml/client/TextureHelper.java +++ b/client/cpw/mods/fml/client/TextureHelper.java @@ -41,20 +41,26 @@ public abstract class TextureHelper { ByteBuffer other = ByteBuffer.allocateDirect(buffer.capacity()); other.position(0); - for (int k = 0; k < texture.func_94276_e(); ++k) + int texHeight = texture.func_94276_e(); + int texWidth = texture.func_94275_d(); + + for (int row = 0; row < texHeight; ++row) { - int l = texture.func_94276_e() - k - 1; - int i1 = k * texture.func_94275_d() * 4; + int targCol = texHeight - row - 1; + int srcRowOffset = row * texWidth; - for (int k1 = 0; k1 < texture.func_94275_d(); ++k1) + for (int col = 0; col < texWidth; ++col) { - int l1 = k1 * texture.func_94276_e() * 4 + l * 4; - int i2 = i1 + k1 * 4; + int targIndex = col * texHeight + targCol; + int srcIndex = srcRowOffset + col; - other.put(l1 + 0, bytebuffer.get(i2 + 0)); - other.put(l1 + 1, bytebuffer.get(i2 + 1)); - other.put(l1 + 2, bytebuffer.get(i2 + 2)); - other.put(l1 + 3, bytebuffer.get(i2 + 3)); + srcIndex <<=2; + targIndex <<=2; + + other.put(targIndex + 0, bytebuffer.get(srcIndex + 0)); + other.put(targIndex + 1, bytebuffer.get(srcIndex + 1)); + other.put(targIndex + 2, bytebuffer.get(srcIndex + 2)); + other.put(targIndex + 3, bytebuffer.get(srcIndex + 3)); } } buffer.position(0);