use of net.minecraft.client.render.Tessellator in project BlockMeter by ModProg.
the class ClientMeasureBox method render.
/**
* Renders the Box
*
* @param camera rendering Camera
* @param stack
* @param currentDimension Dimension the Player currently is in
* @param boxCreatorName Name of the Player that created the Box
*/
public void render(final Camera camera, final MatrixStack stack, final Identifier currentDimension, final Text boxCreatorName) {
if (!(currentDimension.equals(this.dimension))) {
return;
}
final Vec3d pos = camera.getPos();
// FIXME This actually does nothing
RenderSystem.lineWidth(2.0f);
RenderSystem.disableDepthTest();
RenderSystem.disableTexture();
RenderSystem.disableBlend();
stack.push();
stack.translate(-pos.x, -pos.y, -pos.z);
final Matrix4f model = stack.peek().getPositionMatrix();
final Tessellator tess = Tessellator.getInstance();
final BufferBuilder buffer = tess.getBuffer();
final float[] color = this.color.getColorComponents();
final float r = color[0];
final float g = color[1];
final float b = color[2];
// FIXME This actually does nothing
final float a = 0.8f;
RenderSystem.setShader(GameRenderer::getPositionColorShader);
buffer.begin(DrawMode.DEBUG_LINE_STRIP, VertexFormats.POSITION_COLOR);
buffer.vertex(model, (float) this.box.minX, (float) this.box.minY, (float) this.box.minZ).color(r, g, b, a).next();
buffer.vertex(model, (float) this.box.maxX, (float) this.box.minY, (float) this.box.minZ).color(r, g, b, a).next();
buffer.vertex(model, (float) this.box.maxX, (float) this.box.minY, (float) this.box.maxZ).color(r, g, b, a).next();
buffer.vertex(model, (float) this.box.minX, (float) this.box.minY, (float) this.box.maxZ).color(r, g, b, a).next();
buffer.vertex(model, (float) this.box.minX, (float) this.box.minY, (float) this.box.minZ).color(r, g, b, a).next();
buffer.vertex(model, (float) this.box.minX, (float) this.box.maxY, (float) this.box.minZ).color(r, g, b, a).next();
buffer.vertex(model, (float) this.box.minX, (float) this.box.maxY, (float) this.box.minZ).color(r, g, b, a).next();
buffer.vertex(model, (float) this.box.maxX, (float) this.box.maxY, (float) this.box.minZ).color(r, g, b, a).next();
buffer.vertex(model, (float) this.box.maxX, (float) this.box.maxY, (float) this.box.maxZ).color(r, g, b, a).next();
buffer.vertex(model, (float) this.box.minX, (float) this.box.maxY, (float) this.box.maxZ).color(r, g, b, a).next();
buffer.vertex(model, (float) this.box.minX, (float) this.box.maxY, (float) this.box.minZ).color(r, g, b, a).next();
buffer.vertex(model, (float) this.box.minX, (float) this.box.maxY, (float) this.box.maxZ).color(r, g, b, a).next();
buffer.vertex(model, (float) this.box.minX, (float) this.box.minY, (float) this.box.maxZ).color(r, g, b, a).next();
buffer.vertex(model, (float) this.box.maxX, (float) this.box.minY, (float) this.box.maxZ).color(r, g, b, a).next();
buffer.vertex(model, (float) this.box.maxX, (float) this.box.maxY, (float) this.box.maxZ).color(r, g, b, a).next();
buffer.vertex(model, (float) this.box.maxX, (float) this.box.maxY, (float) this.box.minZ).color(r, g, b, a).next();
buffer.vertex(model, (float) this.box.maxX, (float) this.box.minY, (float) this.box.minZ).color(r, g, b, a).next();
tess.draw();
if (BlockMeterClient.getConfigManager().getConfig().innerDiagonal) {
buffer.begin(DrawMode.DEBUG_LINES, VertexFormats.POSITION_COLOR);
buffer.vertex(model, (float) this.box.minX, (float) this.box.minY, (float) this.box.minZ).color(r, g, b, a).next();
buffer.vertex(model, (float) this.box.maxX, (float) this.box.maxY, (float) this.box.maxZ).color(r, g, b, a).next();
tess.draw();
}
RenderSystem.enableTexture();
RenderSystem.lineWidth(1.0f);
this.drawLengths(camera, stack, boxCreatorName);
RenderSystem.enableBlend();
RenderSystem.enableDepthTest();
stack.pop();
}
use of net.minecraft.client.render.Tessellator in project BleachHack by BleachDrinker420.
the class ShaderEffectWrapper method drawFramebufferToMain.
public void drawFramebufferToMain(String framebuffer) {
Framebuffer buffer = getFramebuffer(framebuffer);
Shader blitshader = mc.gameRenderer.blitScreenShader;
blitshader.addSampler("DiffuseSampler", buffer.getColorAttachment());
double w = mc.getWindow().getFramebufferWidth();
double h = mc.getWindow().getFramebufferHeight();
float ws = (float) buffer.viewportWidth / (float) buffer.textureWidth;
float hs = (float) buffer.viewportHeight / (float) buffer.textureHeight;
RenderSystem.enableBlend();
RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ZERO, GlStateManager.DstFactor.ONE);
GlStateManager._colorMask(true, true, true, false);
GlStateManager._disableDepthTest();
GlStateManager._depthMask(false);
GlStateManager._viewport(0, 0, (int) w, (int) h);
blitshader.bind();
Tessellator tessellator = RenderSystem.renderThreadTesselator();
BufferBuilder bufferBuilder = tessellator.getBuffer();
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
bufferBuilder.vertex(0, h, 0).texture(0f, 0f).color(255, 255, 255, 255).next();
bufferBuilder.vertex(w, h, 0).texture(ws, 0f).color(255, 255, 255, 255).next();
bufferBuilder.vertex(w, 0, 0).texture(ws, hs).color(255, 255, 255, 255).next();
bufferBuilder.vertex(0, 0, 0).texture(0f, hs).color(255, 255, 255, 255).next();
bufferBuilder.end();
BufferRenderer.postDraw(bufferBuilder);
blitshader.unbind();
GlStateManager._depthMask(true);
GlStateManager._colorMask(true, true, true, true);
RenderSystem.disableBlend();
}
use of net.minecraft.client.render.Tessellator in project BleachHack by BleachDrinker420.
the class Renderer method drawQuadFill.
// -------------------- Quads --------------------
public static void drawQuadFill(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, int cullMode, QuadColor color) {
if (!FrustumUtils.isPointVisible(x1, y1, z1) && !FrustumUtils.isPointVisible(x2, y2, z2) && !FrustumUtils.isPointVisible(x3, y3, z3) && !FrustumUtils.isPointVisible(x4, y4, z4)) {
return;
}
setup();
MatrixStack matrices = matrixFrom(x1, y1, z1);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
// Fill
RenderSystem.setShader(GameRenderer::getPositionColorShader);
buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
Vertexer.vertexQuad(matrices, buffer, 0f, 0f, 0f, (float) (x2 - x1), (float) (y2 - y1), (float) (z2 - z1), (float) (x3 - x1), (float) (y3 - y1), (float) (z3 - z1), (float) (x4 - x1), (float) (y4 - y1), (float) (z4 - z1), cullMode, color);
tessellator.draw();
cleanup();
}
use of net.minecraft.client.render.Tessellator in project BleachHack by BleachDrinker420.
the class Renderer method drawQuadOutline.
public static void drawQuadOutline(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, float lineWidth, QuadColor color) {
if (!FrustumUtils.isPointVisible(x1, y1, z1) && !FrustumUtils.isPointVisible(x2, y2, z2) && !FrustumUtils.isPointVisible(x3, y3, z3) && !FrustumUtils.isPointVisible(x4, y4, z4)) {
return;
}
setup();
MatrixStack matrices = matrixFrom(x1, y1, z1);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
int[] colors = color.getAllColors();
// Outline
RenderSystem.disableCull();
RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader);
RenderSystem.lineWidth(lineWidth);
buffer.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES);
Vertexer.vertexLine(matrices, buffer, 0f, 0f, 0f, (float) (x2 - x1), (float) (y2 - y1), (float) (z2 - z1), LineColor.gradient(colors[0], colors[1]));
Vertexer.vertexLine(matrices, buffer, (float) (x2 - x1), (float) (y2 - y1), (float) (z2 - z1), (float) (x3 - x1), (float) (y3 - y1), (float) (z3 - z1), LineColor.gradient(colors[1], colors[2]));
Vertexer.vertexLine(matrices, buffer, (float) (x3 - x1), (float) (y3 - y1), (float) (z3 - z1), (float) (x4 - x1), (float) (y4 - y1), (float) (z4 - z1), LineColor.gradient(colors[2], colors[3]));
Vertexer.vertexLine(matrices, buffer, (float) (x4 - x1), (float) (y4 - y1), (float) (z4 - z1), 0f, 0f, 0f, LineColor.gradient(colors[3], colors[0]));
tessellator.draw();
RenderSystem.enableCull();
cleanup();
}
use of net.minecraft.client.render.Tessellator in project BleachHack by BleachDrinker420.
the class WindowScreen method renderBackgroundTexture.
public void renderBackgroundTexture(int vOffset) {
int colorOffset = (int) ((System.currentTimeMillis() / 75) % 100);
if (colorOffset > 50)
colorOffset = 50 - (colorOffset - 50);
// smooth
colorOffset = (int) (-(Math.cos(Math.PI * (colorOffset / 50d)) - 1) / 2 * 50);
RenderSystem.disableTexture();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
bufferBuilder.vertex(width, 0, 0).color(30, 20, 80, 255).next();
bufferBuilder.vertex(0, 0, 0).color(30 + colorOffset / 3, 20, 80, 255).next();
bufferBuilder.vertex(0, height + 16, 0).color(90, 54, 159, 255).next();
bufferBuilder.vertex(width, height + 16, 0).color(105 + colorOffset, 54, 189, 255).next();
tessellator.draw();
RenderSystem.disableBlend();
RenderSystem.enableTexture();
}
Aggregations