Search in sources :

Example 16 with GameRenderer

use of net.minecraft.client.render.GameRenderer in project Hypnotic-Client by Hypnotic-Development.

the class RenderUtils method renderPrepare.

public static BufferBuilder renderPrepare(Color color) {
    float red = color.getRed() / 255f;
    float green = color.getGreen() / 255f;
    float blue = color.getBlue() / 255f;
    float alpha = color.getAlpha() / 255f;
    RenderSystem.setShader(GameRenderer::getPositionShader);
    GL11.glDepthFunc(GL11.GL_ALWAYS);
    RenderSystem.setShaderColor(red, green, blue, alpha);
    RenderSystem.lineWidth(2f);
    BufferBuilder buffer = Tessellator.getInstance().getBuffer();
    buffer.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION);
    return buffer;
}
Also used : BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer)

Example 17 with GameRenderer

use of net.minecraft.client.render.GameRenderer in project Hypnotic-Client by Hypnotic-Development.

the class RenderUtils method renderRoundedQuad.

// Taken from Coffee client (https://github.com/business-goose/Coffee/tree/master)
// My rounded stuff looked retarded
public static void renderRoundedQuad(MatrixStack matrices, Color c, double fromX, double fromY, double toX, double toY, double rad, double samples) {
    int color = c.getRGB();
    Matrix4f matrix = matrices.peek().getPositionMatrix();
    float f = (float) (color >> 24 & 255) / 255.0F;
    float g = (float) (color >> 16 & 255) / 255.0F;
    float h = (float) (color >> 8 & 255) / 255.0F;
    float k = (float) (color & 255) / 255.0F;
    RenderSystem.enableBlend();
    RenderSystem.disableTexture();
    RenderSystem.setShader(GameRenderer::getPositionColorShader);
    renderRoundedQuadInternal(matrix, g, h, k, f, fromX, fromY, toX, toY, rad, samples);
    RenderSystem.enableTexture();
    RenderSystem.disableBlend();
    RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
}
Also used : Matrix4f(net.minecraft.util.math.Matrix4f) IMatrix4f(dev.hypnotic.utils.mixin.IMatrix4f) GameRenderer(net.minecraft.client.render.GameRenderer)

Example 18 with GameRenderer

use of net.minecraft.client.render.GameRenderer in project Hypnotic-Client by Hypnotic-Development.

the class RenderUtils method drawGradientFilledCircle.

public static void drawGradientFilledCircle(MatrixStack matrices, final int xx, final int yy, final float radius, int sides, Color color1, Color color2) {
    int sections = sides;
    double dAngle = 2 * Math.PI / sections;
    float x, y, lastX = 0, lastY = 0;
    for (int i = -1; i < sections; i++) {
        x = (float) (radius * Math.sin((i * dAngle)));
        y = (float) (radius * Math.cos((i * dAngle)));
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder buffer = tessellator.getBuffer();
        RenderSystem.enableBlend();
        RenderSystem.disableDepthTest();
        RenderSystem.disableCull();
        RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader);
        RenderSystem.lineWidth(1);
        buffer.begin(VertexFormat.DrawMode.TRIANGLE_FAN, VertexFormats.POSITION_COLOR);
        Vertexer.vertexTri(matrices, buffer, xx, yy, 0f, xx + x, yy + y, 0f, xx + lastX, yy + lastY, 0f, color1, color2);
        tessellator.draw();
        RenderSystem.enableCull();
        RenderSystem.enableDepthTest();
        lastX = x;
        lastY = y;
    }
}
Also used : Tessellator(net.minecraft.client.render.Tessellator) BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer)

Example 19 with GameRenderer

use of net.minecraft.client.render.GameRenderer in project Hypnotic-Client by Hypnotic-Development.

the class RenderUtils method drawFilledCircle.

// took me too long to do this
public static void drawFilledCircle(MatrixStack matrices, float xx, float yy, float radius, int sides, Color color) {
    int sections = sides;
    double dAngle = 2 * Math.PI / sections;
    float x, y, lastX = 0, lastY = 0;
    for (int i = -1; i < sections; i++) {
        x = (float) (radius * Math.sin((i * dAngle)));
        y = (float) (radius * Math.cos((i * dAngle)));
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder buffer = tessellator.getBuffer();
        RenderSystem.enableBlend();
        RenderSystem.disableDepthTest();
        RenderSystem.disableCull();
        RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader);
        RenderSystem.lineWidth(1);
        buffer.begin(VertexFormat.DrawMode.TRIANGLE_FAN, VertexFormats.POSITION_COLOR);
        Vertexer.vertexTri(matrices, buffer, xx, yy, 0f, xx + x, yy + y, 0f, xx + lastX, yy + lastY, 0f, color);
        tessellator.draw();
        RenderSystem.enableCull();
        RenderSystem.enableDepthTest();
        lastX = x;
        lastY = y;
    }
}
Also used : Tessellator(net.minecraft.client.render.Tessellator) BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer)

Example 20 with GameRenderer

use of net.minecraft.client.render.GameRenderer in project Hypnotic-Client by Hypnotic-Development.

the class RenderUtils method drawBoxOutline.

public static void drawBoxOutline(Box box, QuadColor color, float lineWidth, Direction... excludeDirs) {
    if (!getFrustum().isVisible(box)) {
        return;
    }
    setup3DRender(true);
    MatrixStack matrices = matrixFrom(box.minX, box.minY, box.minZ);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    // Outline
    RenderSystem.disableCull();
    RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader);
    RenderSystem.lineWidth(lineWidth);
    buffer.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES);
    Vertexer.vertexBoxLines(matrices, buffer, Boxes.moveToZero(box), color, excludeDirs);
    tessellator.draw();
    RenderSystem.enableCull();
    end3DRender();
}
Also used : Tessellator(net.minecraft.client.render.Tessellator) MatrixStack(net.minecraft.client.util.math.MatrixStack) BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer)

Aggregations

GameRenderer (net.minecraft.client.render.GameRenderer)112 BufferBuilder (net.minecraft.client.render.BufferBuilder)74 Matrix4f (net.minecraft.util.math.Matrix4f)38 Tessellator (net.minecraft.client.render.Tessellator)33 MatrixStack (net.minecraft.client.util.math.MatrixStack)12 TextRenderer (net.minecraft.client.font.TextRenderer)11 Vec3d (net.minecraft.util.math.Vec3d)10 ClickGui (net.wurstclient.clickgui.ClickGui)8 BlockPos (net.minecraft.util.math.BlockPos)7 IMatrix4f (dev.hypnotic.utils.mixin.IMatrix4f)6 ItemStack (net.minecraft.item.ItemStack)6 Box (net.minecraft.util.math.Box)6 MinecraftClient (net.minecraft.client.MinecraftClient)5 PathCmd (net.wurstclient.commands.PathCmd)5 PlayerEntity (net.minecraft.entity.player.PlayerEntity)4 TranslatableText (net.minecraft.text.TranslatableText)4 Color (java.awt.Color)3 LiteralText (net.minecraft.text.LiteralText)3 Text (net.minecraft.text.Text)3 Camera (net.minecraft.client.render.Camera)2