mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-21 21:02:15 +00:00
DisplayList -> VBO for stars, skies, and ModelRenderer (#129)
This commit is contained in:
1 parent
a8ccc8903a
commit
c58870fdeb
15 files changed
+266
-76
No files matched your search
@@ -1,17 +1,14 @@
|
||||
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.compat.mojang.VertexBuffer;
|
||||
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
|
||||
@@ -63,13 +60,8 @@ public class HorizonRenderer {
|
||||
// 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(byteBuffer, quads.size() * 4);
|
||||
this.vertexBuffer.unbind();
|
||||
this.vertexBuffer = TessellatorManager.stopCapturingToVBO(DefaultVertexFormat.POSITION);
|
||||
}
|
||||
|
||||
private void buildQuad(Tessellator consumer, double x1, double z1, double x2, double z2) {
|
||||
|
||||
@@ -55,21 +55,6 @@ public final class MatrixUniforms {
|
||||
}
|
||||
}
|
||||
|
||||
private static class InvertedArrayMatrix implements Supplier<Matrix4f> {
|
||||
private final Supplier<float[]> parent;
|
||||
|
||||
InvertedArrayMatrix(Supplier<float[]> parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Matrix4f get() {
|
||||
final Matrix4f matrix4f = new Matrix4f().set(parent.get());
|
||||
matrix4f.invert();
|
||||
|
||||
return matrix4f;
|
||||
}
|
||||
}
|
||||
|
||||
private static class Previous implements Supplier<Matrix4f> {
|
||||
private final Supplier<Matrix4f> parent;
|
||||
|
||||
@@ -9,15 +9,11 @@ public class BuiltinReplacementUniforms {
|
||||
private static final Matrix4f lightmapTextureMatrix;
|
||||
|
||||
static {
|
||||
// This mimics the transformations done in LightmapTextureManager to the GL_TEXTURE matrix.
|
||||
lightmapTextureMatrix = new Matrix4f();
|
||||
lightmapTextureMatrix.identity();
|
||||
lightmapTextureMatrix.scale(0.00390625f);
|
||||
|
||||
// TODO: Iris-Shaders - Is this logic correct?
|
||||
final Matrix4f translateMatrix = new Matrix4f();
|
||||
translateMatrix.translate(8.0f, 8.0f, 8.0f);
|
||||
lightmapTextureMatrix.mul(translateMatrix);
|
||||
// This mimics the transformations done in LightTexture to the GL_TEXTURE matrix.
|
||||
lightmapTextureMatrix = new Matrix4f(0.00390625f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.00390625f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.00390625f, 0.0f,
|
||||
0.03125f, 0.03125f, 0.03125f, 1.0f);
|
||||
}
|
||||
|
||||
public static void addBuiltinReplacementUniforms(UniformHolder uniforms) {
|
||||
|
||||
Reference in new issue
Block a user