Fix failing test

This commit is contained in:
Lucas Dower 2023-09-04 01:08:59 +01:00
parent 6c1325d8e6
commit 79a5dbf9ce
No known key found for this signature in database
GPG Key ID: B3EE6B8499593605

View File

@ -87,12 +87,14 @@ export class VoxelMesh {
const pos = inPos.copy().round(); const pos = inPos.copy().round();
const voxel = this._voxels.get(pos.hash()); const voxel = this._voxels.get(pos.hash());
if (voxel !== undefined && this._voxelMeshParams.voxelOverlapRule === 'average') { if (voxel !== undefined) {
if (this._voxelMeshParams.voxelOverlapRule === 'average') {
voxel.colour.r = ((voxel.colour.r * voxel.collisions) + colour.r) / (voxel.collisions + 1); voxel.colour.r = ((voxel.colour.r * voxel.collisions) + colour.r) / (voxel.collisions + 1);
voxel.colour.g = ((voxel.colour.g * voxel.collisions) + colour.g) / (voxel.collisions + 1); voxel.colour.g = ((voxel.colour.g * voxel.collisions) + colour.g) / (voxel.collisions + 1);
voxel.colour.b = ((voxel.colour.b * voxel.collisions) + colour.b) / (voxel.collisions + 1); voxel.colour.b = ((voxel.colour.b * voxel.collisions) + colour.b) / (voxel.collisions + 1);
voxel.colour.a = ((voxel.colour.a * voxel.collisions) + colour.a) / (voxel.collisions + 1); voxel.colour.a = ((voxel.colour.a * voxel.collisions) + colour.a) / (voxel.collisions + 1);
++voxel.collisions; ++voxel.collisions;
}
} else { } else {
this._voxels.set(pos.hash(), { this._voxels.set(pos.hash(), {
position: pos, position: pos,