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();
}
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);
}
}
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();
}
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();
}
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();
}
Aggregations