mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-27 15:43:02 +00:00
Add VAO's (#1126)
This commit is contained in:
1 parent
8bec433699
commit
a8107f97e8
8 files changed
+24
-26
No files matched your search
@@ -47,6 +47,11 @@ public class AngelicaConfig {
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean enableVBOClouds;
|
||||
|
||||
@Config.Comment("Uses cached attributes for VBO rendering, resulting in less CPU overhead. Disable if you notice any graphical issues.")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean enableVAO;
|
||||
|
||||
@Config.Comment("Enable NotFine features")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.gtnewhorizon.gtnhlib.client.renderer.CapturingTessellator;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.TessellatorManager;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.postprocessing.CustomFramebuffer;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.postprocessing.SharedDepthFramebuffer;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vao.VertexArrayBuffer;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vbo.VertexBuffer;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vertex.DefaultVertexFormat;
|
||||
import com.gtnewhorizons.angelica.compat.ModStatus;
|
||||
@@ -178,10 +179,7 @@ public class HUDCaching {
|
||||
if (quadWidth != width || quadHeight != height) {
|
||||
quadWidth = width;
|
||||
quadHeight = height;
|
||||
if (quadVAO != null) {
|
||||
quadVAO.close();
|
||||
}
|
||||
quadVAO = rebuildVAO(width, height);
|
||||
rebuildVAO(width, height);
|
||||
}
|
||||
GLStateManager.disableDepthTest();
|
||||
GLStateManager.enableTexture();
|
||||
@@ -190,7 +188,7 @@ public class HUDCaching {
|
||||
}
|
||||
|
||||
|
||||
private static VertexBuffer rebuildVAO(float width, float height) {
|
||||
private static void rebuildVAO(float width, float height) {
|
||||
final CapturingTessellator tessellator = TessellatorManager.startCapturingAndGet();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(0, height, 0.0, 0, 0);
|
||||
@@ -198,7 +196,7 @@ public class HUDCaching {
|
||||
tessellator.addVertexWithUV(width, 0, 0.0, 1, 1);
|
||||
tessellator.addVertexWithUV(0, 0, 0.0, 0, 1);
|
||||
tessellator.draw();
|
||||
return TessellatorManager.stopCapturingToVAO(DefaultVertexFormat.POSITION_TEXTURE);
|
||||
quadVAO = TessellatorManager.stopCapturingToVAO(quadVAO, DefaultVertexFormat.POSITION_TEXTURE);
|
||||
}
|
||||
|
||||
public static void disableHoloInventory() {
|
||||
|
||||
@@ -5,6 +5,7 @@ import static com.gtnewhorizons.angelica.loading.AngelicaTweaker.LOGGER;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.gtnewhorizon.gtnhlib.client.model.loading.ModelRegistry;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vao.VAOManager;
|
||||
import com.gtnewhorizons.angelica.compat.ModStatus;
|
||||
import com.gtnewhorizons.angelica.compat.bettercrashes.BetterCrashesCompat;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
@@ -111,6 +112,9 @@ public class ClientProxy extends CommonProxy {
|
||||
FMLCommonHandler.instance().bus().register(Iris.INSTANCE);
|
||||
MinecraftForge.EVENT_BUS.register(Iris.INSTANCE);
|
||||
}
|
||||
if (!AngelicaConfig.enableVAO) {
|
||||
VAOManager.disableVao();
|
||||
}
|
||||
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
@@ -218,12 +218,11 @@ public class CloudRenderer implements IResourceManagerReloadListener {
|
||||
}
|
||||
|
||||
private void build() {
|
||||
TessellatorManager.startCapturing();
|
||||
CapturingTessellator tess = (CapturingTessellator) TessellatorManager.get();
|
||||
CapturingTessellator tess = TessellatorManager.startCapturingAndGet();
|
||||
|
||||
vertices(tess);
|
||||
|
||||
this.vbo = TessellatorManager.stopCapturingToVBO(FORMAT);
|
||||
this.vbo = TessellatorManager.stopCapturingToVAO(FORMAT);
|
||||
}
|
||||
|
||||
private int fullCoord(double coord, int scale) { // Corrects misalignment of UV offset when on negative coords.
|
||||
|
||||
@@ -27,6 +27,7 @@ package com.gtnewhorizons.angelica.rendering;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.CapturingTessellator;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.TessellatorManager;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vao.VAOManager;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vbo.VertexBuffer;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vertex.DefaultVertexFormat;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
@@ -126,7 +127,7 @@ public class ItemRenderListManager {
|
||||
private int expiry;
|
||||
|
||||
public CachedVBO() {
|
||||
this.vertexBuffer = new VertexBuffer(DefaultVertexFormat.POSITION_TEXTURE_NORMAL, GL11.GL_QUADS);
|
||||
this.vertexBuffer = VAOManager.createVAO(DefaultVertexFormat.POSITION_TEXTURE_NORMAL, GL11.GL_QUADS);
|
||||
}
|
||||
|
||||
private void render(int elapsedTicks) {
|
||||
|
||||
Reference in new issue
Block a user