Closed jice-nospam closed 7 years ago
Hey - I'll take a look at this as soon as I get a chance. In the meanwhile, have you got a .vox file I can use for a test case (to prevent me from breaking things again)?
This is the file I'm using. It contains 6 models and a custom pallete :
There might be something wrong in the file instead. It seems there's a voxel with color 255 in there. Yet the color index 255 is not selectable in MagicaVoxel...
mmh something weird in the spec. There should be 256 ints in the chunk, yet we should only read 255 of them (color index 0 being hardcoded as black?)
4 x 256 | int | (R, G, B, A) : 1 byte for each component
| * <NOTICE>
| * color [0-254] are mapped to palette index [1-255], e.g :
|
| for ( int i = 0; i <= 254; i++ ) {
| palette[i + 1] = ReadRGBA();
| }
ok this is not an issue. I simply had to index pallete using voxel.i -1 instead of voxel.i. Magica Voxel color indices range from 1 to 255, actually resulting in a 255 colors pallete.
Ah - thanks very much for digging into that 👍
I just upgraded dot_vox to the last version (from commit 8aeb367) and my .vox file loading fails because my DotVoxData.pallete field only has 255 elements (where 256 expected).
Seems the culprit is this change :