diff --git a/src/main/java/electroblob/wizardry/client/renderer/effect/RenderShield.java b/src/main/java/electroblob/wizardry/client/renderer/effect/RenderShield.java index cfd6eacf..c0feb28c 100644 --- a/src/main/java/electroblob/wizardry/client/renderer/effect/RenderShield.java +++ b/src/main/java/electroblob/wizardry/client/renderer/effect/RenderShield.java @@ -49,7 +49,25 @@ public class RenderShield { GlStateManager.rotate(-player.rotationYaw, 0, 1, 0); GlStateManager.rotate(player.rotationPitch, 1, 0, 0); - GlStateManager.translate(0, 0, 0.8); + GlStateManager.translate(0, 0, 1); + + GlStateManager.pushMatrix(); + + // Changes the scale at which the texture is applied to the model. See LayerCreeper for a similar example, + // but with translation instead of scaling. + // You can do all sorts of fun stuff with this, just by applying transformations in the 2D texture space. + GlStateManager.matrixMode(GL11.GL_TEXTURE); // Switch to the 2D texture space + GlStateManager.loadIdentity(); + + GlStateManager.translate(0.5, 0.5, 0); + + float s = 1 - ((player.ticksExisted + event.getPartialTicks()) % 5) / 5 * 0.52f; + s = s*s; + GlStateManager.scale(s, s, 1); + + GlStateManager.translate(-0.5, -0.5, 0); + + GlStateManager.matrixMode(GL11.GL_MODELVIEW); // Switch back to the 3D model space Tessellator tessellator = Tessellator.getInstance(); @@ -57,6 +75,13 @@ public class RenderShield { render(tessellator); + // Undo the texture scaling + GlStateManager.matrixMode(GL11.GL_TEXTURE); + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(GL11.GL_MODELVIEW); + + GlStateManager.popMatrix(); + GlStateManager.enableLighting(); GlStateManager.shadeModel(GL11.GL_FLAT); @@ -96,7 +121,25 @@ public class RenderShield { GlStateManager.rotate(-player.renderYawOffset, 0, 1, 0); // GlStateManager.rotate(-player.rotationPitch, 1, 0, 0); - GlStateManager.translate(0, 0, 0.8); + GlStateManager.translate(0, 0, 1); + + GlStateManager.pushMatrix(); + + // Changes the scale at which the texture is applied to the model. See LayerCreeper for a similar example, + // but with translation instead of scaling. + // You can do all sorts of fun stuff with this, just by applying transformations in the 2D texture space. + GlStateManager.matrixMode(GL11.GL_TEXTURE); // Switch to the 2D texture space + GlStateManager.loadIdentity(); + + GlStateManager.translate(0.5, 0.5, 0); + + float s = 1 - ((player.ticksExisted + event.getPartialRenderTick()) % 5) / 5 * 0.52f; + s = s*s; + GlStateManager.scale(s, s, 1); + + GlStateManager.translate(-0.5, -0.5, 0); + + GlStateManager.matrixMode(GL11.GL_MODELVIEW); // Switch back to the 3D model space Tessellator tessellator = Tessellator.getInstance(); @@ -104,6 +147,13 @@ public class RenderShield { render(tessellator); + // Undo the texture scaling + GlStateManager.matrixMode(GL11.GL_TEXTURE); + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(GL11.GL_MODELVIEW); + + GlStateManager.popMatrix(); + GlStateManager.enableLighting(); GlStateManager.shadeModel(GL11.GL_FLAT); diff --git a/src/main/resources/assets/ebwizardry/textures/entity/shield.png b/src/main/resources/assets/ebwizardry/textures/entity/shield.png index db964c49..0fb3e564 100644 Binary files a/src/main/resources/assets/ebwizardry/textures/entity/shield.png and b/src/main/resources/assets/ebwizardry/textures/entity/shield.png differ