use of net.minecraft.client.util.math.MatrixStack in project meteor-client by MeteorDevelopment.
the class NametagUtils method begin.
public static void begin(Vec3 pos) {
MatrixStack matrices = RenderSystem.getModelViewStack();
matrices.push();
matrices.translate(pos.x, pos.y, 0);
matrices.scale((float) scale, (float) scale, 1);
}
use of net.minecraft.client.util.math.MatrixStack in project meteor-client by MeteorDevelopment.
the class HudEditorScreen method render.
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
if (!Utils.canUpdate())
renderBackground(matrices);
double s = mc.getWindow().getScaleFactor();
mouseX *= s;
mouseY *= s;
Utils.unscaledProjection();
if (!Utils.canUpdate())
hud.render(delta, hudElement -> true);
Renderer2D.COLOR.begin();
for (HudElement element : hud.elements) {
if (element.active)
continue;
renderElement(element, INACTIVE_BG_COLOR, INACTIVE_OL_COLOR);
}
for (HudElement element : selectedElements) {
renderElement(element, HOVER_BG_COLOR, HOVER_OL_COLOR);
}
if (!dragging) {
hoveredModule = null;
for (HudElement module : hud.elements) {
if (module.box.isOver(mouseX, mouseY)) {
if (!selectedElements.contains(module))
renderElement(module, HOVER_BG_COLOR, HOVER_OL_COLOR);
hoveredModule = module;
break;
}
}
if (selecting) {
renderQuad(mouseStartX, mouseStartY, mouseX - mouseStartX, mouseY - mouseStartY, HOVER_BG_COLOR, HOVER_OL_COLOR);
}
}
Renderer2D.COLOR.render(new MatrixStack());
Utils.scaledProjection();
runAfterRenderTasks();
}
use of net.minecraft.client.util.math.MatrixStack in project KiwiClient by TangyKiwi.
the class RenderUtils method drawLine2D.
public static void drawLine2D(double x1, double y1, double x2, double y2, LineColor color, float width) {
setup();
MatrixStack matrices = matrixFrom(x1, y1, 0);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
// Line
RenderSystem.disableDepthTest();
RenderSystem.disableCull();
RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader);
RenderSystem.lineWidth(width);
buffer.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES);
Vertexer.vertexLine(matrices, buffer, (float) x1, (float) y1, 0f, (float) x2, (float) y2, 0, color);
tessellator.draw();
RenderSystem.enableCull();
RenderSystem.enableDepthTest();
cleanup();
}
use of net.minecraft.client.util.math.MatrixStack in project KiwiClient by TangyKiwi.
the class RenderUtils method drawWorldGuiItem.
public static void drawWorldGuiItem(double x, double y, double z, double offX, double offY, double scale, ItemStack item) {
if (item.isEmpty()) {
return;
}
MatrixStack matrices = matrixFrom(x, y, z);
Camera camera = Utils.mc.gameRenderer.getCamera();
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-camera.getYaw()));
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch()));
matrices.translate(offX, offY, 0);
matrices.scale((float) scale, (float) scale, 0.001f);
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180f));
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
Vec3f[] currentLight = getCurrentLight();
DiffuseLighting.disableGuiDepthLighting();
Utils.mc.getBufferBuilders().getEntityVertexConsumers().draw();
Utils.mc.getItemRenderer().renderItem(item, ModelTransformation.Mode.GUI, 0xF000F0, OverlayTexture.DEFAULT_UV, matrices, Utils.mc.getBufferBuilders().getEntityVertexConsumers(), 0);
Utils.mc.getBufferBuilders().getEntityVertexConsumers().draw();
RenderSystem.setShaderLights(currentLight[0], currentLight[1]);
RenderSystem.disableBlend();
}
use of net.minecraft.client.util.math.MatrixStack in project KiwiClient by TangyKiwi.
the class RenderUtils method drawBoxFill.
public static void drawBoxFill(Box box, QuadColor color, 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();
// Fill
RenderSystem.setShader(GameRenderer::getPositionColorShader);
buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
Vertexer.vertexBoxQuads(matrices, buffer, Boxes.moveToZero(box), color, excludeDirs);
tessellator.draw();
cleanup();
}
Aggregations