use of net.minecraft.client.render.Tessellator 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.Tessellator 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.Tessellator 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();
}
use of net.minecraft.client.render.Tessellator in project ImmersivePortalsMod by qouteall.
the class MyRenderHelper method renderScreenTriangle.
static void renderScreenTriangle() {
GlStateManager.matrixMode(GL_MODELVIEW);
GlStateManager.pushMatrix();
GlStateManager.loadIdentity();
GlStateManager.matrixMode(GL_PROJECTION);
GlStateManager.pushMatrix();
GlStateManager.loadIdentity();
GlStateManager.disableAlphaTest();
GlStateManager.disableTexture();
GlStateManager.shadeModel(GL_SMOOTH);
GL20.glUseProgram(0);
GL11.glDisable(GL_CLIP_PLANE0);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBufferBuilder();
bufferbuilder.begin(GL_TRIANGLES, VertexFormats.POSITION_COLOR);
bufferbuilder.vertex(1, -1, 0).color(255, 255, 255, 255).next();
bufferbuilder.vertex(1, 1, 0).color(255, 255, 255, 255).next();
bufferbuilder.vertex(-1, 1, 0).color(255, 255, 255, 255).next();
bufferbuilder.vertex(-1, 1, 0).color(255, 255, 255, 255).next();
bufferbuilder.vertex(-1, -1, 0).color(255, 255, 255, 255).next();
bufferbuilder.vertex(1, -1, 0).color(255, 255, 255, 255).next();
tessellator.draw();
GlStateManager.matrixMode(GL_MODELVIEW);
GlStateManager.popMatrix();
GlStateManager.matrixMode(GL_PROJECTION);
GlStateManager.popMatrix();
GlStateManager.enableAlphaTest();
GlStateManager.enableTexture();
}
use of net.minecraft.client.render.Tessellator in project ImmersivePortalsMod by qouteall.
the class ViewAreaRenderer method drawPortalViewTriangle.
public static void drawPortalViewTriangle(Portal portal) {
MinecraftClient.getInstance().getProfiler().push("render_view_triangle");
DimensionRenderHelper helper = CGlobal.clientWorldLoader.getDimensionRenderHelper(portal.dimensionTo);
Vec3d fogColor = helper.getFogColor();
// important
GlStateManager.enableCull();
// In OpenGL, if you forget to set one rendering state and the result will be abnormal
// this design is bug-prone (DirectX is better in this aspect)
GuiLighting.disable();
GlStateManager.color4f(1, 1, 1, 1);
GlStateManager.disableFog();
GlStateManager.disableAlphaTest();
GlStateManager.disableTexture();
GlStateManager.shadeModel(GL11.GL_SMOOTH);
GlStateManager.disableBlend();
GlStateManager.disableLighting();
GL11.glDisable(GL_CLIP_PLANE0);
if (OFInterface.isShaders.getAsBoolean()) {
fogColor = Vec3d.ZERO;
}
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBufferBuilder();
buildPortalViewAreaTrianglesBuffer(fogColor, portal, bufferbuilder, PortalRenderer.mc.gameRenderer.getCamera().getPos(), MyRenderHelper.partialTicks, portal instanceof Mirror ? 0 : 0.45F);
tessellator.draw();
GlStateManager.enableCull();
GlStateManager.enableAlphaTest();
GlStateManager.enableTexture();
GlStateManager.enableLighting();
MinecraftClient.getInstance().getProfiler().pop();
}
Aggregations