Skip to content

Instantly share code, notes, and snippets.

@StillManic
Created July 5, 2015 22:31
Show Gist options
  • Save StillManic/ef78905fed8313638cb9 to your computer and use it in GitHub Desktop.
Save StillManic/ef78905fed8313638cb9 to your computer and use it in GitHub Desktop.
public static void renderCameraTransformOrigin(float f, Matrix4f matrix, TransformType type)
{
GameSettings settings = Minecraft.getMinecraft().gameSettings;
if (settings.showDebugInfo && !settings.hideGUI && !Minecraft.getMinecraft().thePlayer.hasReducedDebug() && !settings.reducedDebugInfo)
{
Entity entity = Minecraft.getMinecraft().getRenderViewEntity();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GL11.glLineWidth(2.0f);
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
GlStateManager.pushMatrix();
GlStateManager.enableTexture2D();
GlStateManager.rotate(45, 0, -1, 0);
GlStateManager.disableDepth();
engine().bindTexture(new ResourceLocation("textures/font/ascii.png"));
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
// fontRenderer.drawSplitString("test", 0, 0, fontRenderer.getStringWidth("test"), -16777216);
fontRenderer.drawString("test", 0, 0, -16777216);
GlStateManager.enableDepth();
GlStateManager.disableTexture2D();
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.matrixMode(5888);
GlStateManager.loadIdentity();
Minecraft.getMinecraft().entityRenderer.orientCamera(f);
Vector3f translation = new Vector3f();
matrix.get(translation);
Quat4f rotation = new Quat4f();
matrix.get(rotation);
GlStateManager.translate(0, entity.getEyeHeight(), 0);
GlStateManager.pushMatrix();
GlStateManager.rotate(rotation.getW(), rotation.getX(), rotation.getY(), rotation.getZ());
Vector3f rotationVec = TRSRTransformation.toYXZ(rotation);
GlStateManager.pushMatrix();
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
GL11.glDisable(GL11.GL_LIGHTING);
renderOriginBox(0.005D, 0, 229, 255, 128);
renderOriginLines(0.01D);
// renderOriginText(type.name(), Float.toString(rotationVec.getX()), Float.toString(rotationVec.getY()), Float.toString(rotationVec.getZ()));
GL11.glPopAttrib();
GlStateManager.popMatrix();
GlStateManager.popMatrix();
GlStateManager.popMatrix();
GlStateManager.depthMask(true);
GlStateManager.enableTexture2D();
engine().bindTexture(TextureMap.locationBlocksTexture);
GlStateManager.disableBlend();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment