mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Fixed crash when rendering level markers in the hud
This commit is contained in:
parent
0e49cda1cc
commit
6594e30d18
1 changed files with 10 additions and 6 deletions
|
@ -106,16 +106,14 @@ public interface DrawableUtil {
|
|||
|
||||
final double maxAngle = MathHelper.clamp(startAngle + arcAngle, 0, TAU - INCREMENT);
|
||||
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
|
||||
Matrix4f model = matrices.peek().getPositionMatrix();
|
||||
|
||||
BufferBuilder bufferBuilder = Tessellator.getInstance().begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
|
||||
|
||||
boolean shouldDraw = false;
|
||||
|
||||
for (double angle = -startAngle; angle >= -maxAngle; angle -= INCREMENT) {
|
||||
shouldDraw = true;
|
||||
// center
|
||||
cylendricalVertex(bufferBuilder, model, innerRadius, angle, r, g, b, k);
|
||||
// point one
|
||||
|
@ -126,7 +124,13 @@ public interface DrawableUtil {
|
|||
cylendricalVertex(bufferBuilder, model, innerRadius, angle + INCREMENT, r, g, b, k);
|
||||
}
|
||||
|
||||
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
||||
if (shouldDraw) {
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
||||
}
|
||||
}
|
||||
|
||||
private static void cylendricalVertex(BufferBuilder bufferBuilder, Matrix4f model, double radius, double angle, float r, float g, float b, float k) {
|
||||
|
|
Loading…
Reference in a new issue