Remove tessellator to buffer (#123)

* Update buildscript
* Swap out uploading a tesselator and tesselatorToBuffer with a Capturing Tesselator
This commit is contained in:
Jason Mitchell authored and GitHub committed 2024-01-03 13:22:52 -08:00
1 parent 0460f6dbcd
commit c19c812c10
7 files changed
+88 -79

No files matched your search

@@ -46,6 +46,9 @@ public class IrisRenderSystem {
Iris.logger.info("ARB_direct_state_access detected, enabling DSA.");
}
} catch (NoSuchFieldError ignored) {}
if (dsaState == null) {
dsaState = new DSAUnsupported();
}
try {
hasMultibind |= Iris.capabilities.GL_ARB_multi_bind;
@@ -1,12 +1,17 @@
package net.coderbot.iris.pipeline;
import com.gtnewhorizons.angelica.client.renderer.CapturingTessellator;
import com.gtnewhorizons.angelica.compat.mojang.VertexBuffer;
import com.gtnewhorizons.angelica.compat.mojang.DefaultVertexFormat;
import com.gtnewhorizons.angelica.compat.nd.Quad;
import com.gtnewhorizons.angelica.glsm.TessellatorManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import org.lwjgl.opengl.GL11;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.util.List;
/**
* Renders the sky horizon. Vanilla Minecraft simply uses the "clear color" for its horizon, and then draws a plane
@@ -52,15 +57,18 @@ public class HorizonRenderer {
if (this.vertexBuffer != null) {
this.vertexBuffer.close();
}
final Tessellator tessellator = Tessellator.instance;
TessellatorManager.startCapturing();
final CapturingTessellator tessellator = (CapturingTessellator) TessellatorManager.get();
// Build the horizon quads into a buffer
tessellator.startDrawingQuads(); //(GL11.GL_QUADS, DefaultVertexFormat.POSITION);
buildHorizon(currentRenderDistance * 16, tessellator);
List<Quad> quads = TessellatorManager.stopCapturing();
final ByteBuffer byteBuffer = CapturingTessellator.quadsToBuffer(quads, DefaultVertexFormat.POSITION);
this.vertexBuffer = new VertexBuffer();
this.vertexBuffer.bind();
this.vertexBuffer.upload(tessellator, DefaultVertexFormat.POSITION);
this.vertexBuffer.upload(byteBuffer, quads.size() * 4);
this.vertexBuffer.unbind();
}