Search in sources :

Example 26 with BufferBuilder

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

Example 27 with BufferBuilder

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

the class RenderUtils method drawOutlineBox.

public static void drawOutlineBox(MatrixStack matrixStack, Box bb, Color color, boolean draw) {
    Color color1 = color;
    Matrix4f matrix4f = matrixStack.peek().getPositionMatrix();
    BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
    if (draw)
        bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, /*LINES*/
        VertexFormats.POSITION_COLOR);
    VoxelShape shape = VoxelShapes.cuboid(bb);
    shape.forEachEdge((x1, y1, z1, x2, y2, z2) -> {
        bufferBuilder.vertex(matrix4f, (float) x1, (float) y1, (float) z1).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
        bufferBuilder.vertex(matrix4f, (float) x2, (float) y2, (float) z2).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
    });
    if (draw) {
        bufferBuilder.end();
        BufferRenderer.draw(bufferBuilder);
    }
}
Also used : Matrix4f(net.minecraft.util.math.Matrix4f) IMatrix4f(dev.hypnotic.utils.mixin.IMatrix4f) VoxelShape(net.minecraft.util.shape.VoxelShape) Color(java.awt.Color) BufferBuilder(net.minecraft.client.render.BufferBuilder)

Example 28 with BufferBuilder

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

the class RenderUtils method drawFaceOutline.

public static void drawFaceOutline(BlockPos blockPos, QuadColor color, int width, 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();
    // Outline
    RenderSystem.disableCull();
    RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader);
    RenderSystem.lineWidth(width);
    buffer.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES);
    Vertexer.vertexBoxLinesFace(matrices, buffer, Boxes.moveToZero(box), color, face);
    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) Box(net.minecraft.util.math.Box)

Example 29 with BufferBuilder

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

the class NahrFont method drawTexturedModalRect.

private final void drawTexturedModalRect(MatrixStack matrixStack, float x, float y, float u, float v, float width, float height, int color) {
    Matrix4f matrix4f = matrixStack.peek().getPositionMatrix();
    float scale = 0.0039063F;
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferBuilder = tessellator.getBuffer();
    float f = (color >> 24 & 0xFF) / 255.0F;
    float f1 = (color >> 16 & 0xFF) / 255.0F;
    float f2 = (color >> 8 & 0xFF) / 255.0F;
    float f3 = (color & 0xFF) / 255.0F;
    bufferBuilder.vertex(matrix4f, x + 0.0F, y + height, 0.0f).texture((u + 0.0F) * scale, (v + height) * scale).color(f1, f2, f3, f).next();
    bufferBuilder.vertex(matrix4f, x + width, y + height, 0.0f).texture((u + width) * scale, (v + height) * scale).color(f1, f2, f3, f).next();
    bufferBuilder.vertex(matrix4f, x + width, y + 0.0F, 0.0f).texture((u + width) * scale, (v + 0.0F) * scale).color(f1, f2, f3, f).next();
    bufferBuilder.vertex(matrix4f, x + 0.0F, y + 0.0F, 0.0f).texture((u + 0.0F) * scale, (v + 0.0F) * scale).color(f1, f2, f3, f).next();
}
Also used : Matrix4f(net.minecraft.util.math.Matrix4f) Tessellator(net.minecraft.client.render.Tessellator) BufferBuilder(net.minecraft.client.render.BufferBuilder)

Example 30 with BufferBuilder

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

the class TextBox method drawSelectionHighlight.

private void drawSelectionHighlight(int x1, int y1, int x2, int y2) {
    int j;
    if (x1 < x2) {
        j = x1;
        x1 = x2;
        x2 = j;
    }
    if (y1 < y2) {
        j = y1;
        y1 = y2;
        y2 = j;
    }
    if (x2 > this.x + this.width) {
        x2 = this.x + this.width;
    }
    if (x1 > this.x + this.width) {
        x1 = this.x + this.width;
    }
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferBuilder = tessellator.getBuffer();
    RenderSystem.setShader(GameRenderer::getPositionShader);
    RenderSystem.setShaderColor(0.0F, 0.0F, 1.0F, 1.0F);
    RenderSystem.disableTexture();
    RenderSystem.enableColorLogicOp();
    RenderSystem.logicOp(GlStateManager.LogicOp.OR_REVERSE);
    bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
    bufferBuilder.vertex((double) x1, (double) y2, 0.0D).next();
    bufferBuilder.vertex((double) x2, (double) y2, 0.0D).next();
    bufferBuilder.vertex((double) x2, (double) y1, 0.0D).next();
    bufferBuilder.vertex((double) x1, (double) y1, 0.0D).next();
    tessellator.draw();
    RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
    RenderSystem.disableColorLogicOp();
    RenderSystem.enableTexture();
}
Also used : Tessellator(net.minecraft.client.render.Tessellator) BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer)

Aggregations

BufferBuilder (net.minecraft.client.render.BufferBuilder)76 GameRenderer (net.minecraft.client.render.GameRenderer)46 Tessellator (net.minecraft.client.render.Tessellator)44 Matrix4f (net.minecraft.util.math.Matrix4f)18 MatrixStack (net.minecraft.client.util.math.MatrixStack)14 IMatrix4f (dev.hypnotic.utils.mixin.IMatrix4f)9 Color (java.awt.Color)9 RenderLayer (net.minecraft.client.render.RenderLayer)5 Vec3d (net.minecraft.util.math.Vec3d)5 BlockState (net.minecraft.block.BlockState)4 BlockEntity (net.minecraft.block.entity.BlockEntity)4 ChunkOcclusionDataBuilder (net.minecraft.client.render.chunk.ChunkOcclusionDataBuilder)4 FluidState (net.minecraft.fluid.FluidState)4 BlockPos (net.minecraft.util.math.BlockPos)4 Random (java.util.Random)3 BlockRenderManager (net.minecraft.client.render.block.BlockRenderManager)3 ChunkRendererRegion (net.minecraft.client.render.chunk.ChunkRendererRegion)3 Inject (org.spongepowered.asm.mixin.injection.Inject)3 Mirror (com.qouteall.immersive_portals.portal.Mirror)2 HashSet (java.util.HashSet)2