Commit Graph

152 Commits (master)

Author SHA1 Message Date
addi 445071cad5 Fix various compiler warnings on MSVC
I tried to avoid casts whereever it was possible, but for some cases it wasn't.
2016-06-18 11:45:02 +02:00
Rogier 6a4c2aeb02 Fix compiler warning (introduced by gcc5) 2016-06-14 18:17:44 +02:00
Rogier dbec678f6b Close database when done
This prevents messages 'Connection reset by peer' in the postgresql log file.

It might have benefits for other databases as well ?
2016-05-23 12:46:25 +02:00
Rogier 56af6644fb Improve parsing of heightmap colors file
Error detection was not entirely correct
2016-01-17 10:37:52 +01:00
Rogier 570ed84fd2 Convert text drawn on the map to ISO8859-2 (which is what libgd uses)
Using non-ISO8859-2 encoded text (e.g. utf-8), or anything else,
may result in garbage characters.
2016-01-17 10:37:52 +01:00
Rogier 1ad247ddc4 Add an option to draw 'ignore' nodes.
This does require a color definition to be added to the colors file.

Implemented as a generic option to draw or ignore types of nodes
(i.e. 'air', 'ignore'). Ignoring specific named nodes from the
command-line is not (yet??) supported.
2016-01-17 10:37:51 +01:00
Rogier ca66635176 Add a colors.txt node flag for air-type nodes (nodes will be treated as air)
This means that they are only drawn if the option '--drawair'
is specified on the command-line. Else they are ignored.
2016-01-17 10:37:51 +01:00
Rogier b3019c1804 Add a colors.txt node flag for ignore-type nodes (nodes will be ignored)
Ignoring a node is more efficient than drawing it with full transparency.
This is noticeable when there are a large number of such nodes.
2016-01-17 10:37:51 +01:00
Rogier 5660f71175 Add support for setting flags for nodes in the colors.txt file.
These will allow special treatement for such nodes.
See subsequent commits
2016-01-17 10:37:51 +01:00
Rogier 03926420d0 Implement bounded block-list query for postgresql
i.e. allow minetestmapper to query the database for a list of
blocks in a specific range (corresponding to the requested geometry),
instead of always obtaining a full list off all blocks.

As postgresql is the only database which supports this efficiently,
this option is only effective for postgresql.
2016-01-17 10:37:51 +01:00
Rogier 4041993672 Fix incorrect handling of some options when backend==auto 2016-01-17 10:37:50 +01:00
Rogier 919595c614 Add postgresql support
Supports both ShadowNinja's implementation:
  https://github.com/ShadowNinja/minetest/tree/PostgreSQL
and johnnyjoy's implementation:
  https://forum.minetest.net/viewtopic.php?f=3&t=12851
  4d537fe53a
2015-12-16 15:40:45 +01:00
Rogier 4e8441d322 Use Settings class to obtain world chunksize 2015-12-16 15:40:45 +01:00
Rogier 5e4cf95b63 Remove a line of lingering debug code 2015-11-13 12:29:42 +01:00
Rogier 4e6ee97936 Add a comment to clarify a magical formula 2015-11-13 12:29:42 +01:00
Rogier 333e6b22fc Remove some unused functions 2015-05-31 08:13:25 +02:00
Rogier 3c39308931 Small fix (bad comparison due to typo in commit 5ce7ff) 2015-05-31 08:12:27 +02:00
Rogier 2ca8ce4c53 Print suggestion messages related to the use of --disable-blocklist-prefetch 2015-03-10 18:12:53 +01:00
Rogier 0a5e24b7d7 Add option --silence-suggestions, to disable certain messages
Specific message types will be in a later commit
2015-03-10 18:12:53 +01:00
Rogier 8349d41283 Handle empty world (don't generate map & improve --verbose output) 2015-03-10 18:12:53 +01:00
Rogier dd0ff68c12 Add an option to disable prefetching the block list from the database (fix indent) 2015-03-10 18:12:53 +01:00
Rogier b3ce6116a5 Add an option to specify database format (for use with --disable-blocklist-prefetch)
When using --disable-blocklist-prefetch, the database key format for every leveldb
block, which is normally determined when prefetching the block list, is not known.

In order to avoid duplicate queries using both key formats, the key format can now
be specified using --database-format
2015-03-10 18:12:53 +01:00
Rogier 38f4272dd3 Add an option to disable prefetching the block list from the database
This introduces a speed tradeoff.

When mapping a small part of a large world, the prefetch time dominates
the mapping time, and it is more advantageous to skip the prefetch and
query all possible blocks in the mapped space.

When mapping a large fraction of a world, in particular when a lot of
the mapped space is empty, the time spent querying non-existing blocks can
dominate mapping time, and it is more advantageous to prefetch the list
of existing blocks, so that querying huge numbers of non-existing blocks
can be avoided.
2015-03-10 18:12:53 +01:00
Rogier d6e08adefe Fixes to statistical variables & other minor changes 2015-03-10 17:47:30 +01:00
Rogier 0462481e1f Report key formats found in leveldb (currently applicable to freeminer worlds) 2015-03-10 17:47:30 +01:00
Rogier f7e822adf0 Change verboseStatistics to int (from bool) 2015-03-10 17:47:29 +01:00
Rogier a3f01d5a1e Report minimum and maximum Y coordinate mapped (hint for --min-y and --max-y) 2015-03-10 17:47:29 +01:00
Rogier 7c2cf3efa9 Cleanup sqlite3 database code a bit
As tests using --sqlite-cacheworldrow showed a consistently
lower performance than without, this option was effectively
disabled. It is still recognised for compatibility, but
it may be removed some time in the future.
2015-03-10 12:01:55 +01:00
Rogier 7c8a99599f Improve memory use of BlockPos 2015-03-03 08:29:04 +01:00
Rogier e557ca350c Fixed an assert in debug mode when tile borders are more than 1 pixel 2015-02-20 13:10:09 +01:00
Rogier a6eed3a1ed Add options to specify a custom major and minor interval in the scale(s). 2015-02-20 13:10:09 +01:00
Rogier 5ce7ff4bce Allow scaling a map to a smaller size while generating. (1/2, 1/4 .. 1/16)
Scaling will not average nodes across block boundaries, This implies
that the only scale factors supported are 1:2, 1:4, 1:8 and 1:16.
2015-02-20 13:10:09 +01:00
Rogier 994e9d7171 Add the option to draw a height scale for the height map 2015-02-20 13:10:09 +01:00
Rogier 4476de429d Allow reading heightmap colors from file, and use separate option for nodes file 2015-02-20 13:10:09 +01:00
Rogier 3812e31fc9 Add options to generate a height map of the world.
--heightmap: generate the height map, in colors
--heightmap-grey: use shades of grey instead of colors
--sealevel <n>: define the sea level (below sea level is drawn in blue)
--heightmap-scale <f>: scale the heights by f (for the purpose of
  color selection)

When generating a heightmap, a special colors file is needed,
that defines just the blocks that should be considered part
of the ground. That means that normally, any plants, special
nodes and water should not be included.
2015-02-20 13:10:09 +01:00
Rogier d538398c31 Allow selecting which sides to draw the scale on (top and/or left) 2015-02-20 13:10:09 +01:00
Rogier 784cf9604f Replace m_nextStoredYCoord by a PixelAttributes member. 2015-02-20 13:10:09 +01:00
Rogier 2e69eaeba7 Enhance progress indicator 2015-02-20 13:10:08 +01:00
Rogier 22041a8603 Add shorthand options to draw tiles matching map-blocks and map-chunks
The option --tiles has two new possible values: 'block' and 'chunk'
'block' creates tiles corresponding to map blocks
'chunk' creates tiles corresponding to map chunks
(chunks are the unit of map generation).

An option --chunksize was added to manually override the chunk size.
2015-02-20 13:10:08 +01:00
Rogier 5aa358aafe Rename some constants for clarity 2015-02-20 13:10:08 +01:00
Rogier b71c1a3089 Print block coordinates as well in the scale
Note: on the y-axis scale, the block coordinates are rendered above
the line, instead of under the node coordinate, as that makes
them adjacent to the block they refer to.

for illustration: create a map with --drawscale --tiles=16 --tileorigin=world.
this makes the tiles correspond to the map blocks.
Consider a point with y-coordinate 64. It is part of a map-block with y=64..79.
This block is located at and above the line corresponding to y=64. On the y-axis,
it is therefore most intuitive to render the block coordinate above the line.
2015-02-20 13:10:03 +01:00
Rogier b99111e038 Add a --drawalpha mode that keeps water (etc.) transparent to great depths
This new mode averages the colors of all transparent blocks, instead of
making the colors progressively darker and more opaque.

This 'average' mode is now the default when using --drawalpha. It can be
explicitly selected using --drawalpha=average. The old modes can be selected
using --drawalpha=cumulative[-darken].

It is recommended to change the colors of water as well. These are in a
separate patch.
2014-06-19 13:30:00 +02:00
Rogier a065e68eac Make darkening of thick transparent stacks (e.g. deep water) configurable.
In order to reduce rendering surprises, this darkening is off by default
(it was on previously).
2014-06-18 21:19:14 +02:00
Rogier 66122c1c2e Freeminer database coordinate format support ('a<x>,<y>,<z>') 2014-06-18 10:12:44 +02:00
Rogier 60b39e7d4b Generalize processing of air and ignore nodes 2014-06-18 10:11:11 +02:00
Rogier f832530bf8 Allow air nodes to have a color.
As this comes with a significant performance penalty, this
feature must be enabled using the command-line option --drawair

For best results, the color of air should be fully transparent,
so that underlying nodes will override it.
2014-06-18 10:07:55 +02:00
Rogier ced0390611 Add a default color for nodes
This is useful to show invisible ('air' or 'invalid') nodes in blocks
that are in the database using a different color than blocks that are
not in the database (which will have no color at all, causing the
background color to show).
2014-06-18 10:06:46 +02:00
Rogier 5369adb937 Interpret fully transparent node colors as default colors
(to be overridden by the color of any not-fully-transparent node beneath)

Fully transparent nodes also do not participate in shading.
2014-06-18 10:03:46 +02:00
Rogier 9b5da3ad2c Optimize generation of horizontally sparse maps
(i.e. maps with most but not all pixels in every row empty)
2014-06-18 10:03:32 +02:00
Rogier e6322f2911 Add an include directive for colors files
A colors file can now specify other colors files, from which
additional node color specifications will be read. This allows, for
instance, using system-installed colors file for most colors,
and only overriding some of its colors in a custom colors file.

As a purpose of using a custom colors file may be to leave the colors
for some nodes undefined, it is now also possible to undefine a
previously defined node color (i.e. after reading another colors file
which defines a color for the node).
2014-06-18 10:02:51 +02:00