- added a new texture class using stb_image to read a more formats.

This implementation only reads GIF, BMP and PIC formats. No animated GIF support because stb_image does not handle that.
PNG, JPG and TGA are still being handled by the existing dedicated implementations.
PSD and HDR are impractical for reading texture data and thus are disabled.
PnM could be enabled, if its identification semantics were stronger. stb_image only checks the first two characters which simply would falsely identify several flats with the right colors in the first two bytes.

This is more or less a waste product of getting stb_image to work with something actually testable, so it is just provided as-is.
This commit is contained in:
Christoph Oelckers 2019-10-06 08:37:23 +02:00
commit 5a72e0bfb7
5 changed files with 7735 additions and 2 deletions

View file

@ -331,6 +331,7 @@ FImageSource *JPEGImage_TryCreate(FileReader &, int lumpnum);
FImageSource *DDSImage_TryCreate(FileReader &, int lumpnum);
FImageSource *PCXImage_TryCreate(FileReader &, int lumpnum);
FImageSource *TGAImage_TryCreate(FileReader &, int lumpnum);
FImageSource *StbImage_TryCreate(FileReader &, int lumpnum);
FImageSource *RawPageImage_TryCreate(FileReader &, int lumpnum);
FImageSource *FlatImage_TryCreate(FileReader &, int lumpnum);
FImageSource *PatchImage_TryCreate(FileReader &, int lumpnum);
@ -348,6 +349,7 @@ FImageSource * FImageSource::GetImage(int lumpnum, ETextureType usetype)
{ JPEGImage_TryCreate, ETextureType::Any },
{ DDSImage_TryCreate, ETextureType::Any },
{ PCXImage_TryCreate, ETextureType::Any },
{ StbImage_TryCreate, ETextureType::Any },
{ TGAImage_TryCreate, ETextureType::Any },
{ RawPageImage_TryCreate, ETextureType::MiscPatch },
{ FlatImage_TryCreate, ETextureType::Flat },