Java Code Examples for org.lwjgl.opengl.GL11#glLineWidth()

The following examples show how to use org.lwjgl.opengl.GL11#glLineWidth() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ItemEspHack.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onRender(float partialTicks)
{
	// GL settings
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_LIGHTING);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	
	renderBoxes(partialTicks);
	
	if(style.getSelected().lines)
		renderTracers(partialTicks);
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example 2
Source File: RenderUtils.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
public static void drawLine(double x1,double y1,double z1,double x2,double y2,double z2, float r, float g, float b, float t) {
	gl11Setup();
	GL11.glLineWidth(t);
       
	Vec3d ren = renderPos();
       
       Tessellator tessellator = Tessellator.getInstance();
       BufferBuilder buffer = tessellator.getBufferBuilder();
       buffer.begin(3, VertexFormats.POSITION_COLOR);
       buffer.vertex(x1 - ren.x, y1 - ren.y, z1 - ren.z).color(r, g, b, 0.0F).next();
       buffer.vertex(x1 - ren.x, y1 - ren.y, z1 - ren.z).color(r, g, b, 1.0F).next();
       buffer.vertex(x2 - ren.x, y2 - ren.y, z2 - ren.z).color(r, g, b, 1.0F).next();
       tessellator.draw();
       
	gl11Cleanup();
       
}
 
Example 3
Source File: ItemESP.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
private void renderDebugBoundingBox(Entity p_85094_1_, double p_85094_2_, double p_85094_4_, double p_85094_6_, float p_85094_8_, float p_85094_9_) {
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);
    float f2 = p_85094_1_.width / 2.0F;
    AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(p_85094_2_ - f2, p_85094_4_, p_85094_6_ - f2, p_85094_2_ + f2, p_85094_4_ + p_85094_1_.height, p_85094_6_ + f2);
    GL11.glLineWidth(1f);
    RenderGlobal.drawOutlinedBoundingBox(axisalignedbb, 16777215);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
}
 
Example 4
Source File: RenderUtil.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
public static void drawTriangle(float x, float y, float size, float theta, int color) {
    GL11.glTranslated(x, y, 0);
    GL11.glRotatef(180 + theta, 0F, 0F, 1.0F);

    float alpha = (float) (color >> 24 & 255) / 255.0F;
    float red = (float) (color >> 16 & 255) / 255.0F;
    float green = (float) (color >> 8 & 255) / 255.0F;
    float blue = (float) (color & 255) / 255.0F;

    GL11.glColor4f(red, green, blue, alpha);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glBlendFunc(770, 771);
    GL11.glLineWidth(1);
    GL11.glBegin(GL11.GL_TRIANGLE_FAN);

    GL11.glVertex2d(0, (1.0F * size));
    GL11.glVertex2d((1 * size), -(1.0F * size));
    GL11.glVertex2d(-(1 * size), -(1.0F * size));

    GL11.glEnd();
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glRotatef(-180 - theta, 0F, 0F, 1.0F);
    GL11.glTranslated(-x, -y, 0);
}
 
Example 5
Source File: PGData5.java    From ldparteditor with MIT License 5 votes vote down vote up
@Override
public void drawBFCprimitive_GL33(GLMatrixStack stack, int drawOnlyMode) {
    if (drawOnlyMode == 1) return;
    GL11.glLineWidth(1f);
    edgeData[3] = View.primitive_condline_Colour_r[0];
    edgeData[4] = View.primitive_condline_Colour_g[0]; 
    edgeData[5] = View.primitive_condline_Colour_b[0];
    edgeData[9] = edgeData[3];
    edgeData[10] = edgeData[4]; 
    edgeData[11] = edgeData[5];
    GL33HelperPrimitives.drawLinesRGB_Line(edgeData);
}
 
Example 6
Source File: TrajectoriesHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRender(float partialTicks)
{
	GL11.glPushMatrix();
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	GL11.glDepthMask(false);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_LIGHTING);
	
	RenderUtils.applyCameraRotationOnly();
	
	ArrayList<Vec3d> path = getPath(partialTicks);
	Vec3d camPos = RenderUtils.getCameraPos();
	
	drawLine(path, camPos);
	
	if(!path.isEmpty())
	{
		Vec3d end = path.get(path.size() - 1);
		drawEndOfLine(end, camPos);
	}
	
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glDepthMask(true);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
	GL11.glPopMatrix();
}
 
Example 7
Source File: CustomCrosshair.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void drawDebugAxisCrosshair(int screenWidth, int screenHeight) {
    GlStateManager.pushMatrix();
    GlStateManager.translate((float) screenWidth, (float) screenHeight, 0.0f);
    Entity entity = mc.getRenderViewEntity();
    GlStateManager.rotate(
        entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * 1.0f,
        -1.0f, 0.0f, 0.0f);
    GlStateManager
        .rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * 1.0f,
            0.0f, 1.0f, 0.0f);
    GlStateManager.scale(-1.0f, -1.0f, -1.0f);
    GlStateManager.disableTexture2D();
    GlStateManager.depthMask(false);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    worldrenderer.begin(GL11.GL_CLIENT_PIXEL_STORE_BIT, DefaultVertexFormats.POSITION_COLOR);
    GL11.glLineWidth(2.0f);
    worldrenderer.pos(0.0, 0.0, 0.0).color(255, 0, 0, 255).endVertex();
    worldrenderer.pos(10.0, 0.0, 0.0).color(255, 0, 0, 255).endVertex();
    worldrenderer.pos(0.0, 0.0, 0.0).color(0, 255, 0, 255).endVertex();
    worldrenderer.pos(0.0, 10.0, 0.0).color(0, 255, 0, 255).endVertex();
    worldrenderer.pos(0.0, 0.0, 0.0).color(0, 0, 255, 255).endVertex();
    worldrenderer.pos(0.0, 0.0, 10.0).color(0, 0, 255, 255).endVertex();
    tessellator.draw();
    GL11.glLineWidth(1.0f);
    GlStateManager.depthMask(true);
    GlStateManager.enableTexture2D();
    GlStateManager.popMatrix();
}
 
Example 8
Source File: SearchHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRender(float partialTicks)
{
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	GL11.glDisable(GL11.GL_LIGHTING);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	
	// generate rainbow color
	float x = System.currentTimeMillis() % 2000 / 1000F;
	float red = 0.5F + 0.5F * MathHelper.sin(x * (float)Math.PI);
	float green =
		0.5F + 0.5F * MathHelper.sin((x + 4F / 3F) * (float)Math.PI);
	float blue =
		0.5F + 0.5F * MathHelper.sin((x + 8F / 3F) * (float)Math.PI);
	
	GL11.glColor4f(red, green, blue, 0.5F);
	GL11.glBegin(GL11.GL_QUADS);
	GL11.glCallList(displayList);
	GL11.glEnd();
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example 9
Source File: RenderUtils.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void drawBorderedRect(float x, float y, float x2, float y2, float l1, int col1, int col2) {
    drawRect(x, y, x2, y2, col2);
    float f = (col1 >> 24 & 0xFF) / 255.0F;
    float f2 = (col1 >> 16 & 0xFF) / 255.0F;
    float f3 = (col1 >> 8 & 0xFF) / 255.0F;
    float f4 = (col1 & 0xFF) / 255.0F;
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glPushMatrix();
    GlStateManager.color(f2, f3, f4, f);
    GL11.glLineWidth(l1);
    GL11.glBegin(1);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glEnd();
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example 10
Source File: SurfaceHelper.java    From ForgeHax with MIT License 5 votes vote down vote up
public static void drawLine(int x1, int y1, int x2, int y2, int color, float width) {
  float r = (float) (color >> 16 & 255) / 255.0F;
  float g = (float) (color >> 8 & 255) / 255.0F;
  float b = (float) (color & 255) / 255.0F;
  float a = (float) (color >> 24 & 255) / 255.0F;
  Tessellator tessellator = Tessellator.getInstance();
  BufferBuilder BufferBuilder = tessellator.getBuffer();
  
  GlStateManager.enableBlend();
  GlStateManager.disableTexture2D();
  GlStateManager.tryBlendFuncSeparate(
      GlStateManager.SourceFactor.SRC_ALPHA,
      GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA,
      GlStateManager.SourceFactor.ONE,
      GlStateManager.DestFactor.ZERO);
  GlStateManager.color(r, g, b, a);
  
  GL11.glLineWidth(width);
  
  BufferBuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
  BufferBuilder.pos(x1, y1, 0.0D).endVertex();
  BufferBuilder.pos(x2, y2, 0.0D).endVertex();
  tessellator.draw();
  
  GlStateManager.color(1f, 1f, 1f);
  GlStateManager.enableTexture2D();
  GlStateManager.disableBlend();
}
 
Example 11
Source File: PGData5.java    From ldparteditor with MIT License 5 votes vote down vote up
@Override
public void drawBFCprimitive_GL20(int drawOnlyMode) {
    if (drawOnlyMode == 1) return;
    // GL11.glLineWidth(View.lineWidthGL[0]);
    GL11.glLineWidth(1f);
    GL11.glColor4f(View.primitive_condline_Colour_r[0], View.primitive_condline_Colour_g[0], View.primitive_condline_Colour_b[0], 1f);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex3f(x1, y1, z1);
    GL11.glVertex3f(x2, y2, z2);
    GL11.glEnd();
}
 
Example 12
Source File: BuildRandomHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRender(float partialTicks)
{
	if(lastPos == null)
		return;
	
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	GL11.glDisable(GL11.GL_LIGHTING);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	
	// set position
	GL11.glTranslated(lastPos.getX(), lastPos.getY(), lastPos.getZ());
	
	// get color
	float red = partialTicks * 2F;
	float green = 2 - red;
	
	// draw box
	GL11.glColor4f(red, green, 0, 0.25F);
	RenderUtils.drawSolidBox();
	GL11.glColor4f(red, green, 0, 0.5F);
	RenderUtils.drawOutlinedBox();
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example 13
Source File: PGData2.java    From ldparteditor with MIT License 5 votes vote down vote up
@Override
public void drawBFCprimitive_GL20(int drawOnlyMode) {
    if (drawOnlyMode == 1) return;
    // GL11.glLineWidth(View.lineWidthGL[0]);
    GL11.glLineWidth(1f);
    GL11.glColor4f(View.primitive_edge_Colour_r[0], View.primitive_edge_Colour_g[0], View.primitive_edge_Colour_b[0], 1f);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex3f(x1, y1, z1);
    GL11.glVertex3f(x2, y2, z2);
    GL11.glEnd();
}
 
Example 14
Source File: BowAimbotHack.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onRender(float partialTicks)
{
	if(target == null)
		return;
	
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	GL11.glDisable(GL11.GL_LIGHTING);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	
	// set position
	GL11.glTranslated(target.getX(), target.getY(), target.getZ());
	
	// set size
	double boxWidth = target.getWidth() + 0.1;
	double boxHeight = target.getHeight() + 0.1;
	GL11.glScaled(boxWidth, boxHeight, boxWidth);
	
	// move to center
	GL11.glTranslated(0, 0.5, 0);
	
	double v = 1 / velocity;
	GL11.glScaled(v, v, v);
	
	// draw outline
	GL11.glColor4d(1, 0, 0, 0.5F * velocity);
	RenderUtils.drawOutlinedBox(TARGET_BOX);
	
	// draw box
	GL11.glColor4d(1, 0, 0, 0.25F * velocity);
	RenderUtils.drawSolidBox(TARGET_BOX);
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example 15
Source File: ClientProxy.java    From NBTEdit with GNU General Public License v3.0 4 votes vote down vote up
private void drawBoundingBox(RenderGlobal r, float f, AxisAlignedBB aabb) {
	if (aabb == null)
		return;

	EntityLivingBase player = Minecraft.getMinecraft().renderViewEntity;

	double var8 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)f;
	double var10 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)f;
	double var12 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)f;

	aabb = aabb.getOffsetBoundingBox(-var8, -var10, -var12);

	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glColor4f(1.0F, 0.0F, 0.0F, .5F);
	GL11.glLineWidth(3.5F);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDepthMask(false);

	Tessellator var2 = Tessellator.instance;

	var2.startDrawing(3);
	var2.addVertex(aabb.minX, aabb.minY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.minY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.minY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.minY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.minY, aabb.minZ);
	var2.draw();
	var2.startDrawing(3);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.maxY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.maxY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.minZ);
	var2.draw();
	var2.startDrawing(1);
	var2.addVertex(aabb.minX, aabb.minY, aabb.minZ);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.minY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.maxY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.minY, aabb.maxZ);
	var2.addVertex(aabb.maxX, aabb.maxY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.minY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.maxZ);
	var2.draw();

	GL11.glDepthMask(true);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);

}
 
Example 16
Source File: OverlayHack.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onRender(float partialTicks)
{
	if(MC.crosshairTarget == null
		|| MC.crosshairTarget.getType() != HitResult.Type.BLOCK)
		return;
	
	BlockHitResult blockHitResult = (BlockHitResult)MC.crosshairTarget;
	BlockPos pos = new BlockPos(blockHitResult.getBlockPos());
	
	// check if hitting block
	if(!MC.interactionManager.isBreakingBlock())
		return;
	
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	GL11.glDisable(GL11.GL_LIGHTING);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	
	// set position
	GL11.glTranslated(pos.getX(), pos.getY(), pos.getZ());
	
	// get progress
	float progress =
		IMC.getInteractionManager().getCurrentBreakingProgress();
	
	// set size
	GL11.glTranslated(0.5, 0.5, 0.5);
	GL11.glScaled(progress, progress, progress);
	GL11.glTranslated(-0.5, -0.5, -0.5);
	
	// get color
	float red = progress * 2F;
	float green = 2 - red;
	
	// draw box
	GL11.glColor4f(red, green, 0, 0.25F);
	RenderUtils.drawSolidBox();
	GL11.glColor4f(red, green, 0, 0.5F);
	RenderUtils.drawOutlinedBox();
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example 17
Source File: MixinRenderFish.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Inject(method = "doRender", at = @At("HEAD"))
private void doRender(EntityFishHook entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) {
    GL11.glLineWidth(1.0F);
}
 
Example 18
Source File: GData3.java    From ldparteditor with MIT License 4 votes vote down vote up
public void drawProtractor_GL20(boolean selected, Composite3D c3d, BigDecimal x1c, BigDecimal y1c, BigDecimal z1c, BigDecimal x2c, BigDecimal y2c, BigDecimal z2c, BigDecimal x3c, BigDecimal y3c, BigDecimal z3c) {
    final java.text.DecimalFormat NUMBER_FORMAT2F = new java.text.DecimalFormat(View.NUMBER_FORMAT2F, new DecimalFormatSymbols(MyLanguage.LOCALE));
    final OpenGLRenderer20 renderer = (OpenGLRenderer20) c3d.getRenderer();
    final float zoom = 1f / c3d.getZoom();

    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glLineWidth(View.lineWidthGL[0]);
    if (selected) {
        GL11.glColor4f(View.vertex_selected_Colour_r[0], View.vertex_selected_Colour_g[0], View.vertex_selected_Colour_b[0], 1f);
        GL11.glBegin(GL11.GL_LINES);
        GL11.glVertex3f(x1, y1, z1);
        GL11.glVertex3f(x2, y2, z2);
        GL11.glEnd();
    } else {
        final float s = ((r + g + b) / 3 + .5f) % 1f;
        GL11.glColor4f(s, s, s, 1f);
        GL11.glBegin(GL11.GL_LINES);
        GL11.glVertex3f(x1, y1, z1);
        GL11.glVertex3f(x2, y2, z2);
        GL11.glEnd();
    }
    GL11.glColor4f(r, g, b, 1f);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex3f(x1, y1, z1);
    GL11.glVertex3f(x3, y3, z3);
    GL11.glEnd();

    final Vector4f textOrigin = new Vector4f(x1, y1, z1, 1f);
    Matrix4f.transform(c3d.getRotation(), textOrigin, textOrigin);

    Vector3d va = new Vector3d(x1c, y1c, z1c);
    Vector3d vb = new Vector3d(x2c, y2c, z2c);
    Vector3d vc = new Vector3d(x3c, y3c, z3c);
    vb = Vector3d.sub(va, vb);
    vc = Vector3d.sub(va, vc);
    double angle = Vector3d.angle(vb, vc);
    BigDecimal ang = new BigDecimal(angle);
    String angle_s = NUMBER_FORMAT2F.format(ang) + "°"; //$NON-NLS-1$

    float sx1 = x1 + (x2 - x1) * .2f;
    float sy1 = y1 + (y2 - y1) * .2f;
    float sz1 = z1 + (z2 - z1) * .2f;
    float sx2 = x1 + (x3 - x1) * .2f;
    float sy2 = y1 + (y3 - y1) * .2f;
    float sz2 = z1 + (z3 - z1) * .2f;
    float sx1t = x1 + (x2 - x1) * .25f;
    float sy1t = y1 + (y2 - y1) * .25f;
    float sz1t = z1 + (z2 - z1) * .25f;
    float sx2t = x1 + (x3 - x1) * .25f;
    float sy2t = y1 + (y3 - y1) * .25f;
    float sz2t = z1 + (z3 - z1) * .25f;
    float sx1tt = x1 + (x2 - x1) * .24f;
    float sy1tt = y1 + (y2 - y1) * .24f;
    float sz1tt = z1 + (z2 - z1) * .24f;
    float sx2tt = x1 + (x3 - x1) * .24f;
    float sy2tt = y1 + (y3 - y1) * .24f;
    float sz2tt = z1 + (z3 - z1) * .24f;
    float sx3 = sx1t * .5f + sx2t * .5f;
    float sy3 = sy1t * .5f + sy2t * .5f;
    float sz3 = sz1t * .5f + sz2t * .5f;
    float sx3r = sx1tt * .7f + sx2tt * .3f;
    float sy3r = sy1tt * .7f + sy2tt * .3f;
    float sz3r = sz1tt * .7f + sz2tt * .3f;
    float sx3l = sx1tt * .3f + sx2tt * .7f;
    float sy3l = sy1tt * .3f + sy2tt * .7f;
    float sz3l = sz1tt * .3f + sz2tt * .7f;

    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex3f(sx1, sy1, sz1);
    GL11.glVertex3f(sx3r, sy3r, sz3r);
    GL11.glVertex3f(sx3r, sy3r, sz3r);
    GL11.glVertex3f(sx3, sy3, sz3);
    GL11.glVertex3f(sx3, sy3, sz3);
    GL11.glVertex3f(sx3l, sy3l, sz3l);
    GL11.glVertex3f(sx3l, sy3l, sz3l);
    GL11.glVertex3f(sx2, sy2, sz2);
    GL11.glEnd();

    GL11.glPushMatrix();
    GL11.glMultMatrixf(renderer.getRotationInverse());

    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    PGData3.beginDrawText();
    GL11.glColor4f(r, g, b, 1f);
    drawNumber(angle_s, textOrigin.x, textOrigin.y, textOrigin.z, zoom);
    PGData3.endDrawText();
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_LIGHTING);
}
 
Example 19
Source File: AutoFishHack.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onRender(float partialTicks)
{
	if(!debugDraw.isChecked())
		return;
	
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	GL11.glDisable(GL11.GL_LIGHTING);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	
	FishingBobberEntity bobber = MC.player.fishHook;
	if(bobber != null)
	{
		GL11.glPushMatrix();
		GL11.glTranslated(bobber.getX(), bobber.getY(), bobber.getZ());
		GL11.glCallList(box);
		GL11.glPopMatrix();
	}
	
	if(lastSoundPos != null)
	{
		GL11.glPushMatrix();
		GL11.glTranslated(lastSoundPos.x, lastSoundPos.y, lastSoundPos.z);
		GL11.glCallList(cross);
		GL11.glPopMatrix();
	}
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example 20
Source File: ChestEspHack.java    From ForgeWurst with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event)
{
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	
	GL11.glPushMatrix();
	GL11.glTranslated(-TileEntityRendererDispatcher.staticPlayerX,
		-TileEntityRendererDispatcher.staticPlayerY,
		-TileEntityRendererDispatcher.staticPlayerZ);
	
	// minecart interpolation
	double partialTicks = event.getPartialTicks();
	ArrayList<AxisAlignedBB> minecartBoxes =
		new ArrayList<>(minecarts.size());
	minecarts.forEach(e -> {
		double offsetX = -(e.posX - e.lastTickPosX)
			+ (e.posX - e.lastTickPosX) * partialTicks;
		double offsetY = -(e.posY - e.lastTickPosY)
			+ (e.posY - e.lastTickPosY) * partialTicks;
		double offsetZ = -(e.posZ - e.lastTickPosZ)
			+ (e.posZ - e.lastTickPosZ) * partialTicks;
		minecartBoxes.add(
			e.getRenderBoundingBox().offset(offsetX, offsetY, offsetZ));
	});
	
	if(style.getSelected().boxes)
	{
		GL11.glCallList(normalChests);
		renderBoxes(minecartBoxes, greenBox);
	}
	
	if(style.getSelected().lines)
	{
		Vec3d start = RotationUtils.getClientLookVec()
			.addVector(0, WMinecraft.getPlayer().getEyeHeight(), 0)
			.addVector(TileEntityRendererDispatcher.staticPlayerX,
				TileEntityRendererDispatcher.staticPlayerY,
				TileEntityRendererDispatcher.staticPlayerZ);
		
		GL11.glBegin(GL11.GL_LINES);
		
		GL11.glColor4f(0, 1, 0, 0.5F);
		renderLines(start, basicChests);
		renderLines(start, minecartBoxes);
		
		GL11.glColor4f(1, 0.5F, 0, 0.5F);
		renderLines(start, trappedChests);
		
		GL11.glColor4f(0, 1, 1, 0.5F);
		renderLines(start, enderChests);
		
		GL11.glEnd();
	}
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}