Skip to content

Commit

Permalink
fix 8 bit 1 channel hmap support
Browse files Browse the repository at this point in the history
  • Loading branch information
Beherith authored Mar 26, 2024
1 parent 374f330 commit 5ccf84b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/pymapconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,14 +668,19 @@ def compileSMF(myargs):
print_flushed ('Error: Incorrect %s heightmap dimensions of (%ix%i), image size should be exactly %ix%i for a spring map size of (%ix%i)' % (
myargs.heightmap, otherheight.size[0], otherheight.size[1], mapx + 1, mapy + 1, springmapx, springmapy))
return -1
print_flushed('Heightmap image dimensions are %ix%i, channels: %i'%(otherheight.size[0],otherheight.size[1],len(otherheight_pixels[0, 0])))
for row in range(otherheight.size[1]):
for col in range(otherheight.size[0]):
numchannels = 1
try:
numchannels = len(otherheight_pixels[col, row])
except:
pass
heights.append(sum(otherheight_pixels[col, row]) * 255 // numchannels)
if numchannels == 1:
heights.append(otherheight_pixels[col, row] * 255)
else:
heights.append(sum(otherheight_pixels[col, row]) * 255 // numchannels)


# open metalmap:
metalmap = []
Expand Down

0 comments on commit 5ccf84b

Please sign in to comment.