use of net.minecraft.util.math.Matrix4f in project Hypnotic-Client by Hypnotic-Development.
the class RenderUtils method getRenderPosition.
public static Vec3d getRenderPosition(Vec3d vec3d, MatrixStack matrixStack) {
Matrix4f matrix = matrixStack.peek().getPositionMatrix();
double minX = vec3d.getX() - mc.getEntityRenderDispatcher().camera.getPos().x;
double minY = vec3d.getY() - mc.getEntityRenderDispatcher().camera.getPos().y;
double minZ = vec3d.getZ() - mc.getEntityRenderDispatcher().camera.getPos().z;
Vector4f vector4f = new Vector4f((float) minX, (float) minY, (float) minZ, 1.f);
vector4f.transform(matrix);
return new Vec3d(vector4f.getX(), vector4f.getY(), vector4f.getZ());
}
use of net.minecraft.util.math.Matrix4f in project Hypnotic-Client by Hypnotic-Development.
the class RenderUtils method renderRoundedQuad.
// Taken from Coffee client (https://github.com/business-goose/Coffee/tree/master)
// My rounded stuff looked retarded
public static void renderRoundedQuad(MatrixStack matrices, Color c, double fromX, double fromY, double toX, double toY, double rad, double samples) {
int color = c.getRGB();
Matrix4f matrix = matrices.peek().getPositionMatrix();
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;
RenderSystem.enableBlend();
RenderSystem.disableTexture();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
renderRoundedQuadInternal(matrix, g, h, k, f, fromX, fromY, toX, toY, rad, samples);
RenderSystem.enableTexture();
RenderSystem.disableBlend();
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
}
use of net.minecraft.util.math.Matrix4f 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.util.math.Matrix4f in project Hypnotic-Client by Hypnotic-Development.
the class Vertexer method vertexLine.
public static void vertexLine(MatrixStack matrices, VertexConsumer vertexConsumer, float x1, float y1, float z1, float x2, float y2, float z2, LineColor lineColor) {
Matrix4f model = matrices.peek().getPositionMatrix();
Matrix3f normal = matrices.peek().getNormalMatrix();
Vec3f normalVec = getNormal(normal, x1, y1, z1, x2, y2, z2);
int[] color1 = lineColor.getColor(x1, y1, z1, 0);
int[] color2 = lineColor.getColor(x2, y2, z2, 1);
vertexConsumer.vertex(model, x1, y1, z1).color(color1[0], color1[1], color1[2], color1[3]).normal(normal, normalVec.getX(), normalVec.getY(), normalVec.getZ()).next();
vertexConsumer.vertex(model, x2, y2, z2).color(color2[0], color2[1], color2[2], color2[3]).normal(normal, normalVec.getX(), normalVec.getY(), normalVec.getZ()).next();
}
use of net.minecraft.util.math.Matrix4f 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();
}
Aggregations