-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmap.py
49 lines (32 loc) · 1.14 KB
/
map.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import sys, os
from pathlib import Path
from PIL import Image, ImageDraw
import vectormath as vmath
import settings as s
import heightmap
import projection
import colormap
import normalmap
import lightmap
import topng
directory = "output"
if len(sys.argv) > 1:
directory = sys.argv[1]
Path("./" + directory).mkdir(parents=True, exist_ok=True)
hm = Image.open('heightmap.tif')
probableTime = int( 1105 * ((10 / s.SCALE) ** 2) )
print("Projected time to complete: ", probableTime // 60, "minutes, ", probableTime % 60, "seconds")
scaled = heightmap.heightmap(hm, s.SCALE)
scaled.save(directory + "/hm.tif")
projected = projection.projectmap(scaled, s.SCALE)
projected.save(directory + "/pm.tif")
colors = colormap.colormap(projected, s.gradient, s.smoothness)
colors.save(directory + "/cm.png")
normals = normalmap.normalmap(projected, s.sobelScale)
normals.save(directory + "/nm.png")
shaded = lightmap.lightmap(normals, colors, s.light, s.ambientPercentage)
shaded.save(directory + "/map.png")
scaledpng = topng.to_png(scaled)
scaledpng.save(directory + "/hm.png")
projectedpng = topng.to_png(projected)
projectedpng.save(directory + "/pm.png")