Search in sources :

Example 16 with Tessellator

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

the class RenderUtils method drawAuraESP.

public static void drawAuraESP(MatrixStack matrices, Vec3d pos, float partialTicks, double rad, double height, int color) {
    float lastX = 0;
    float lastZ = (float) rad;
    for (int angle = 0; angle <= 360; angle += 6) {
        float cos = MathHelper.cos((float) Math.toRadians(angle));
        float sin = MathHelper.sin((float) Math.toRadians(angle));
        float x = (float) (rad * sin);
        float z = (float) (rad * cos);
        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, (float) pos.x + lastX, (float) pos.y, (float) pos.z + lastZ, (float) pos.x + x, (float) pos.y, (float) pos.z + z, (float) pos.x + lastX + 12, (float) pos.y + 12, (float) pos.z + lastZ + 12, Color.WHITE);
        tessellator.draw();
        RenderSystem.enableCull();
        RenderSystem.enableDepthTest();
        lastX = x;
        lastZ = z;
    }
}
Also used : Tessellator(net.minecraft.client.render.Tessellator) BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer)

Example 17 with Tessellator

use of net.minecraft.client.render.Tessellator 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 18 with Tessellator

use of net.minecraft.client.render.Tessellator 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 19 with Tessellator

use of net.minecraft.client.render.Tessellator 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)

Example 20 with Tessellator

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

the class RenderUtils method drawFaceFill.

public static void drawFaceFill(BlockPos blockPos, QuadColor color, Direction face) {
    Box box = new Box(blockPos);
    if (!getFrustum().isVisible(box)) {
        return;
    }
    setup3DRender(true);
    MatrixStack matrices = matrixFrom(box.minX, box.minY, box.minZ);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    // Fill
    RenderSystem.setShader(GameRenderer::getPositionColorShader);
    buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
    Vertexer.vertexBoxQuadsFace(matrices, buffer, Boxes.moveToZero(box), color, face);
    tessellator.draw();
    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) Box(net.minecraft.util.math.Box)

Aggregations

Tessellator (net.minecraft.client.render.Tessellator)47 BufferBuilder (net.minecraft.client.render.BufferBuilder)43 GameRenderer (net.minecraft.client.render.GameRenderer)31 MatrixStack (net.minecraft.client.util.math.MatrixStack)12 Color (java.awt.Color)4 Inject (org.spongepowered.asm.mixin.injection.Inject)4 Matrix4f (net.minecraft.util.math.Matrix4f)3 Framebuffer (net.minecraft.client.gl.Framebuffer)2 Shader (net.minecraft.client.render.Shader)2 Box (net.minecraft.util.math.Box)2 Vec3d (net.minecraft.util.math.Vec3d)2 Mirror (com.qouteall.immersive_portals.portal.Mirror)1 Random (java.util.Random)1 BlockBase (net.minecraft.block.BlockBase)1 TextRenderer (net.minecraft.client.font.TextRenderer)1 VertexBuffer (net.minecraft.client.gl.VertexBuffer)1 ClientPlayerEntity (net.minecraft.client.network.ClientPlayerEntity)1 VertexConsumerProvider (net.minecraft.client.render.VertexConsumerProvider)1 NbtCompound (net.minecraft.nbt.NbtCompound)1 StationTessellator (net.modificationstation.stationapi.api.client.render.StationTessellator)1