1 package com.irtimaled.bbor.client.renderers;
3 import com.irtimaled.bbor.client.config.ConfigManager;
4 import com.mojang.blaze3d.systems.RenderSystem;
5 import net.minecraft.client.MinecraftClient;
6 import net.minecraft.client.render.GameRenderer;
7 import net.minecraft.util.Identifier;
8 import org.lwjgl.opengl.GL11;
10 public class RenderHelper {
11 public static final int QUADS = GL11.GL_QUADS;
12 public static final int LINES = GL11.GL_LINES;
13 public static final int LINE_LOOP = GL11.GL_LINE_LOOP;
14 public static final int POINTS = GL11.GL_POINTS;
16 //public static final VertexFormat.DrawMode CUSTOM = ReflectionHelper.getPrivateInstanceBuilder(VertexFormat.DrawMode.class,)
17 public static void beforeRender() {
19 RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
22 RenderSystem.disableCull();
25 if (ConfigManager.alwaysVisible.get()) {
26 RenderSystem.clear(GL11.GL_DEPTH_BUFFER_BIT, MinecraftClient.IS_SYSTEM_MAC);
30 public static void setTexture(Identifier texture) {
31 RenderSystem.setShader(GameRenderer::getPositionTexColorShader);
32 RenderSystem.setShaderTexture(0, texture);
35 public static void resetShader() {
36 RenderSystem.setShader(GameRenderer::getPositionColorShader);
39 public static void afterRender() {
41 RenderSystem.enableCull();
45 public static void beforeRenderFont(OffsetPoint offsetPoint) {
46 // RenderSystem.pushMatrix();
48 //RenderSystem.translated(offsetPoint.getX(), offsetPoint.getY() + 0.002D, offsetPoint.getZ());
49 //RenderSystem.normal3f(0.0F, 1.0F, 0.0F);
50 //RenderSystem.rotatef(0.0F, 0.0F, 1.0F, 0.0F);
51 //RenderSystem.rotatef(90.0F, 1.0F, 0.0F, 0.0F);
52 //RenderSystem.scalef(-0.0175F, -0.0175F, 0.0175F);
55 RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
60 public static void afterRenderFont() {
63 //RenderSystem.popMatrix();
67 public static void disableLighting() {
68 //RenderSystem.disableLighting();
71 public static void disableDepthTest() {
72 RenderSystem.disableDepthTest();
75 public static void enableDepthTest() {
76 RenderSystem.enableDepthTest();
79 public static void disableBlend() {
80 RenderSystem.disableBlend();
83 public static void enableBlend() {
84 RenderSystem.enableBlend();
87 public static void disableAlphaTest() {
88 //RenderSystem.disableAlphaTest();
91 public static void enableAlphaTest() {
92 //RenderSystem.enableAlphaTest();
95 public static void disableTexture() {
96 RenderSystem.disableTexture();
99 public static void enableTexture() {
100 RenderSystem.enableTexture();
103 public static void shadeModelSmooth() {
104 //RenderSystem.shadeModel(GL11.GL_SMOOTH);
107 public static void shadeModelFlat() {
108 //RenderSystem.shadeModel(GL11.GL_FLAT);
111 public static void enablePointSmooth() {
112 GL11.glEnable(GL11.GL_POINT_SMOOTH);
115 public static void lineWidth2() {
116 RenderSystem.lineWidth(2f);
119 public static void polygonModeLine() {
120 RenderSystem.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
123 public static void polygonModeFill() {
124 RenderSystem.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
127 public static void polygonOffsetMinusOne() {
128 RenderSystem.polygonOffset(-1.f, -1.f);
131 public static void enablePolygonOffsetLine() {
132 //RenderSystem.enableLineOffset();
135 public static void depthMaskTrue() {
136 RenderSystem.depthMask(true);
139 public static void pointSize5() {
143 public static void blendFuncGui() {
144 RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ZERO, GL11.GL_ONE);
147 public static void depthFuncAlways() {
148 RenderSystem.depthFunc(GL11.GL_ALWAYS);
151 public static void depthFuncLessEqual() {
152 RenderSystem.depthFunc(GL11.GL_LEQUAL);