From 83b035c243b3ffeac9d57f7ab6d4cd89c0e25851 Mon Sep 17 00:00:00 2001 From: makamys Date: Mon, 13 Jun 2022 23:47:32 +0200 Subject: Store UV as short Increases framerate a lil bit. --- src/main/java/makamys/neodymium/renderer/MeshQuad.java | 6 +++--- src/main/java/makamys/neodymium/renderer/NeoRenderer.java | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/main/java/makamys/neodymium/renderer') diff --git a/src/main/java/makamys/neodymium/renderer/MeshQuad.java b/src/main/java/makamys/neodymium/renderer/MeshQuad.java index e8a761c..0fe580c 100644 --- a/src/main/java/makamys/neodymium/renderer/MeshQuad.java +++ b/src/main/java/makamys/neodymium/renderer/MeshQuad.java @@ -166,8 +166,8 @@ public class MeshQuad { float u = us[vi]; float v = vs[vi]; - out.writeFloat(u); - out.writeFloat(v); + out.writeShort((short)(u * 16384)); + out.writeShort((short)(v * 16384)); int b = bs[vi]; @@ -209,7 +209,7 @@ public class MeshQuad { public static int getStride() { return 3 * 4 // XYZ (float) - + 2 * 4 // UV (float) + + 2 * 2 // UV (float) + 4 // B (int) + 4 // C (int) + (Config.simplifyChunkMeshes ? 4 : 0) // megaquad XY (byte) diff --git a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java index ce8172d..43e3546 100644 --- a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java +++ b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java @@ -443,11 +443,11 @@ public class NeoRenderer { int stride = MeshQuad.getStride(); glVertexAttribPointer(0, 3, GL_FLOAT, false, stride, 0); - glVertexAttribPointer(1, 2, GL_FLOAT, false, stride, 3 * 4); - glVertexAttribPointer(2, 2, GL_SHORT, false, stride, 5 * 4); - glVertexAttribPointer(3, 4, GL_UNSIGNED_BYTE, false, stride, 6 * 4); + glVertexAttribPointer(1, 2, GL_SHORT, false, stride, 3 * 4); + glVertexAttribPointer(2, 2, GL_SHORT, false, stride, 4 * 4); + glVertexAttribPointer(3, 4, GL_UNSIGNED_BYTE, false, stride, 5 * 4); if(Config.simplifyChunkMeshes) { - glVertexAttribPointer(4, 4, GL_UNSIGNED_BYTE, false, stride, 7 * 4); + glVertexAttribPointer(4, 4, GL_UNSIGNED_BYTE, false, stride, 6 * 4); } glEnableVertexAttribArray(0); -- cgit