Skip to content

Commit

Permalink
VOX support based on sirjuddington/SLADE#1063
Browse files Browse the repository at this point in the history
  • Loading branch information
vs-shirokii committed Apr 13, 2024
1 parent e9bfb7d commit b042c1a
Show file tree
Hide file tree
Showing 3 changed files with 393 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/common/models/models_voxel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,15 @@ PalettedPixels FVoxelTexture::CreatePalettedPixels(int conversion, int frame)
for(int i=0;i<256;i++, pp+=3)
{
PalEntry pe;
#if !HAVE_RT // .vox support
pe.r = (pp[0] << 2) | (pp[0] >> 4);
pe.g = (pp[1] << 2) | (pp[1] >> 4);
pe.b = (pp[2] << 2) | (pp[2] >> 4);
#else
pe.r = pp[0];
pe.g = pp[1];
pe.b = pp[2];
#endif
// Alphatexture handling is just for completeness, but rather unlikely to be used ever.
Pixels[i] = conversion == luminance ? pe.r : ColorMatcher.Pick(pe);

Expand Down Expand Up @@ -134,9 +140,15 @@ int FVoxelTexture::CopyPixels(FBitmap *bmp, int conversion, int frame)
for(int i=0;i<256;i++, pp+=3)
{
bitmap[i] = (uint8_t)i;
#if !HAVE_RT // .vox support
pe[i].r = (pp[0] << 2) | (pp[0] >> 4);
pe[i].g = (pp[1] << 2) | (pp[1] >> 4);
pe[i].b = (pp[2] << 2) | (pp[2] >> 4);
#else
pe[i].r = pp[0];
pe[i].g = pp[1];
pe[i].b = pp[2];
#endif
pe[i].a = 255;
}
}
Expand Down
Loading

0 comments on commit b042c1a

Please sign in to comment.