Commit graph

62 commits

Author SHA1 Message Date
37340926f4
MinedMap: fix warning for unused fscanf result 2021-12-19 23:11:21 +01:00
457e993c92
Introduce separate types for block/section/chunk indices
Newtypes are cumbersome in C++, so this is mostly documentation for now.

Also replace lots of questionable uses of size_t with int or types with
explicit width and add a few comments for constants.
2021-12-11 22:50:23 +01:00
fd4773c8ca
treewide: replace license headers with SPDX-License-Identifier 2021-11-17 12:07:56 +01:00
38d8bd0738
Chunk: replace withDepth argument with extensible flags field 2021-08-24 21:03:18 +02:00
9ac3b00b6e
Make region iteration more efficient for sparse worlds
Do not iterate over each region coordinate in the bounding box.

Closes #12
2021-02-13 11:06:30 +01:00
3ec83c8cf8
Compare file contents with old data before writing
Do not writeoutput files when their content hasn't changed. This saves
time for incremental generation (as compressing a PNG takes much longer
than decompressing it) and avoids modification timestamp updates that
might trigger subsequent generation steps.
2020-06-20 15:01:52 +02:00
98e21236d9
Do not generate light data for invisible blocks 2020-06-20 14:48:26 +02:00
03ae9cf302
Exclude unpopulated chunks from biome averaging
Avoids weirdly colored stripes at the edges of the map.
2020-06-20 12:17:24 +02:00
eb831608e0
Add smooth transitions between biomes
Simliar to the way biome transitions are rendered in Minecraft itself,
add smoothing by averaging biome-based colors over all biome values with
distance ≤3 (1-norm).
2020-06-20 12:15:32 +02:00
623d70ec9e
More preparation for biome smoothing 2020-06-20 11:40:29 +02:00
19ef022a67
Biome: return FloatColor for block colors 2020-06-20 11:40:29 +02:00
50f798f89e
Do not store biome in block structure
Use biome data from biome map.
2020-06-20 11:40:29 +02:00
a3cf5edda4
Read biome maps when iterating regions 2020-06-20 11:40:29 +02:00
072d664199
Separate top layer search from block data retrieval 2020-06-20 11:40:29 +02:00
569d0f1198
Pass region indices as int instead of size_t
Region indices can be negative.
2020-06-20 11:40:29 +02:00
4f7663f82f
Merge doRegion{,Biome}() into makeBiome()/makeMap() 2020-06-20 11:40:27 +02:00
2f0d1892f4
Split getModTime() out of checkRegion() 2020-06-20 00:58:08 +02:00
f539d668eb
Collect biome data
We store the biome data as grayscale images, as biome indices are
represented as bytes and we get PNG compression for free.
2020-06-20 00:58:08 +02:00
dc97c4a8c1
PNG: add support for grayscale images without alpha 2020-06-20 00:58:08 +02:00
4f49434dbf
Clean up doLevel() 2020-06-19 20:06:44 +02:00
0245c5c926
Add message before updating mipmaps 2020-06-19 19:09:40 +02:00
d9af9cbc9d
Catch normal runtime errors instead of exiting with SIGABRT 2019-12-14 22:16:41 +01:00
0bdf249307
Add biome color computation
Rather than using fixed values for all biomes, generate grass and foliage
colors based on (height-dependent) temperature and rainfall parameters.

This changes a lot of colors; in general, the new colors should be closer
to the actual Minecraft rendering. It also fixes a few colors that were
completely off (like in the badlands biomes) and adds the MC 1.13 biomes
(which were rendered in black).

Some of the newer biomes (warm/cold/... oceans) don't have proper
parameters yet, and we do not derive the water color from the biome yet.

Fixes #1.
2018-11-08 17:49:28 +01:00
a3246d98c0
Adjust for minor API differences on Windows 2018-07-26 23:18:56 +02:00
de04cce993
World/Block: return colors as struct instead of uint32_t
Gets rid of a useless byte switch, and removes the arpa/inet.h include,
which is not available on Windows.
2018-07-26 23:18:55 +02:00
4e3a9736b6
World/Block: remove useless blockLight accessor 2018-07-22 16:59:18 +02:00
c082c8800c
Separate splitting of regions into chunks and actual parsing of chunk structure 2018-07-20 23:49:51 +02:00
292f4f4f3b
Don't rely on utimensat()
utimensat() does not work on all filesystems, in particular on Windows.
2017-06-13 16:39:17 +02:00
1e14dabc2d Fix definition of timespec >= operator 2015-02-06 23:06:11 +01:00
d73c8b930b Include cleanup
Also remove all uses of unistd.h by replacing unlink with std::rename
2015-02-06 19:51:20 +01:00
fb81ea7d60 Make light layer darker 2015-02-06 17:56:59 +01:00
e4b1919ba8 Use heap memory for image buffers 2015-02-04 09:00:34 +01:00
4d9f29afab Add mipmap support to allow zooming out 2015-02-03 20:15:58 +01:00
0162c236fa Nicer timespec operations 2015-02-03 18:39:58 +01:00
45a1915006 Refactor image creation 2015-02-03 15:02:21 +01:00
0bd8e211e2 Also unlink light tmpfile on errors 2015-02-03 14:19:19 +01:00
9e0bbcf685 Generate light layer 2015-02-03 13:13:12 +01:00
e1b3347da5 Start mipmapping infrastructure 2015-02-03 12:42:33 +01:00
1d3db43d29 Refactor PNG writing 2015-02-02 19:29:37 +01:00
b46c5de3ac Free PNG structs after writing 2015-02-02 18:52:33 +01:00
34857eabbc Add spawn coordinates 2015-02-02 18:33:21 +01:00
db59b73856 Refactor info generation 2015-02-02 17:56:43 +01:00
fd4ce45885 Generate info file 2015-02-02 05:13:07 +01:00
8bdbfd3ec0 Factor out filename check 2015-02-02 04:47:40 +01:00
213124ec57 Output "normal" messages to stdout
This makes it easier to filter for the errors
2015-02-02 03:53:49 +01:00
75671b4b96 Catch exceptions for single regions 2015-02-02 03:38:49 +01:00
a3d6648fa6 Workaround for old libraries without regex support 2015-02-02 03:33:43 +01:00
bedd81dce6 Don't explicitly include setjmp
libpng does this for us.
2015-02-02 03:20:25 +01:00
58adcc4c15 Skip unchanged regions 2015-02-02 03:06:22 +01:00
248b9e319d Convert all regions with one call 2015-02-02 02:25:56 +01:00