Fixed vanilla atlas and build error/warning

This commit is contained in:
Lucas Dower 2022-07-14 18:09:41 +01:00
parent 4f50aeb52d
commit 91af3b240a
4 changed files with 2651 additions and 3030 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 499 KiB

After

Width:  |  Height:  |  Size: 494 KiB

View File

@ -97,7 +97,7 @@ export class RandomDitheringBlockAssigner implements IBlockAssigner {
return (this._mapMatrix[index] / (size * size * size)) - 0.5;
}
assignBlock(voxelColour: RGB, voxelPosition: Vector3, colourSpace: ColourSpace, exclude?: string[]): BlockInfo {
assignBlock(voxelColour: RGBA, voxelPosition: Vector3, colourSpace: ColourSpace, exclude?: string[]): BlockInfo {
this._mapMatrix = this._mapMatrix
.map((value) => ({ value, sort: Math.random() }))
.sort((a, b) => a.sort - b.sort)
@ -110,11 +110,12 @@ export class RandomDitheringBlockAssigner implements IBlockAssigner {
Math.abs(voxelPosition.z % size),
);
const newVoxelColour = new RGB(
((255 * voxelColour.r) + map * RandomDitheringBlockAssigner._threshold) / 255,
((255 * voxelColour.g) + map * RandomDitheringBlockAssigner._threshold) / 255,
((255 * voxelColour.b) + map * RandomDitheringBlockAssigner._threshold) / 255,
);
const newVoxelColour: RGBA = {
r: ((255 * voxelColour.r) + map * RandomDitheringBlockAssigner._threshold) / 255,
g: ((255 * voxelColour.g) + map * RandomDitheringBlockAssigner._threshold) / 255,
b: ((255 * voxelColour.b) + map * RandomDitheringBlockAssigner._threshold) / 255,
a: ((255 * voxelColour.a) + map * RandomDitheringBlockAssigner._threshold) / 255,
};
return BlockAtlas.Get.getBlock(newVoxelColour, colourSpace, exclude);
}

View File

@ -4,8 +4,6 @@ import { IVoxeliser } from '../src/voxelisers/base-voxeliser';
import { TVoxelOverlapRule, VoxelMesh } from '../src/voxel_mesh';
import { BlockMesh, BlockMeshParams, FallableBehaviour } from '../src/block_mesh';
import { IExporter} from '../src/exporters/base_exporter';
import { Schematic } from '../src/exporters/schematic_exporter';
import { Litematic } from '../src/exporters/litematic_exporter';
import { TextureFiltering } from '../src/texture';
import { ColourSpace } from '../src/util';
import { log, LogStyle } from './logging';