From 205f043f2e6bdb1bf619821bc6ea70cf08207449 Mon Sep 17 00:00:00 2001 From: mcrcortex <18544518+MCRcortex@users.noreply.github.com> Date: Sun, 28 Jan 2024 19:53:03 +1000 Subject: [PATCH] It works --- .../zenith/client/core/model/ModelManager.java | 2 +- .../rendering/building/RenderDataFactory.java | 17 +++++++++-------- .../assets/zenith/shaders/lod/gl46/quads.vert | 8 ++++---- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/main/java/me/cortex/zenith/client/core/model/ModelManager.java b/src/main/java/me/cortex/zenith/client/core/model/ModelManager.java index 2cf57a71..3b1fac57 100644 --- a/src/main/java/me/cortex/zenith/client/core/model/ModelManager.java +++ b/src/main/java/me/cortex/zenith/client/core/model/ModelManager.java @@ -188,7 +188,7 @@ public class ModelManager { if (offset < -0.1) {//Face is empty, so ignore metadata |= 0xFF;//Mark the face as non-existent //Set to -1 as safepoint - MemoryUtil.memPutLong(faceUploadPtr, -1); + MemoryUtil.memPutInt(faceUploadPtr, -1); continue; } var faceSize = TextureUtils.computeBounds(textureData[face], checkMode); diff --git a/src/main/java/me/cortex/zenith/client/core/rendering/building/RenderDataFactory.java b/src/main/java/me/cortex/zenith/client/core/rendering/building/RenderDataFactory.java index 844afead..9e904667 100644 --- a/src/main/java/me/cortex/zenith/client/core/rendering/building/RenderDataFactory.java +++ b/src/main/java/me/cortex/zenith/client/core/rendering/building/RenderDataFactory.java @@ -33,15 +33,16 @@ public class RenderDataFactory { // if the connecting type of the translucent block is the same AND the face is full, discard it // this stops e.g. multiple layers of glass (and ocean) from having 3000 layers of quads etc - var buff = new MemoryBuffer(8*1); - //MemoryUtil.memPutLong(buff.address, encodeRaw(1, 0,2,0,0,0,515,0, 0));//92 - //MemoryUtil.memPutLong(buff.address+8, encodeRaw(2, 1,1,0,0,0,515,0, 0));//92 - //MemoryUtil.memPutLong(buff.address+16, encodeRaw(3, 0,0,0,0,0,515,0, 0));//92 - //MemoryUtil.memPutLong(buff.address+24, encodeRaw(4, 0,2,0,0,0,515,0, 0));//92 - //MemoryUtil.memPutLong(buff.address+32, encodeRaw(5, 0,2,0,0,0,515,0, 0));//92 + var buff = new MemoryBuffer(8*8); + MemoryUtil.memPutLong(buff.address, encodeRaw(2, 0,0,0,0,0,515,0, 0));//92 + MemoryUtil.memPutLong(buff.address+8, encodeRaw(3, 0,0,0,0,0,515,0, 0));//92 + MemoryUtil.memPutLong(buff.address+16, encodeRaw(4, 0,2,0,0,0,515,0, 0));//92 + MemoryUtil.memPutLong(buff.address+24, encodeRaw(5, 0,2,0,0,0,515,0, 0));//92 + MemoryUtil.memPutLong(buff.address+32, encodeRaw(2, 0,0,0,0,1,515,0, 0));//92 + MemoryUtil.memPutLong(buff.address+40, encodeRaw(3, 0,0,0,0,1,515,0, 0));//92 + MemoryUtil.memPutLong(buff.address+48, encodeRaw(2, 0,0,0,0,2,515,0, 0));//92 + MemoryUtil.memPutLong(buff.address+56, encodeRaw(3, 0,0,0,0,2,515,0, 0));//92 - MemoryUtil.memPutLong(buff.address, encodeRaw(2, 1,1,0,0,0,515,0, 0));//92 - //MemoryUtil.memPutLong(buff.address, encodeRaw(3, 0,0,0,0,0,515,0, 0));//92 return new BuiltSection(section.getKey(), new BuiltSectionGeometry(buff, new short[0]), null); } diff --git a/src/main/resources/assets/zenith/shaders/lod/gl46/quads.vert b/src/main/resources/assets/zenith/shaders/lod/gl46/quads.vert index b855e4ac..789bb8c6 100644 --- a/src/main/resources/assets/zenith/shaders/lod/gl46/quads.vert +++ b/src/main/resources/assets/zenith/shaders/lod/gl46/quads.vert @@ -26,7 +26,7 @@ vec4 uint2vec4RGBA(uint colour) { } //Gets the face offset with respect to the face direction (e.g. some will be + some will be -) -float getFaceOffset(BlockModel model, uint face) { +float getDepthOffset(BlockModel model, uint face) { float offset = extractFaceIndentation(model.faceData[face]); return offset * (1-((int(face)&1)*2)); } @@ -62,7 +62,7 @@ void main() { vec2 quadSize = vec2(extractSize(quad) * ivec2((cornerIdx>>1)&1, cornerIdx&1)); vec2 size = (quadSize + faceOffset) * (1<>1) == 0) {//Up/down offset = offset.xzy; @@ -83,9 +83,9 @@ void main() { //TODO: make the face orientated by 2x3 so that division is not a integer div and modulo isnt needed // as these are very slow ops baseUV = modelUV + (vec2(face%3, face/3) * (1f/(vec2(3,2)*256f))); - uv = quadSize + faceOffset;//Add in the face offset for 0,0 uv + uv = quadSize;// + faceOffset;//Add in the face offset for 0,0 uv - discardAlpha = 0; + discardAlpha = 1; //Compute lighting colourTinting = getLighting(extractLightId(quad));