Make options documentation consistent

also resolve confusion between Y axis on image vs. in-game
This commit is contained in:
sfan5 2025-04-07 22:58:58 +02:00
parent 458c3c30a0
commit 314debe4fb
3 changed files with 58 additions and 40 deletions

View File

@ -4,16 +4,18 @@ Minetest Mapper C++
.. image:: https://github.com/minetest/minetestmapper/workflows/build/badge.svg .. image:: https://github.com/minetest/minetestmapper/workflows/build/badge.svg
:target: https://github.com/minetest/minetestmapper/actions/workflows/build.yml :target: https://github.com/minetest/minetestmapper/actions/workflows/build.yml
Minetestmapper generates an overview image from a Luanti map. Minetestmapper generates a top-down overview image from a Luanti map.
A port of minetestmapper.py to C++ from `the obsolete Python script A port of minetestmapper.py to C++ from `the obsolete Python script
<https://github.com/minetest/minetest/tree/0.4.17/util>`_. <https://github.com/minetest/minetest/tree/0.4.17/util>`_.
This version is both faster and provides more features. This version is both faster and provides more features.
Minetestmapper ships with a colors.txt file for Minetest Game, if you use a different game or have Minetestmapper ships with a colors.txt file suitable for Minetest Game,
many mods installed you should generate a matching colors.txt for better results. if you use a different game or have mods installed you should generate a
matching colors.txt for better results (colors will be missing otherwise).
The `generate_colorstxt.py script The `generate_colorstxt.py script
<./util/generate_colorstxt.py>`_ in the util folder exists for this purpose, detailed instructions can be found within. <./util/generate_colorstxt.py>`_ in the util folder exists for this purpose,
detailed instructions can be found within.
Requirements Requirements
------------ ------------
@ -41,7 +43,8 @@ Minetestmapper for Windows can be downloaded `from the Releases section
<https://github.com/minetest/minetestmapper/releases>`_. <https://github.com/minetest/minetestmapper/releases>`_.
After extracting the archive, it can be invoked from cmd.exe or PowerShell: After extracting the archive, it can be invoked from cmd.exe or PowerShell:
::
.. code-block:: dos
cd C:\Users\yourname\Desktop\example\path cd C:\Users\yourname\Desktop\example\path
minetestmapper.exe --help minetestmapper.exe --help
@ -49,7 +52,7 @@ After extracting the archive, it can be invoked from cmd.exe or PowerShell:
Compilation Compilation
----------- -----------
:: .. code-block:: bash
cmake . -DENABLE_LEVELDB=1 cmake . -DENABLE_LEVELDB=1
make -j$(nproc) make -j$(nproc)
@ -57,8 +60,8 @@ Compilation
Usage Usage
----- -----
`minetestmapper` has two mandatory paremeters, `-i` (input world path) ``minetestmapper`` has two mandatory paremeters, ``-i`` (input world path)
and `-o` (output image path). and ``-o`` (output image path).
:: ::
@ -90,7 +93,7 @@ draworigin:
Draw origin indicator, ``--draworigin`` Draw origin indicator, ``--draworigin``
drawalpha: drawalpha:
Allow nodes to be drawn with transparency (e.g. water), ``--drawalpha`` Allow nodes to be drawn with transparency (such as water), ``--drawalpha``
extent: extent:
Don't output any imagery, just print the extent of the full map, ``--extent`` Don't output any imagery, just print the extent of the full map, ``--extent``
@ -101,11 +104,14 @@ noshading:
noemptyimage: noemptyimage:
Don't output anything when the image would be empty, ``--noemptyimage`` Don't output anything when the image would be empty, ``--noemptyimage``
verbose:
Enable verbose log putput, ``--verbose``
min-y: min-y:
Don't draw nodes below this y value, e.g. ``--min-y -25`` Don't draw nodes below this Y value, e.g. ``--min-y -25``
max-y: max-y:
Don't draw nodes above this y value, e.g. ``--max-y 75`` Don't draw nodes above this Y value, e.g. ``--max-y 75``
backend: backend:
Override auto-detected map backend; supported: *sqlite3*, *leveldb*, *redis*, *postgresql*, e.g. ``--backend leveldb`` Override auto-detected map backend; supported: *sqlite3*, *leveldb*, *redis*, *postgresql*, e.g. ``--backend leveldb``
@ -113,8 +119,10 @@ backend:
geometry: geometry:
Limit area to specific geometry (*x:z+w+h* where x and z specify the lower left corner), e.g. ``--geometry -800:-800+1600+1600`` Limit area to specific geometry (*x:z+w+h* where x and z specify the lower left corner), e.g. ``--geometry -800:-800+1600+1600``
The coordinates are specified with the same axes as in-game. The Z axis becomes Y when projected on the image.
zoom: zoom:
Apply zoom to drawn nodes by enlarging them to n*n squares, e.g. ``--zoom 4`` Zoom the image by using more than one pixel per node, e.g. ``--zoom 4``
colors: colors:
Override auto-detected path to colors.txt, e.g. ``--colors ../world/mycolors.txt`` Override auto-detected path to colors.txt, e.g. ``--colors ../world/mycolors.txt``
@ -123,6 +131,9 @@ scales:
Draw scales on specified image edges (letters *t b l r* meaning top, bottom, left and right), e.g. ``--scales tbr`` Draw scales on specified image edges (letters *t b l r* meaning top, bottom, left and right), e.g. ``--scales tbr``
exhaustive: exhaustive:
| Select if database should be traversed exhaustively or using range queries, available: *never*, *y*, *full*, *auto* Select if database should be traversed exhaustively or using range queries, available: *never*, *y*, *full*, *auto*
| Defaults to *auto*. You shouldn't need to change this, but doing so can improve rendering times on large maps.
| For these optimizations to work it is important that you set ``min-y`` and ``max-y`` when you don't care about the world below e.g. -60 and above 1000 nodes. Defaults to *auto*. You shouldn't need to change this, as minetestmapper tries to automatically picks the best option.
dumpblock:
Instead of rendering anything try to load the block at the given position (*x,y,z*) and print its raw data as hexadecimal.

View File

@ -9,9 +9,13 @@ minetestmapper \- generate an overview image of a Luanti map
See additional optional parameters below. See additional optional parameters below.
.SH DESCRIPTION .SH DESCRIPTION
.B minetestmapper .B minetestmapper
generates an overview image of a Luanti map. This is a port of generates a top-down overview image of a Luanti map.
the original minetestmapper.py to C++, that is both faster and This is a port of the obsolete minetestmapper.py script to C++,
provides more functionality than the obsolete Python script. that is both faster and provides more features.
Minetestmapper ships with a colors.txt file suitable for Minetest Game,
if you use a different game or have mods installed you should generate a
matching colors.txt for better results (colors will be missing otherwise).
.SH MANDATORY PARAMETERS .SH MANDATORY PARAMETERS
.TP .TP
@ -28,7 +32,7 @@ Background color of image, e.g. "--bgcolor #ffffff"
.TP .TP
.BR \-\-scalecolor " " \fIcolor\fR .BR \-\-scalecolor " " \fIcolor\fR
Color of scale, e.g. "--scalecolor #000000" Color of scale marks and text, e.g. "--scalecolor #000000"
.TP .TP
.BR \-\-playercolor " " \fIcolor\fR .BR \-\-playercolor " " \fIcolor\fR
@ -40,11 +44,11 @@ Color of origin indicator, e.g. "--origincolor #ff0000"
.TP .TP
.BR \-\-drawscale .BR \-\-drawscale
Draw tick marks Draw scale(s) with tick marks and numbers
.TP .TP
.BR \-\-drawplayers .BR \-\-drawplayers
Draw player indicators Draw player indicators with name
.TP .TP
.BR \-\-draworigin .BR \-\-draworigin
@ -52,7 +56,7 @@ Draw origin indicator
.TP .TP
.BR \-\-drawalpha .BR \-\-drawalpha
Allow nodes to be drawn with transparency Allow nodes to be drawn with transparency (such as water)
.TP .TP
.BR \-\-noshading .BR \-\-noshading
@ -60,7 +64,7 @@ Don't draw shading on nodes
.TP .TP
.BR \-\-noemptyimage .BR \-\-noemptyimage
Don't output anything when the image would be empty. Don't output anything when the image would be empty
.TP .TP
.BR \-\-verbose .BR \-\-verbose
@ -68,19 +72,21 @@ Enable verbose log output.
.TP .TP
.BR \-\-min-y " " \fInumber\fR .BR \-\-min-y " " \fInumber\fR
Don't draw nodes below this y value, e.g. "--min-y -25" Don't draw nodes below this Y value, e.g. "--min-y -25"
.TP .TP
.BR \-\-max-y " " \fInumber\fR .BR \-\-max-y " " \fInumber\fR
Don't draw nodes above this y value, e.g. "--max-y 75" Don't draw nodes above this Y value, e.g. "--max-y 75"
.TP .TP
.BR \-\-backend " " \fIbackend\fR .BR \-\-backend " " \fIbackend\fR
Use specific map backend; supported: \fIsqlite3\fP, \fIleveldb\fP, \fIredis\fP, \fIpostgresql\fP, e.g. "--backend leveldb" Override auto-detected map backend; supported: \fIsqlite3\fP, \fIleveldb\fP, \fIredis\fP, \fIpostgresql\fP, e.g. "--backend leveldb"
.TP .TP
.BR \-\-geometry " " \fIgeometry\fR .BR \-\-geometry " " \fIgeometry\fR
Limit area to specific geometry (\fIx:y+w+h\fP where x and y specify the lower left corner), e.g. "--geometry -800:-800+1600+1600" Limit area to specific geometry (\fIx:z+w+h\fP where x and z specify the lower left corner), e.g. "--geometry -800:-800+1600+1600"
The coordinates are specified with the same axes as in-game. The Z axis becomes Y when projected on the image.
.TP .TP
.BR \-\-extent .BR \-\-extent
@ -92,7 +98,7 @@ Zoom the image by using more than one pixel per node, e.g. "--zoom 4"
.TP .TP
.BR \-\-colors " " \fIpath\fR .BR \-\-colors " " \fIpath\fR
Forcefully set path to colors.txt file (autodetected otherwise), e.g. "--colors ../world/mycolors.txt" Override auto-detected path to colors.txt, e.g. "--colors ../world/mycolors.txt"
.TP .TP
.BR \-\-scales " " \fIedges\fR .BR \-\-scales " " \fIedges\fR
@ -102,12 +108,7 @@ Draw scales on specified image edges (letters \fIt b l r\fP meaning top, bottom,
.BR \-\-exhaustive " " \fImode\fR .BR \-\-exhaustive " " \fImode\fR
Select if database should be traversed exhaustively or using range queries, available: \fInever\fP, \fIy\fP, \fIfull\fP, \fIauto\fP Select if database should be traversed exhaustively or using range queries, available: \fInever\fP, \fIy\fP, \fIfull\fP, \fIauto\fP
Defaults to \fIauto\fP. You shouldn't need to change this, but doing so can improve rendering times on large maps. Defaults to \fIauto\fP. You shouldn't need to change this, as minetestmapper tries to automatically picks the best option.
For these optimizations to work it is important that you set
.B min-y
and
.B max-y
when you don't care about the world below e.g. -60 and above 1000 nodes.
.TP .TP
.BR \-\-dumpblock " " \fIpos\fR .BR \-\-dumpblock " " \fIpos\fR

View File

@ -15,9 +15,9 @@
static void usage() static void usage()
{ {
const std::pair<const char*, const char*> options[] = { static const std::pair<const char*, const char*> options[] = {
{"-i/--input", "<world_path>"}, {"-i/--input", "<path>"},
{"-o/--output", "<output_image>"}, {"-o/--output", "<path>"},
{"--bgcolor", "<color>"}, {"--bgcolor", "<color>"},
{"--scalecolor", "<color>"}, {"--scalecolor", "<color>"},
{"--playercolor", "<color>"}, {"--playercolor", "<color>"},
@ -28,13 +28,14 @@ static void usage()
{"--drawalpha", ""}, {"--drawalpha", ""},
{"--noshading", ""}, {"--noshading", ""},
{"--noemptyimage", ""}, {"--noemptyimage", ""},
{"-v/--verbose", ""},
{"--min-y", "<y>"}, {"--min-y", "<y>"},
{"--max-y", "<y>"}, {"--max-y", "<y>"},
{"--backend", "<backend>"}, {"--backend", "<backend>"},
{"--geometry", "x:y+w+h"}, {"--geometry", "x:z+w+h"},
{"--extent", ""}, {"--extent", ""},
{"--zoom", "<zoomlevel>"}, {"--zoom", "<factor>"},
{"--colors", "<colors.txt>"}, {"--colors", "<path>"},
{"--scales", "[t][b][l][r]"}, {"--scales", "[t][b][l][r]"},
{"--exhaustive", "never|y|full|auto"}, {"--exhaustive", "never|y|full|auto"},
{"--dumpblock", "x,y,z"}, {"--dumpblock", "x,y,z"},
@ -57,6 +58,11 @@ static void usage()
for (auto s : backends) for (auto s : backends)
printf("%s ", s.c_str()); printf("%s ", s.c_str());
printf("\n"); printf("\n");
#ifdef _WIN32
printf("See also the full documentation in README.rst\n");
#else
printf("See also the full documentation in minetestmapper(6) or README.rst\n");
#endif
} }
static inline bool file_exists(const std::string &path) static inline bool file_exists(const std::string &path)