diff options
author | makamys <makamys@outlook.com> | 2022-06-13 23:47:32 +0200 |
---|---|---|
committer | makamys <makamys@outlook.com> | 2022-06-23 12:21:50 +0200 |
commit | 83b035c243b3ffeac9d57f7ab6d4cd89c0e25851 (patch) | |
tree | 8b200339fffc08aa4a88098881d3f01e385ad18b /src/main/java/makamys/neodymium/renderer | |
parent | 466e033c5c2941f8ef71a36cd86ae8d3a77a1d00 (diff) | |
download | Neodymium-83b035c243b3ffeac9d57f7ab6d4cd89c0e25851.tar.gz Neodymium-83b035c243b3ffeac9d57f7ab6d4cd89c0e25851.tar.bz2 Neodymium-83b035c243b3ffeac9d57f7ab6d4cd89c0e25851.zip |
Store UV as short
Increases framerate a lil bit.
Diffstat (limited to 'src/main/java/makamys/neodymium/renderer')
-rw-r--r-- | src/main/java/makamys/neodymium/renderer/MeshQuad.java | 6 | ||||
-rw-r--r-- | src/main/java/makamys/neodymium/renderer/NeoRenderer.java | 8 |
2 files changed, 7 insertions, 7 deletions
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); |