This commit is contained in:
mcrcortex
2024-01-28 19:53:03 +10:00
parent 002005a6a2
commit 205f043f2e
3 changed files with 14 additions and 13 deletions

View File

@@ -188,7 +188,7 @@ public class ModelManager {
if (offset < -0.1) {//Face is empty, so ignore if (offset < -0.1) {//Face is empty, so ignore
metadata |= 0xFF;//Mark the face as non-existent metadata |= 0xFF;//Mark the face as non-existent
//Set to -1 as safepoint //Set to -1 as safepoint
MemoryUtil.memPutLong(faceUploadPtr, -1); MemoryUtil.memPutInt(faceUploadPtr, -1);
continue; continue;
} }
var faceSize = TextureUtils.computeBounds(textureData[face], checkMode); var faceSize = TextureUtils.computeBounds(textureData[face], checkMode);

View File

@@ -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 // 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 // this stops e.g. multiple layers of glass (and ocean) from having 3000 layers of quads etc
var buff = new MemoryBuffer(8*1); var buff = new MemoryBuffer(8*8);
//MemoryUtil.memPutLong(buff.address, encodeRaw(1, 0,2,0,0,0,515,0, 0));//92 MemoryUtil.memPutLong(buff.address, encodeRaw(2, 0,0,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+8, encodeRaw(3, 0,0,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+16, encodeRaw(4, 0,2,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+24, encodeRaw(5, 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 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); return new BuiltSection(section.getKey(), new BuiltSectionGeometry(buff, new short[0]), null);
} }

View File

@@ -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 -) //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]); float offset = extractFaceIndentation(model.faceData[face]);
return offset * (1-((int(face)&1)*2)); 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 quadSize = vec2(extractSize(quad) * ivec2((cornerIdx>>1)&1, cornerIdx&1));
vec2 size = (quadSize + faceOffset) * (1<<lodLevel); vec2 size = (quadSize + faceOffset) * (1<<lodLevel);
vec3 offset = vec3(size, (float(face&1) + getFaceOffset(model, face)) * (1<<lodLevel)); vec3 offset = vec3(size, (float(face&1) + getDepthOffset(model, face)) * (1<<lodLevel));
if ((face>>1) == 0) {//Up/down if ((face>>1) == 0) {//Up/down
offset = offset.xzy; 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 //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 // as these are very slow ops
baseUV = modelUV + (vec2(face%3, face/3) * (1f/(vec2(3,2)*256f))); 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 //Compute lighting
colourTinting = getLighting(extractLightId(quad)); colourTinting = getLighting(extractLightId(quad));