use of net.minecraft.util.math.Matrix4f in project Blockify by clownless.
the class RenderUtil method drawTexture.
public static void drawTexture(MatrixStack matrixStack, URLImage image, float x, float y, float scale) {
Identifier texture = image.getIdentifier();
int width = image.getWidth();
int height = image.getHeight();
TextureManager tex = MinecraftClient.getInstance().getTextureManager();
tex.bindTexture(texture);
RenderSystem.enableTexture();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, texture);
RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
RenderSystem.enableDepthTest();
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE);
Matrix4f matrices = matrixStack.peek().getPositionMatrix();
bufferBuilder.vertex(matrices, x, y + (height * scale), 0).texture(0, 1).next();
bufferBuilder.vertex(matrices, x + (width * scale), y + (height * scale), 0).texture(1, 1).next();
bufferBuilder.vertex(matrices, x + (width * scale), y, 0).texture(1, 0).next();
bufferBuilder.vertex(matrices, x, y, 0).texture(0, 0).next();
tessellator.draw();
RenderSystem.disableBlend();
}
use of net.minecraft.util.math.Matrix4f in project EdenClient by HahaOO7.
the class TracerRenderer method render.
private void render(MatrixStack matrixStack, VertexConsumerProvider.Immediate vertexConsumerProvider, float delta) {
RenderSystem.setShader(GameRenderer::getPositionShader);
RenderSystem.disableDepthTest();
Matrix4f matrix = matrixStack.peek().getPositionMatrix();
Vec3d start = RenderUtils.getCameraPos().add(PlayerUtils.getClientLookVec());
BufferBuilder bb = Tessellator.getInstance().getBuffer();
bb.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION);
tracers.values().forEach(s -> s.forEach(target -> {
bb.vertex(matrix, (float) target.x, (float) target.y, (float) target.z).next();
bb.vertex(matrix, (float) start.x, (float) start.y, (float) start.z).next();
}));
bb.end();
RenderSystem.setShaderColor(1, 1, 1, 1);
BufferRenderer.draw(bb);
}
use of net.minecraft.util.math.Matrix4f in project meteor-client by MeteorDevelopment.
the class WorldRendererMixin method onRenderEndSkyDraw.
/**
* @author Walaryne
*/
@Inject(method = "renderEndSky", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Tessellator;draw()V"))
private void onRenderEndSkyDraw(MatrixStack matrices, CallbackInfo info) {
Ambience ambience = Modules.get().get(Ambience.class);
if (ambience.isActive() && ambience.endSky.get() && ambience.customSkyColor.get()) {
Color customEndSkyColor = ambience.skyColor();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
Matrix4f matrix4f = matrices.peek().getPositionMatrix();
bufferBuilder.clear();
bufferBuilder.vertex(matrix4f, -100.0F, -100.0F, -100.0F).texture(0.0F, 0.0F).color(customEndSkyColor.r, customEndSkyColor.g, customEndSkyColor.b, 255).next();
bufferBuilder.vertex(matrix4f, -100.0F, -100.0F, 100.0F).texture(0.0F, 16.0F).color(customEndSkyColor.r, customEndSkyColor.g, customEndSkyColor.b, 255).next();
bufferBuilder.vertex(matrix4f, 100.0F, -100.0F, 100.0F).texture(16.0F, 16.0F).color(customEndSkyColor.r, customEndSkyColor.g, customEndSkyColor.b, 255).next();
bufferBuilder.vertex(matrix4f, 100.0F, -100.0F, -100.0F).texture(16.0F, 0.0F).color(customEndSkyColor.r, customEndSkyColor.g, customEndSkyColor.b, 255).next();
}
}
use of net.minecraft.util.math.Matrix4f in project Hypnotic-Client by Hypnotic-Development.
the class RenderUtils method drawFilledBox.
public static void drawFilledBox(MatrixStack matrixStack, Box bb, int color, boolean draw) {
Matrix4f matrix4f = matrixStack.peek().getPositionMatrix();
Color color1 = ColorUtils.getColor(color);
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
if (draw)
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, /*QUADS*/
VertexFormats.POSITION_COLOR);
float minX = (float) bb.minX;
float minY = (float) bb.minY;
float minZ = (float) bb.minZ;
float maxX = (float) bb.maxX;
float maxY = (float) bb.maxY;
float maxZ = (float) bb.maxZ;
bufferBuilder.vertex(matrix4f, minX, minY, minZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, maxX, minY, minZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, maxX, minY, maxZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, minX, minY, maxZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, minX, maxY, minZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, minX, maxY, maxZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, maxX, maxY, maxZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, maxX, maxY, minZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, minX, minY, minZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, minX, maxY, minZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, maxX, maxY, minZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, maxX, minY, minZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, maxX, minY, minZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, maxX, maxY, minZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, maxX, maxY, maxZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, maxX, minY, maxZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, minX, minY, maxZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, maxX, minY, maxZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, maxX, maxY, maxZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, minX, maxY, maxZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, minX, minY, minZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, minX, minY, maxZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, minX, maxY, maxZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
bufferBuilder.vertex(matrix4f, minX, maxY, minZ).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
if (draw) {
bufferBuilder.end();
BufferRenderer.draw(bufferBuilder);
}
}
use of net.minecraft.util.math.Matrix4f in project Hypnotic-Client by Hypnotic-Development.
the class RenderUtils method fill.
public static void fill(MatrixStack matrixStack, double x1, double y1, double x2, double y2, int color) {
Matrix4f matrix = matrixStack.peek().getPositionMatrix();
double j;
if (x1 < x2) {
j = x1;
x1 = x2;
x2 = j;
}
if (y1 < y2) {
j = y1;
y1 = y2;
y2 = j;
}
float f = (float) (color >> 24 & 255) / 255.0F;
float g = (float) (color >> 16 & 255) / 255.0F;
float h = (float) (color >> 8 & 255) / 255.0F;
float k = (float) (color & 255) / 255.0F;
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
RenderSystem.enableBlend();
RenderSystem.disableTexture();
RenderSystem.defaultBlendFunc();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
bufferBuilder.vertex(matrix, (float) x1, (float) y2, 0.0F).color(g, h, k, f).next();
bufferBuilder.vertex(matrix, (float) x2, (float) y2, 0.0F).color(g, h, k, f).next();
bufferBuilder.vertex(matrix, (float) x2, (float) y1, 0.0F).color(g, h, k, f).next();
bufferBuilder.vertex(matrix, (float) x1, (float) y1, 0.0F).color(g, h, k, f).next();
bufferBuilder.end();
BufferRenderer.draw(bufferBuilder);
RenderSystem.enableTexture();
RenderSystem.disableBlend();
}
Aggregations