package me.lordethan.cryton.utils;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.util.AxisAlignedBB;
public class RenderUtils {
public static void drawOutlinedBoundingBox(AxisAlignedBB aa) {
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldRenderer = tessellator.getWorldRenderer();
worldRenderer.startDrawing(3);
worldRenderer.addVertex(aa.minX, aa.minY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.minY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.minY, aa.maxZ);
worldRenderer.addVertex(aa.minX, aa.minY, aa.maxZ);
worldRenderer.addVertex(aa.minX, aa.minY, aa.minZ);
tessellator.draw();
worldRenderer.startDrawing(3);
worldRenderer.addVertex(aa.minX, aa.maxY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.maxY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.maxY, aa.maxZ);
worldRenderer.addVertex(aa.minX, aa.maxY, aa.maxZ);
worldRenderer.addVertex(aa.minX, aa.maxY, aa.minZ);
tessellator.draw();
worldRenderer.startDrawing(1);
worldRenderer.addVertex(aa.minX, aa.minY, aa.minZ);
worldRenderer.addVertex(aa.minX, aa.maxY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.minY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.maxY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.minY, aa.maxZ);
worldRenderer.addVertex(aa.maxX, aa.maxY, aa.maxZ);
worldRenderer.addVertex(aa.minX, aa.minY, aa.maxZ);
worldRenderer.addVertex(aa.minX, aa.maxY, aa.maxZ);
tessellator.draw();
}
public static void drawBoundingBox(AxisAlignedBB aa) {
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldRenderer = tessellator.getWorldRenderer();
worldRenderer.startDrawingQuads();
worldRenderer.addVertex(aa.minX, aa.minY, aa.minZ);
worldRenderer.addVertex(aa.minX, aa.maxY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.minY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.maxY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.minY, aa.maxZ);
worldRenderer.addVertex(aa.maxX, aa.maxY, aa.maxZ);
worldRenderer.addVertex(aa.minX, aa.minY, aa.maxZ);
worldRenderer.addVertex(aa.minX, aa.maxY, aa.maxZ);
tessellator.draw();
worldRenderer.startDrawingQuads();
worldRenderer.addVertex(aa.maxX, aa.maxY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.minY, aa.minZ);
worldRenderer.addVertex(aa.minX, aa.maxY, aa.minZ);
worldRenderer.addVertex(aa.minX, aa.minY, aa.minZ);
worldRenderer.addVertex(aa.minX, aa.maxY, aa.maxZ);
worldRenderer.addVertex(aa.minX, aa.minY, aa.maxZ);
worldRenderer.addVertex(aa.maxX, aa.maxY, aa.maxZ);
worldRenderer.addVertex(aa.maxX, aa.minY, aa.maxZ);
tessellator.draw();
worldRenderer.startDrawingQuads();
worldRenderer.addVertex(aa.minX, aa.maxY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.maxY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.maxY, aa.maxZ);
worldRenderer.addVertex(aa.minX, aa.maxY, aa.maxZ);
worldRenderer.addVertex(aa.minX, aa.maxY, aa.minZ);
worldRenderer.addVertex(aa.minX, aa.maxY, aa.maxZ);
worldRenderer.addVertex(aa.maxX, aa.maxY, aa.maxZ);
worldRenderer.addVertex(aa.maxX, aa.maxY, aa.minZ);
tessellator.draw();
worldRenderer.startDrawingQuads();
worldRenderer.addVertex(aa.minX, aa.minY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.minY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.minY, aa.maxZ);
worldRenderer.addVertex(aa.minX, aa.minY, aa.maxZ);
worldRenderer.addVertex(aa.minX, aa.minY, aa.minZ);
worldRenderer.addVertex(aa.minX, aa.minY, aa.maxZ);
worldRenderer.addVertex(aa.maxX, aa.minY, aa.maxZ);
worldRenderer.addVertex(aa.maxX, aa.minY, aa.minZ);
tessellator.draw();
worldRenderer.startDrawingQuads();
worldRenderer.addVertex(aa.minX, aa.minY, aa.minZ);
worldRenderer.addVertex(aa.minX, aa.maxY, aa.minZ);
worldRenderer.addVertex(aa.minX, aa.minY, aa.maxZ);
worldRenderer.addVertex(aa.minX, aa.maxY, aa.maxZ);
worldRenderer.addVertex(aa.maxX, aa.minY, aa.maxZ);
worldRenderer.addVertex(aa.maxX, aa.maxY, aa.maxZ);
worldRenderer.addVertex(aa.maxX, aa.minY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.maxY, aa.minZ);
tessellator.draw();
worldRenderer.startDrawingQuads();
worldRenderer.addVertex(aa.minX, aa.maxY, aa.maxZ);
worldRenderer.addVertex(aa.minX, aa.minY, aa.maxZ);
worldRenderer.addVertex(aa.minX, aa.maxY, aa.minZ);
worldRenderer.addVertex(aa.minX, aa.minY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.maxY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.minY, aa.minZ);
worldRenderer.addVertex(aa.maxX, aa.maxY, aa.maxZ);
worldRenderer.addVertex(aa.maxX, aa.minY, aa.maxZ);
tessellator.draw();
}
public static void drawOutlinedBlockESP(double x, double y, double z, float red, float green, float blue, float alpha, float lineWidth) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(770, 771);
// GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(false);
GL11.glLineWidth(lineWidth);
GL11.glColor4f(red, green, blue, alpha);
drawOutlinedBoundingBox(new AxisAlignedBB(x, y, z, x + 1D, y + 1D, z + 1D));
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glEnable(GL11.GL_TEXTURE_2D);
// GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(true);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
public static void drawBlockESP(double x, double y, double z, float red, float green, float blue, float alpha, float lineRed, float lineGreen, float lineBlue, float lineAlpha, float lineWidth) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(770, 771);
// GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(false);
GL11.glColor4f(red, green, blue, alpha);
drawBoundingBox(new AxisAlignedBB(x, y, z, x + 1D, y + 1D, z + 1D));
GL11.glLineWidth(lineWidth);
GL11.glColor4f(lineRed, lineGreen, lineBlue, lineAlpha);
drawOutlinedBoundingBox(new AxisAlignedBB(x, y, z, x + 1D, y + 1D, z + 1D));
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glEnable(GL11.GL_TEXTURE_2D);
// GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(true);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
public static void drawSolidBlockESP(double x, double y, double z, float red, float green, float blue, float alpha) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(770, 771);
// GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(false);
GL11.glColor4f(red, green, blue, alpha);
drawBoundingBox(new AxisAlignedBB(x, y, z, x + 1D, y + 1D, z + 1D));
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glEnable(GL11.GL_TEXTURE_2D);
// GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(true);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
public static void drawOutlinedEntityESP(double x, double y, double z, double width, double height, float red, float green, float blue, float alpha) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(770, 771);
// GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(false);
GL11.glColor4f(red, green, blue, alpha);
drawOutlinedBoundingBox(new AxisAlignedBB(x - width, y, z - width, x + width , y + height, z + width));
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glEnable(GL11.GL_TEXTURE_2D);
// GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(true);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
public static void drawSolidEntityESP(double x, double y, double z, double width, double height, float red, float green, float blue, float alpha) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(770, 771);
// GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(false);
GL11.glColor4f(red, green, blue, alpha);
drawBoundingBox(new AxisAlignedBB(x - width, y, z - width, x + width , y + height, z + width));
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glEnable(GL11.GL_TEXTURE_2D);
// GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(true);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
public static void drawEntityESP(double x, double y, double z, double width, double height, float red, float green, float blue, float alpha, float lineRed, float lineGreen, float lineBlue, float lineAlpha, float lineWdith) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(770, 771);
// GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(false);
GL11.glColor4f(red, green, blue, alpha);
drawBoundingBox(new AxisAlignedBB(x - width, y, z - width, x + width , y + height, z + width));
GL11.glLineWidth(lineWdith);
GL11.glColor4f(lineRed, lineGreen, lineBlue, lineAlpha);
drawOutlinedBoundingBox(new AxisAlignedBB(x - width, y, z - width, x + width , y + height, z + width));
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glEnable(GL11.GL_TEXTURE_2D);
// GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(true);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
public static void drawTracerLine(double x, double y, double z, float red, float green, float blue, float alpha, float lineWdith) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
// GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glBlendFunc(770, 771);
GL11.glEnable(GL11.GL_BLEND);
GL11.glLineWidth(lineWdith);
GL11.glColor4f(red, green, blue, alpha);
GL11.glBegin(2);
GL11.glVertex3d(0.0D, 0.0D + Minecraft.getMinecraft().thePlayer.getEyeHeight(), 0.0D);
GL11.glVertex3d(x, y, z);
GL11.glEnd();
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_BLEND);
// GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
public static void drawCircle(int x, int y, double r, int c)
{
float f = ((c >> 24) & 0xff) / 255F;
float f1 = ((c >> 16) & 0xff) / 255F;
float f2 = ((c >> 8) & 0xff) / 255F;
float f3 = (c & 0xff) / 255F;
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(f1, f2, f3, f);
GL11.glBegin(GL11.GL_LINE_LOOP);
for (int i = 0; i <= 360; i++)
{
double x2 = Math.sin(((i * Math.PI) / 180)) * r;
double y2 = Math.cos(((i * Math.PI) / 180)) * r;
GL11.glVertex2d(x + x2, y + y2);
}
GL11.glEnd();
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
}
public static void drawFilledCircle(int x, int y, double r, int c)
{
float f = ((c >> 24) & 0xff) / 255F;
float f1 = ((c >> 16) & 0xff) / 255F;
float f2 = ((c >> 8) & 0xff) / 255F;
float f3 = (c & 0xff) / 255F;
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(f1, f2, f3, f);
GL11.glBegin(GL11.GL_TRIANGLE_FAN);
for (int i = 0; i <= 360; i++)
{
double x2 = Math.sin(((i * Math.PI) / 180)) * r;
double y2 = Math.cos(((i * Math.PI) / 180)) * r;
GL11.glVertex2d(x + x2, y + y2);
}
GL11.glEnd();
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
}
public static void dr(double i, double j, double k, double l, int i1)
{
if (i < k)
{
double j1 = i;
i = k;
k = j1;
}
if (j < l)
{
double k1 = j;
j = l;
l = k1;
}
float f = ((i1 >> 24) & 0xff) / 255F;
float f1 = ((i1 >> 16) & 0xff) / 255F;
float f2 = ((i1 >> 8) & 0xff) / 255F;
float f3 = (i1 & 0xff) / 255F;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldRenderer = tessellator.getWorldRenderer();
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(f1, f2, f3, f);
worldRenderer.startDrawingQuads();
worldRenderer.addVertex(i, l, 0.0D);
worldRenderer.addVertex(k, l, 0.0D);
worldRenderer.addVertex(k, j, 0.0D);
worldRenderer.addVertex(i, j, 0.0D);
tessellator.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
}
}