Fix wrong textures at chunk borders.

This commit is contained in:
IntegratedQuantum 2022-10-01 17:00:46 +02:00
parent 26f4dd2ff2
commit 9a2085f0da

View File

@ -714,7 +714,7 @@ pub const meshing = struct {
if(block.typ == 0 and otherBlock.typ != 0) { // TODO: Transparency
const normal: u32 = neighbor ^ 1;
const position: u32 = @as(u32, x) | @as(u32, y)<<5 | @as(u32, z)<<10;
const textureNormal = blocks.meshes.textureIndices(otherBlock)[neighbor] | normal<<24;
const textureNormal = blocks.meshes.textureIndices(otherBlock)[neighbor ^ 1] | normal<<24;
try self.faces.append(position);
try self.faces.append(textureNormal);
}
@ -769,7 +769,7 @@ pub const meshing = struct {
if(block.typ == 0 and otherBlock.typ != 0) { // TODO: Transparency
const normal: u32 = neighbor ^ 1;
const position: u32 = @as(u32, x) | @as(u32, y)<<5 | @as(u32, z)<<10;
const textureNormal = blocks.meshes.textureIndices(otherBlock)[neighbor] | normal<<24;
const textureNormal = blocks.meshes.textureIndices(otherBlock)[neighbor ^ 1] | normal<<24;
try self.faces.append(position);
try self.faces.append(textureNormal);
}