This commit is contained in:
Bob Omb 2015-11-24 21:37:29 -08:00
parent 87c4089501
commit 85d0eaf921
2 changed files with 25 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# realterrain v.0.0.6
# realterrain v.0.0.7
A Minetest mod that brings real world Terrain into the game (using freely available DEM tiles). Any image can actually be used.
use any image any bit-depth (suggested to convert to greyscale first):
@ -34,9 +34,14 @@ Aspect analysis:
![screenshot_20151031_114215](https://cloud.githubusercontent.com/assets/12679496/10865364/58dbd988-7fc6-11e5-8a7e-75abc31f378d.png)
3D Euclidean Distance analysis (based on input raster):
![screenshot_20151124_201516](https://cloud.githubusercontent.com/assets/12679496/11388193/31d764d0-92e8-11e5-8c92-d34ff733dc56.png)
### Dependencies:
- You must have imageMagick and MagickWand , OR imlib2 installed on your system
- You must have imageMagick and MagickWand , OR imlib2 (8-bit limit) installed on your system
- Mod security disabled
-optional dependencies include lunatic-python, python, graphicsmagick (experimental, commented-out-features)
### Instructions
- install the dependencies and the mod as usual (luarocks can be activated if needed)
@ -67,12 +72,16 @@ Using a graphics editor that doesn't do anti-aliasing and preserves exact red ch
- allow raster symbology to be customized in-game
### Changelog
#### 0.0.7
- performance improvements to distance analysis mode, new default (demo) raster for distance mode ("points.tif")
- refactoring of some code: performance improvements where empty mapchunks are not processed
- bug fixes
#### 0.0.6
- biome cover uses absolute values AND ranges which equate exactly to USGS tier system (makes hand painting easier too)
- small bugfixes and windows compatability
- early stages of integrating python calls for GDAL and GRASS using lunatic-python (commented out - must be built per install)
- added some more raster modes, raster symbology nicer and fills in below steep areas
- performance improvements where empty mapchunks are not processed
- experimental code for using imagemagick / graphicsmagick command line interface to reduce dependencies (commented out)
- some improvements to form validation, in-game raster selection doesn't require a restart

View File

@ -48,6 +48,7 @@ realterrain.settings.biomebits = 8 --@todo remove this setting when magick autod
realterrain.settings.fileinput = ''
realterrain.settings.dist_lim = 80
realterrain.settings.dist_mode = "3D" --3D or 3Dp
--default biome (no biome)
realterrain.settings.b0ground = "default:dirt_with_dry_grass"
@ -980,17 +981,27 @@ end
-- this is not tested with offsets and scales but should work
function realterrain.get_distance(x,y,z, heightmap)
local limit = realterrain.settings.dist_lim
local dist_mode = realterrain.settings.dist_mode
local shortest = limit
--buid a square around the search pixel
local c=0
for j=z-limit, z+limit do
for i=x-limit, x+limit do
c = c +1
local v
local v, e
if heightmap[j] and heightmap[j][i] and heightmap[j][i].input then
v = heightmap[j][i].input
if dist_mode == "3D" then
e = heightmap[j][i].elev
end
if v and v > 0 then
local distance = math.sqrt(((z-j)^2)+((x-i)^2))
local distance
if dist_mode == "2D" then
distance = math.sqrt(((z-j)^2)+((x-i)^2))
elseif dist_mode == "3D" then
distance = math.sqrt(((z-j)^2)+((x-i)^2)+((y-e)^2))
end
--print("candidate: "..distance)
if distance < shortest then
shortest = distance