Commit Graph

155 Commits (98fa76bb6b87ae31078f526cf445834be2a8b4ec)

Author SHA1 Message Date
Rogier 98fa76bb6b Minor statistics fix to leveldb backend
(And a minor edit to README.rst)
2014-05-22 10:41:48 +02:00
Rogier e097580b3e Remove colors.txt from .gitignore 2014-05-22 10:41:47 +02:00
Rogier 3df8be20bb Fix SEGV when top part of the map is empty 2014-05-22 10:41:47 +02:00
Rogier f36a8b61fb Allow colors with alpha to differ from colors without alpha
(using the same colors.txt file)
2014-05-22 10:41:47 +02:00
Rogier 15bab71533 Allow setting verbosity back to 0 2014-05-22 10:41:47 +02:00
Rogier 2c00ad665c Fix SEGV caused by unknown/unrecognised option name 2014-05-22 10:41:47 +02:00
Rogier 49cb97598d Fix choice between c++11 unordered_map and c++0x regular (ordered) map 2014-05-22 10:41:47 +02:00
Rogier 0aee764203 Use C++11 if possible
This allows the use of more efficient (i.e. faster) data structures
like unordered_map.
2014-05-22 10:41:12 +02:00
Rogier f60fd0a9aa Search world's minetest directory for colors file as well.
(which is assumed to be the directory two levels up from the
 world's directory, if it contains 'minetest.conf')
2014-05-22 10:41:12 +02:00
Rogier ae5c031d5b Remove trailing NULs (if any) in node names from MT node name map 2014-05-22 10:41:12 +02:00
Rogier 65b37bec25 Allow player and origin colors to have an alpha component.
Values: 0: fully transparent, 255: fully opaque.

Note that this doesn't yield the expected color blending just
yet, due to libgd messing it up. (Seemingly, the libgd arc
drawing function draws some pixels repeatedly, resulting in a
more opaque circle than desired)
2014-05-22 10:41:12 +02:00
Rogier 493c5842a1 Fix conversion of libgd alpha value: libgd uses 0..127 (not 255) 2014-05-22 10:41:12 +02:00
Rogier 1c7b31a5dc When not using a geometry option, *do* generate the smallest possible map 2014-05-22 10:41:12 +02:00
Rogier d5b3b2a7da Improve error messages for zlib decompression errors 2014-05-22 10:41:12 +02:00
Rogier 21b9ffe0a1 Don't treat empty map blocks as opaque
(empty map blocks are blocks that have no associated block data
 in the database (which should probably not happen), or that are
 not in the database at all, but that are still queried for some
 reason (which is unlikely))
2014-05-22 10:41:11 +02:00
Rogier 5c73495d7b Initialize color to 0,0,0,0 by default (instead of 0,255,255,255) 2014-05-22 10:41:11 +02:00
Rogier d57ce63c46 Move min/max mapblock defines to config.h, and rename them 2014-05-22 10:41:11 +02:00
Rogier c692d3d652 Improvements to database code & some small optimisations 2014-05-22 10:32:12 +02:00
Rogier bbf92d2ffa Split struct BlockPos into own header 2014-05-22 10:12:10 +02:00
Rogier 902f3b45d7 Use a common ustring type definition instead of different custom versions 2014-05-22 10:12:03 +02:00
Rogier 0117556550 Make --geometrymode accept an empty option list
An empty option list modifies the behavior of a subsequent plain
--geometry to not make the old mode (shrink,block) the default.
2014-05-12 09:26:17 +02:00
Rogier 5915e1712a Add error messages when failing to parse command-line
Mention the help option as well in the help text.
2014-05-12 09:26:17 +02:00
Rogier 5e4ee45575 Move color string parsing to constructor of class Color & add a constructor using an integer
Added formats for Color constructor:
- plain interger (2^24 * alpha + 2^16 * red + 2^8 * green + blue)
- Color string consisting of:
  - '#'
  - 3, 4, 6 or 8 hex digits
2014-05-12 09:26:17 +02:00
Rogier 6ccb2285a1 Fix to verbose geometry messages - report requested geometry with pixel-accurate geometry 2014-04-24 16:58:06 +02:00
Rogier-5 efa067ab79 Fix README.rst to display correctly on github 2014-04-16 15:27:56 +02:00
ShadowNinja 5525eb11af Add CPack files to .gitignore 2014-04-16 15:14:32 +02:00
Rogier 751f3dc131 Abstraction of tile parameters computation to its own function. 2014-04-16 15:13:51 +02:00
Rogier e97e19921c Search more locations for the colors.txt file
The colors.txt file can now be located:
- in the directory of the world being mapped
- in the user's private minetest directory ($HOME/.minetest)
- in the current directory as a last resort

The location can also be specified using a command-line option
2014-04-16 15:13:09 +02:00
Sfan5 56efa78cd3 Revert "Fix compiling with clang"
This problem was caused by my incorrect configuration.
2014-04-16 15:13:04 +02:00
Rogier 06237f5abc Improve layout of verbose geometry messages & tune their verbosity 2014-04-16 15:12:59 +02:00
Rogier 6a26a8ef4b Make the geometry pixel-accurate instead of map-block accurate
When requesting, for instance, a 75x85 map, the mapper will
now create a 75x85 map, instead of an 80x96 (or even 96x108)
map as it did before.

This new behavior is the default when using one of the options
--centergeometry or --cornergeometry.

In addition, both of these options will no longer shrink the
map, to remove rows or columns of empty blocks at the edges.
Previously, this behavior was enabled with --forcegeometry.

An option --geometrymode has been added as well, to tune
the interpretation of the geometry. It supports 4 flags:

- pixel:  the requested geometry is interpreted with pixel
	  granularity. The map is not enlarged to include
	  entire map blocks.

- block:  the requested geometry is interpreted with block
	  granularity. The map is enlarged with at most 15
	  nodes at each of the four edges, so that it
	  includes entire map blocks only.

- fixed:  a map of the requested geometry is created (after
	  adjustmens for 'block' mode). Empty rows or
	  columns at the edges are not removed.

- shrink: Empty rows and columns at the map edges are
	  removed to generate the smallest picture possible.

Lastly, a new geometry syntax has been added, which is more
compatible with known syntax (i.e. X-Windows), and which
allows the offset to be optional. If the offset is omitted,
the picture defaults to be centered around 0,0.

`<width>x<height>[+|-<xoffset>+|-<yoffset>]`

For compatibility, the behavior of the option --geometry
was not changed. If (and only if) used before --geometrymode,
it enables block granularity and shrink.

The old option --forcegeometry is no longer documented,
but still recognised for compatibility.
2014-04-16 15:12:37 +02:00
Rogier ec7178dde3 Change --tileorigin to accept ',' as separator
The previous separator (':') still works, but is not advertised.
2014-04-16 10:57:21 +02:00
Rogier 2119a6ae75 Make PixelAttributes more generic
In preparation for other changes
2014-04-16 10:55:58 +02:00
Rogier ec557c0231 Small tweak to scrolling code 2014-04-14 16:53:00 +02:00
Rogier b7dc38d7fa Make README.rst look better on github 2014-04-14 16:39:13 +02:00
Rogier 13463f2214 Catch option parsing errors & colors.txt errors. 2014-04-14 01:30:17 +02:00
Rogier ce94029c95 Merge PixelCacheEntry into PixelAttributes 2014-04-14 01:29:58 +02:00
Rogier b9993d68cf Allow disabling tiles on the command line (i.e. accept 0 as tile size) 2014-04-14 01:29:29 +02:00
Rogier f79abf832d Fix compilation problem 2014-04-14 01:26:48 +02:00
Rogier 8faa2d4a87 Fix/improve handling of colors with alpha channel
Color mixing using alpha channel now spans map blocks.
So for instance, water is partly translucent to great depths.

Water (or other translucent material) now also becomes darker
with depth.
2014-04-10 22:57:37 +02:00
Rogier 7dc3b48a7c Move color structs & functions to own header
To prepare for the map zoom level support
2014-04-10 19:53:35 +02:00
Rogier 1fbcdc281e Fix alpha handling - libgd treats 0xff as transparent and 0x00 as opaque. 2014-04-10 15:29:48 +02:00
Rogier 683d9fe368 Remove superfluous '--' in README.rst 2014-04-10 12:30:03 +02:00
Rogier 62f004ae0a Inform the user of libgd and system limitations when applicable.
This is necessary, because libgd may fail, or print some
unintelligible message when these limits are reached.

Known limitations:
- libgd refuses to create images larger than approx INT_MAX (2^31-1)
  pixels (a little over 46300x46300), even on 64-bit systems.
- on a 32-bit system, in practise, the largest size that can be
  generated is a little over 24100x24100 pixels.
2014-04-10 02:19:25 +02:00
Rogier c1f2df705b Add an option to print progress information while generating the map. 2014-04-10 01:15:58 +02:00
Rogier db2d27c077 Catch failure of gdImageCreateTrueColor & terminate gracefully. 2014-04-09 18:56:04 +02:00
Rogier 96a9c937ab Really ignore colors.txt lines that failed to parse 2014-04-09 12:47:59 +02:00
Sfan5 a7a45b5a55 Tabs -> spaces 2014-04-09 12:02:21 +02:00
Rogier 84e1fac7d7 Improve parsing of colors file
The colors file is now parsed line by line, which means
that parse failures on one line will not carry over to the next line.

When a line fails to parse, the rest of the file is no longer silently
ignored, but the error is reported, and just the failed line is ignored.
2014-04-09 11:47:18 +02:00
Sfan5 dcecbaef96 Clarify autogenerating colors 2014-04-09 11:04:35 +02:00