Skip to content

Commit

Permalink
Simplify depth test management and document it in ESP_LINES RenderLayer
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Feb 16, 2025
1 parent af6bc84 commit c82492d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 7 additions & 0 deletions src/main/java/net/wurstclient/WurstRenderLayers.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ public enum WurstRenderLayers
/**
* Similar to {@link RenderLayer#getLines()}, but with line width 2 and no
* depth test.
*
* @apiNote As of 25w07a (1.21.5), turning off depth test still has to be
* done manually, by calling
* {@code RenderSystem.depthFunc(GlConst.GL_ALWAYS);} before
* drawing the ESP lines. Without this code, ESP lines will be
* drawn with depth test set to LEQUALS (only visible if not
* obstructed).
*/
public static final RenderLayer.MultiPhase ESP_LINES =
RenderLayer.of("wurst:esp_lines", VertexFormats.LINES,
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/net/wurstclient/hacks/MobEspHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ public void onCameraTransformViewBobbing(
@Override
public void onRender(MatrixStack matrixStack, float partialTicks)
{
// GL settings
RenderSystem.enableDepthTest();
RenderSystem.depthFunc(GlConst.GL_ALWAYS);

VertexConsumerProvider.Immediate vcp =
Expand All @@ -149,9 +147,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks)
matrixStack.pop();

vcp.draw(WurstRenderLayers.ESP_LINES);

// GL resets
RenderSystem.disableDepthTest();
}

private void renderBoxes(MatrixStack matrixStack,
Expand Down

0 comments on commit c82492d

Please sign in to comment.