Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void drawLine(Vec3d start, Vec3d end, int red, int green, int blue, int alpha, float width, float partialTick)
- {
- Vec3d camera = Minecraft.getMinecraft().player.getPositionEyes(partialTick);
- Vec3d direction = end.subtract(start).normalize();
- Vec3d startUp = direction.crossProduct(start.subtract(camera)).normalize().scale(0.0625);
- Vec3d endUp = direction.crossProduct(end.subtract(camera)).normalize().scale(0.0625);
- Tessellator tessellator = Tessellator.getInstance();
- BufferBuilder buffer = tessellator.getBuffer();
- // Enable bit ?
- GlStateManager.pushMatrix();
- GlStateManager.disableCull(); // Cullface
- GlStateManager.enableBlend();
- GlStateManager.depthMask(false);
- GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
- buffer.pos(start.x + startUp.x, start.y + startUp.y, start.z + startUp.z).color(red, green, blue, alpha).endVertex();
- buffer.pos(start.x - startUp.x, start.y - startUp.y, start.z - startUp.z).color(red, green, blue, alpha).endVertex();
- buffer.pos(end.x - endUp.x, end.y - endUp.y, end.z - endUp.z).color(red, green, blue, alpha).endVertex();
- buffer.pos(end.x + endUp.x, end.y + endUp.y, end.z + endUp.z).color(red, green, blue, alpha).endVertex();
- tessellator.draw();
- GlStateManager.depthMask(true);
- GlStateManager.disableBlend(); // Cullface
- GlStateManager.enableCull(); // Blend
- GlStateManager.popMatrix();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement