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 voxel = this._voxels.get(pos.hash());
if (voxel !== undefined && this._voxelMeshParams.voxelOverlapRule === 'average') {
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.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.collisions;
if (voxel !== undefined) {
if (this._voxelMeshParams.voxelOverlapRule === 'average') {
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.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.collisions;
}
} else {
this._voxels.set(pos.hash(), {
position: pos,