Fix an oversight in the last commit that caused face duplication at chunk borders.

This commit is contained in:
IntegratedQuantum 2023-10-09 23:02:54 +02:00
parent 2f52e9923b
commit e358832f2f
2 changed files with 8 additions and 3 deletions

View File

@ -86,5 +86,4 @@ void main() {
fragColor.a = 1;
fragColor.rgb += texture(emissionSampler, textureCoords).rgb;
// TODO: Update the depth.
}

View File

@ -928,6 +928,8 @@ pub const meshing = struct {
if(neighborMesh.generated) {
var additionalNeighborFacesOpaque = std.ArrayList(FaceData).init(main.threadAllocator);
defer additionalNeighborFacesOpaque.deinit();
var additionalNeighborFacesVoxel = std.ArrayList(FaceData).init(main.threadAllocator);
defer additionalNeighborFacesVoxel.deinit();
var additionalNeighborFacesTransparent = std.ArrayList(FaceData).init(main.threadAllocator);
defer additionalNeighborFacesTransparent.deinit();
var x3: u8 = if(neighbor & 1 == 0) @intCast(chunkMask) else 0;
@ -963,7 +965,11 @@ pub const meshing = struct {
}
try additionalNeighborFacesTransparent.append(constructFaceData(block, neighbor, otherX, otherY, otherZ, false));
} else {
try additionalNeighborFacesOpaque.append(constructFaceData(block, neighbor, otherX, otherY, otherZ, false));
if(blocks.meshes.model(block).modelIndex == 0) {
try additionalNeighborFacesOpaque.append(constructFaceData(block, neighbor, otherX, otherY, otherZ, false));
} else {
try additionalNeighborFacesVoxel.append(constructFaceData(block, neighbor, otherX, otherY, otherZ, false));
}
}
}
if(canBeSeenThroughOtherBlock(otherBlock, block, neighbor ^ 1)) {
@ -983,7 +989,7 @@ pub const meshing = struct {
}
}
try neighborMesh.opaqueMesh.replaceNeighbors(neighbor, additionalNeighborFacesOpaque.items);
try neighborMesh.voxelMesh.replaceNeighbors(neighbor, additionalNeighborFacesOpaque.items);
try neighborMesh.voxelMesh.replaceNeighbors(neighbor, additionalNeighborFacesVoxel.items);
try neighborMesh.transparentMesh.replaceNeighbors(neighbor, additionalNeighborFacesTransparent.items);
continue;
}