Change data type of computed heightmap arrays to signed integer to avoid unsigned overflow.
Code that works with heightmaps such as filters/smooth.py will subtract two heights expecting to get a negative integer. Getting a very large positive one usually causes an error, so make sure signed int arithmetic gets used.
This commit is contained in:
parent
14967d46da
commit
fde247b651
2
level.py
2
level.py
@ -50,7 +50,7 @@ def extractHeights(array):
|
|||||||
# from each column.
|
# from each column.
|
||||||
|
|
||||||
w, h = array.shape[:2]
|
w, h = array.shape[:2]
|
||||||
heightMap = zeros((w, h), 'uint16')
|
heightMap = zeros((w, h), 'int16')
|
||||||
|
|
||||||
heights = argmax((array > 0)[..., ::-1], 2)
|
heights = argmax((array > 0)[..., ::-1], 2)
|
||||||
heights = array.shape[2] - heights
|
heights = array.shape[2] - heights
|
||||||
|
Reference in New Issue
Block a user