Commit graph

590 commits

Author SHA1 Message Date
6a82fcc9b4
minedmap/tile_renderer: terminate on errors
Only the processing step may fail for individual tiles (when a region is
currently being saved when attempting to process it), the other steps
should never fail.
2023-08-15 18:31:53 +02:00
155171803d
minedmap/tile_renderer: parallel processing 2023-08-15 17:43:58 +02:00
b5980b82af
minedmap/tile_renderer: async region cache
Prepare for sharing the region cache between multiple threads by making
lookup/load async.
2023-08-15 17:42:27 +02:00
dcc9e6e794
minedmap/region_group: add async map functions 2023-08-15 17:39:42 +02:00
78fe1ec50e
minedmap: add support for parallel processing
For now, only RegionProcessor and TileMipmapper are run in parallel.
2023-08-14 22:38:21 +02:00
c1260a63b5
minedmap: separate collection for region list from preprocessing
Preparation for parallel processing, as well as a fix for regions
missing from later steps when the initial processing failed (rather than
using the processed data from a previous run).
2023-08-14 14:27:52 +02:00
d5ac38ed9b
util: split to_flat_coord() and from_flat_coord() out of coord_offset() 2023-08-13 23:01:45 +02:00
4a824680a9
Update dependencies 2023-08-13 12:16:11 +02:00
9c4161f688
util: turn range check into debug_assert!()
More performance optimization.
2023-08-06 12:33:29 +02:00
21035a1f7f
Move coord offset to new util module, make more efficient
div_floor_mod() generates inefficient code. For power-of-2 divisors,
shift and mask can be used instead.
2023-08-06 11:26:08 +02:00
b80d9ee420
minedmap/tile_renderer: make biome HashMap more efficient
Using a u32 instead of a tuple makes the hash calculation faster,
because the fields don't have to be hashed separately.
2023-08-06 00:07:46 +02:00
84bee6d6d9
minedmap: add region cache
Cache the last loaded processed regions.
2023-08-05 20:26:59 +02:00
521e799d4b
minedmap/region_group: make indexing into the neighbor array more uniform
Add a 9th element, so the 3x3 entries can always be indexed the same way,
leading to a slight performance improvement.

The center element is always None.
2023-08-05 18:21:07 +02:00
7b46adf6e7
minedmap: split up big types by adding Boxes
Make these values faster to move around, and optimize their size when
used in Options.
2023-08-05 18:11:39 +02:00
cd1a5e869d
minedmap/region_group: optimize get() implementation 2023-08-05 14:07:55 +02:00
7d231b92ea
Format let-else blocks
Use nightly rustfmt to format let-else.
2023-08-05 10:46:47 +02:00
ab3b273992
Update dependencies 2023-08-04 16:13:08 +02:00
dc68e67a23
minedmap/region_group: clippy fixes 2023-08-04 00:46:58 +02:00
deb33814ee
minedmap/tile_renderer: avoid calling block_color() more often than necessary
Collect all biome indices/weights for a chunk and deduplicate using a
hash map.
2023-08-03 23:07:16 +02:00
fb712cd2f5
Store per-region biome list in IndexSet
Index into the biome list instead of duplicating the biome data for each
coordinate. This reduces the size of the processed data and speeds up
encoding/decoding.
2023-08-03 23:07:16 +02:00
c38f00e411
minedmap/tile_renderer: implement biome smoothing
Rather than the diamond-shaped kernel used by the old implemenation, we
now use the approximation of a Gauss filter. In addition, the kernel
size is decreased, reducing the strength of the blur effect.
2023-08-03 19:06:20 +02:00
b650b096ef
resource: return block color as float vector
Deferring conversion to integers is convenient for biome smoothing.
2023-08-03 18:31:45 +02:00
0a485343a0
resource: do not require Biome to get color for all block types
Only grass, foliage and water have biome-dependent colors.
2023-08-03 18:28:57 +02:00
45171aa26a
minedmap/tile_renderer: factor out block_color_at() from render_chunk()
Also pass in a few more values to prepare for biome smoothing.
2023-08-03 18:12:56 +02:00
8e848394cd
minedmap/tile_renderer: add biome_at() helper
Retrieve the biome at a given coordinate, possibly offset by a number of
blocks.
2023-08-03 18:02:26 +02:00
dee00e7a02
minedmap/tile_renderer: add coord_offset() helper 2023-08-03 18:02:26 +02:00
35bbd167ba
minedmap/tile_renderer: load 3x3 neighbourhoods of regions
Prepare for biome smoothing by always loading neighbouring regions.
2023-08-03 18:02:26 +02:00
a30266f67f
minedmap/tile_renderer: take into account neighboring regions
Biome smoothing uses biome data from neighboring regions. Collect paths
and timestamps from 3x3 region groups.
2023-08-03 17:55:39 +02:00
5a765c3862
minedmap/region_group: add RegionGroup type
A generic array of 3x3 elements.
2023-08-03 17:55:39 +02:00
e39f48d8fe
types: use const generics for more generic coordinate types
Enum support in const generics would be even nicer, but for now the
integer generic is the best Rust can do.
2023-08-02 02:55:13 +02:00
80781c9c20
minedmap: skip generation steps when the inputs are unchanged 2023-07-31 00:23:06 +02:00
6077138292
Add version field to file metadata 2023-07-30 21:48:58 +02:00
4d6644f427
minedmap/tile_mipmapper: store source modified timestamp with mipmapped tiles 2023-07-30 21:38:42 +02:00
628a702fd7
Store source modified timestamp with processed, lightmap and map tiles
Allows to check whether the source is newer than the last update of the
output files.
2023-07-30 21:19:24 +02:00
e18d4cea82
io/fs: do not replace files with unchanged contents
Do not update file timestamps when contents have not actually changed.
2023-07-30 20:31:40 +02:00
cb791f48e9
Update dependencies 2023-07-30 20:03:23 +02:00
c472b61ef7
resource/block_color: actually apply grass color modifiers to grass
Apply the modifiers to grass, not to foliage.
2023-07-04 00:21:27 +02:00
d84e2ca49d
resource/block_color: fix default foliage colors
The code accidentally used the grass colors.
2023-07-03 23:49:36 +02:00
c471f84573
resource/block_color: fix scaling of biome-specific colors
All biome-specific colors (water/foliage/grass) were too bright by a
factor of 255 (i.e., white).
2023-07-03 23:45:00 +02:00
99c4de0b07
Update dependencies 2023-07-03 23:27:59 +02:00
757f6ff166
minedmap: write info.json file with tilemap metadata
With this change, the new minedmap implementation can generate all
necessary data for the frontend to work.
2023-07-02 23:09:14 +02:00
429b7888f6
world/de: add level.dat data structures
We only need the spawn point from level.dat.
2023-07-02 23:08:43 +02:00
f9fc9efe8d
Revert "minedmap: store region list in BTreeSet"
This reverts commit b53d34da3d.

With the change of the mipmapper data structure, we need a conversion
step anyways, so we can keep using the Vec before mipmapping.
2023-07-02 22:19:35 +02:00
b63a18ad6f
tile_mipmapper: store tile coordinates in nested map/set
Use the same data structure as the frontend.
2023-07-02 22:15:25 +02:00
216aa6ceec
minedmap: add mipmapping 2023-07-02 21:32:40 +02:00
86382772c3
minedmap/tile_renderer: print tile path relative to output directory
We will use strings of the same format for mipmap tile paths.
2023-07-02 20:05:57 +02:00
b1f7f759f1
minedmap: introduce generic tile path function, pass mipmap level 2023-07-02 18:58:08 +02:00
b53d34da3d
minedmap: store region list in BTreeSet
We want to have a sorted list in the end anyways to make metadata
generation deterministic, and we don't have to worry about deduplication
of coordinates when generating mipmap tile lists.
2023-07-02 18:16:35 +02:00
e5c96ecb99
minedmap: replace TileCoords type alias with a struct 2023-07-02 18:08:54 +02:00
007ce010d4
minedmap: rename RegionCoords to TileCoords
With mipmapping, coords will not always correspond to regions anymore.
2023-07-02 15:11:16 +02:00