forked from mirror/ObjToSchematic
Fix failing test
This commit is contained in:
parent
6c1325d8e6
commit
79a5dbf9ce
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user