Palette has an off-by-one index issue
Closed this issue · 1 comments
There’s off-by-one error in it when creating the palette information because it inserts a black colour entry at index 0 when in fact it shouldn't be doing so.
In models.py there is a line:
palette = [ Color(0,0,0,0) ] + [ Color(*c, 255) for c in chunks(palette, 3) ]
I believe the line should actually read:
palette = [ Color(*c, 255) for c in chunks(palette, 3) ]
After I make this change, my palette indexes are correct.
I think I can see how this came about. The spec for the vox format says:
color [0-254] are mapped to palette index [1-255], e.g :
... but I don't think this means that you actually have to have your own entry for black at index 0 when you generate palette information.
(Based on gromgull#2 in original project)
Fixed in 059ee84