aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2022-06-23 13:17:45 +0200
committermakamys <makamys@outlook.com>2022-06-23 13:17:45 +0200
commitcc72faceab58271a2419458133191af4b028e2f0 (patch)
treeacbc9142bd6ce9f33e64f8e89a11dcab6bf2a9ff
parenta0a262b8a91527f822356baf27f894be0c31e3af (diff)
downloadNeodymium-cc72faceab58271a2419458133191af4b028e2f0.tar.gz
Neodymium-cc72faceab58271a2419458133191af4b028e2f0.tar.bz2
Neodymium-cc72faceab58271a2419458133191af4b028e2f0.zip
Make short UV more accurate
-rw-r--r--src/main/java/makamys/neodymium/renderer/MeshQuad.java4
-rw-r--r--src/main/java/makamys/neodymium/renderer/NeoRenderer.java2
-rw-r--r--src/main/resources/shaders/chunk.frag2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/MeshQuad.java b/src/main/java/makamys/neodymium/renderer/MeshQuad.java
index 23617a4..db8bd25 100644
--- a/src/main/java/makamys/neodymium/renderer/MeshQuad.java
+++ b/src/main/java/makamys/neodymium/renderer/MeshQuad.java
@@ -167,8 +167,8 @@ public class MeshQuad {
float v = vs[vi];
if(Config.shortUV) {
- out.writeShort((short)(u * 16384));
- out.writeShort((short)(v * 16384));
+ out.writeShort((short)(u * 32768));
+ out.writeShort((short)(v * 32768));
} else {
out.writeFloat(u);
out.writeFloat(v);
diff --git a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
index 701e009..f2591cb 100644
--- a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
+++ b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
@@ -443,7 +443,7 @@ public class NeoRenderer {
int stride = MeshQuad.getStride();
glVertexAttribPointer(0, 3, GL_FLOAT, false, stride, 0);
- glVertexAttribPointer(1, 2, Config.shortUV ? GL_SHORT : GL_FLOAT, false, stride, 3 * 4);
+ glVertexAttribPointer(1, 2, Config.shortUV ? GL_UNSIGNED_SHORT : GL_FLOAT, false, stride, 3 * 4);
int uvEnd = Config.shortUV ? 4 * 4 : 5 * 4;
glVertexAttribPointer(2, 2, GL_SHORT, false, stride, uvEnd);
glVertexAttribPointer(3, 4, GL_UNSIGNED_BYTE, false, stride, uvEnd + 1 * 4);
diff --git a/src/main/resources/shaders/chunk.frag b/src/main/resources/shaders/chunk.frag
index 1922f03..d8ffdcf 100644
--- a/src/main/resources/shaders/chunk.frag
+++ b/src/main/resources/shaders/chunk.frag
@@ -30,7 +30,7 @@ void main()
vec4 texColor = texture(atlas, goodTexCoord
#ifdef SHORT_UV
- / 16384.0
+ / 32768.0
#endif
);