diff options
4 files changed, 14 insertions, 9 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); diff --git a/src/main/java/makamys/neodymium/util/BufferWriter.java b/src/main/java/makamys/neodymium/util/BufferWriter.java index 617bd7a..eb9263d 100644 --- a/src/main/java/makamys/neodymium/util/BufferWriter.java +++ b/src/main/java/makamys/neodymium/util/BufferWriter.java @@ -52,5 +52,11 @@ public class BufferWriter { public int position() { return buf.position(); } + + public void writeShort(short s) { + shortBuffer.put(s); + + incrementPosition(2); + } }
\ No newline at end of file diff --git a/src/main/resources/shaders/chunk.frag b/src/main/resources/shaders/chunk.frag index 6cc1a07..2e729b1 100644 --- a/src/main/resources/shaders/chunk.frag +++ b/src/main/resources/shaders/chunk.frag @@ -27,8 +27,7 @@ void main() goodTexCoord = ProvokingTexCoord.xy + (((TexCoord.xy - ProvokingTexCoord.xy) / MQPos.zw) * vec2(wrappedU, wrappedV)); } #endif - - vec4 texColor = texture(atlas, goodTexCoord); + vec4 texColor = texture(atlas, goodTexCoord / 16384.0); vec4 colorMult = Color/256.0; |