Add renderGoalIgnoreDepth setting

This commit is contained in:
Brady 2018-10-08 17:06:41 -05:00
parent 69762bf4b4
commit 10bb177664
No known key found for this signature in database
GPG Key ID: 73A788379A197567
2 changed files with 23 additions and 19 deletions

View File

@ -302,6 +302,11 @@ public class Settings {
*/
public Setting<Boolean> renderGoal = new Setting<>(true);
/**
* Ignore depth when rendering the goal
*/
public Setting<Boolean> renderGoalIgnoreDepth = new Setting<>(false);
/**
* Line width of the path when rendered, in pixels
*/

View File

@ -232,26 +232,12 @@ public final class PathRenderer implements Helper {
GlStateManager.glLineWidth(Baritone.settings().goalRenderLineWidthPixels.get());
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
if (y1 != 0) {
BUFFER.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION);
BUFFER.pos(minX, y1, minZ).endVertex();
BUFFER.pos(maxX, y1, minZ).endVertex();
BUFFER.pos(maxX, y1, maxZ).endVertex();
BUFFER.pos(minX, y1, maxZ).endVertex();
BUFFER.pos(minX, y1, minZ).endVertex();
TESSELLATOR.draw();
if (Baritone.settings().renderGoalIgnoreDepth.get()) {
GlStateManager.disableDepth();
}
if (y2 != 0) {
BUFFER.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION);
BUFFER.pos(minX, y2, minZ).endVertex();
BUFFER.pos(maxX, y2, minZ).endVertex();
BUFFER.pos(maxX, y2, maxZ).endVertex();
BUFFER.pos(minX, y2, maxZ).endVertex();
BUFFER.pos(minX, y2, minZ).endVertex();
TESSELLATOR.draw();
}
renderHorizontalQuad(minX, maxX, minZ, maxZ, y1);
renderHorizontalQuad(minX, maxX, minZ, maxZ, y2);
BUFFER.begin(GL_LINES, DefaultVertexFormats.POSITION);
BUFFER.pos(minX, minY, minZ).endVertex();
@ -264,9 +250,22 @@ public final class PathRenderer implements Helper {
BUFFER.pos(minX, maxY, maxZ).endVertex();
TESSELLATOR.draw();
if (Baritone.settings().renderGoalIgnoreDepth.get()) {
GlStateManager.enableDepth();
}
GlStateManager.depthMask(true);
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
private static void renderHorizontalQuad(double minX, double maxX, double minZ, double maxZ, double y) {
if (y != 0) {
BUFFER.begin(GL_LINE_LOOP, DefaultVertexFormats.POSITION);
BUFFER.pos(minX, y, minZ).endVertex();
BUFFER.pos(maxX, y, minZ).endVertex();
BUFFER.pos(maxX, y, maxZ).endVertex();
BUFFER.pos(minX, y, maxZ).endVertex();
TESSELLATOR.draw();
}
}
}