Search in sources :

Example 1 with BufferBuilder

use of net.minecraft.client.render.BufferBuilder in project Skyblocker by LifeIsAParadox.

the class RenderUtils method drawBoxOutline.

public static void drawBoxOutline(Box box, QuadColor color, float lineWidth, Direction... excludeDirs) {
    if (!FrustumUtils.isBoxVisible(box)) {
        return;
    }
    setup();
    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();
    cleanup();
}
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 2 with BufferBuilder

use of net.minecraft.client.render.BufferBuilder in project Polymorph by TheIllusiveC4.

the class SelectionWidget method drawGradientRect.

public static void drawGradientRect(Matrix4f mat, int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) {
    float startAlpha = (float) (startColor >> 24 & 255) / 255.0F;
    float startRed = (float) (startColor >> 16 & 255) / 255.0F;
    float startGreen = (float) (startColor >> 8 & 255) / 255.0F;
    float startBlue = (float) (startColor & 255) / 255.0F;
    float endAlpha = (float) (endColor >> 24 & 255) / 255.0F;
    float endRed = (float) (endColor >> 16 & 255) / 255.0F;
    float endGreen = (float) (endColor >> 8 & 255) / 255.0F;
    float endBlue = (float) (endColor & 255) / 255.0F;
    RenderSystem.enableDepthTest();
    RenderSystem.disableTexture();
    RenderSystem.enableBlend();
    RenderSystem.defaultBlendFunc();
    RenderSystem.setShader(GameRenderer::getPositionColorShader);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
    buffer.vertex(mat, right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).next();
    buffer.vertex(mat, left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).next();
    buffer.vertex(mat, left, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).next();
    buffer.vertex(mat, right, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).next();
    tessellator.draw();
    RenderSystem.disableBlend();
    RenderSystem.enableTexture();
}
Also used : Tessellator(net.minecraft.client.render.Tessellator) BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer)

Example 3 with BufferBuilder

use of net.minecraft.client.render.BufferBuilder in project jGui by ReplayMod.

the class MCVer method drawRect.

public static void drawRect(int right, int bottom, int left, int top) {
    // #if MC>=10800
    Tessellator tessellator = Tessellator.getInstance();
    // #else
    // $$ Tessellator tessellator = Tessellator.instance;
    // #endif
    // #if MC>=10904
    BufferBuilder vertexBuffer = tessellator.getBuffer();
    // #else
    // #if MC>=10800
    // $$ WorldRenderer vertexBuffer = tessellator.getWorldRenderer();
    // #else
    // $$ Tessellator vertexBuffer = tessellator;
    // #endif
    // #endif
    // #if MC>=10809
    // #if MC>=11700
    // $$ vertexBuffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
    // #else
    vertexBuffer.begin(GL11.GL_QUADS, VertexFormats.POSITION);
    // #endif
    vertexBuffer.vertex(right, top, 0).next();
    vertexBuffer.vertex(left, top, 0).next();
    vertexBuffer.vertex(left, bottom, 0).next();
    vertexBuffer.vertex(right, bottom, 0).next();
    // #else
    // $$ vertexBuffer.startDrawingQuads();
    // $$ vertexBuffer.addVertex(right, top, 0);
    // $$ vertexBuffer.addVertex(left, top, 0);
    // $$ vertexBuffer.addVertex(left, bottom, 0);
    // $$ vertexBuffer.addVertex(right, bottom, 0);
    // #endif
    tessellator.draw();
}
Also used : Tessellator(net.minecraft.client.render.Tessellator) BufferBuilder(net.minecraft.client.render.BufferBuilder)

Example 4 with BufferBuilder

use of net.minecraft.client.render.BufferBuilder in project jGui by ReplayMod.

the class MCVer method drawRect.

public static void drawRect(int x, int y, int width, int height, ReadableColor tl, ReadableColor tr, ReadableColor bl, ReadableColor br) {
    // #if MC>=10800
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder vertexBuffer = tessellator.getBuffer();
    // #else
    // $$ Tessellator tessellator = Tessellator.instance;
    // $$ Tessellator vertexBuffer = tessellator;
    // #endif
    // #if MC>=10809
    // #if MC>=11700
    // $$ vertexBuffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
    // #else
    vertexBuffer.begin(GL11.GL_QUADS, VertexFormats.POSITION_COLOR);
    // #endif
    vertexBuffer.vertex(x, y + height, 0).color(bl.getRed(), bl.getGreen(), bl.getBlue(), bl.getAlpha()).next();
    vertexBuffer.vertex(x + width, y + height, 0).color(br.getRed(), br.getGreen(), br.getBlue(), br.getAlpha()).next();
    vertexBuffer.vertex(x + width, y, 0).color(tr.getRed(), tr.getGreen(), tr.getBlue(), tr.getAlpha()).next();
    vertexBuffer.vertex(x, y, 0).color(tl.getRed(), tl.getGreen(), tl.getBlue(), tl.getAlpha()).next();
    // #else
    // $$ vertexBuffer.startDrawingQuads();
    // $$ vertexBuffer.setColorRGBA(bl.getRed(), bl.getGreen(), bl.getBlue(), bl.getAlpha());
    // $$ vertexBuffer.addVertex(x, y + height, 0);
    // $$ vertexBuffer.setColorRGBA(br.getRed(), br.getGreen(), br.getBlue(), br.getAlpha());
    // $$ vertexBuffer.addVertex(x + width, y + height, 0);
    // $$ vertexBuffer.setColorRGBA(tr.getRed(), tr.getGreen(), tr.getBlue(), tr.getAlpha());
    // $$ vertexBuffer.addVertex(x + width, y, 0);
    // $$ vertexBuffer.setColorRGBA(tl.getRed(), tl.getGreen(), tl.getBlue(), tl.getAlpha());
    // $$ vertexBuffer.addVertex(x, y, 0);
    // #endif
    tessellator.draw();
}
Also used : Tessellator(net.minecraft.client.render.Tessellator) BufferBuilder(net.minecraft.client.render.BufferBuilder)

Example 5 with BufferBuilder

use of net.minecraft.client.render.BufferBuilder in project MiniMap by pl3xgaming.

the class GL method drawSolidRect.

public static void drawSolidRect(Matrix4f matrix, float x0, float y0, float x1, float y1, int colorTopLeft, int colorTopRight, int colorBottomLeft, int colorBottomRight) {
    RenderSystem.disableTexture();
    RenderSystem.setShader(GameRenderer::getPositionColorShader);
    BufferBuilder buf = Tessellator.getInstance().getBuffer();
    buf.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
    buf.vertex(matrix, x1, y0, 0F).color(colorTopRight).next();
    buf.vertex(matrix, x0, y0, 0F).color(colorTopLeft).next();
    buf.vertex(matrix, x0, y1, 0F).color(colorBottomLeft).next();
    buf.vertex(matrix, x1, y1, 0F).color(colorBottomRight).next();
    buf.end();
    BufferRenderer.draw(buf);
    RenderSystem.enableTexture();
}
Also used : BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer)

Aggregations

BufferBuilder (net.minecraft.client.render.BufferBuilder)72 GameRenderer (net.minecraft.client.render.GameRenderer)42 Tessellator (net.minecraft.client.render.Tessellator)42 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