diff --git a/doc/lua_api.md b/doc/lua_api.md index d3310e027..48ef798c4 100644 --- a/doc/lua_api.md +++ b/doc/lua_api.md @@ -276,7 +276,7 @@ the clients (see [Translations]). Accepted characters for names are: Accepted formats are: - images: .png, .jpg, .tga, (deprecated:) .bmp + images: .png, .jpg, .tga sounds: .ogg vorbis models: .x, .b3d, .obj, (since version 5.10:) .gltf, .glb @@ -486,9 +486,7 @@ stripping out the file extension: * e.g. `foomod_foothing.png` * e.g. `foomod_foothing` -Supported texture formats are PNG (`.png`), JPEG (`.jpg`), Bitmap (`.bmp`) -and Targa (`.tga`). -Since better alternatives exist, the latter two may be removed in the future. +Supported texture formats are PNG (`.png`), JPEG (`.jpg`) and Targa (`.tga`). Texture modifiers ----------------- diff --git a/irr/include/irrlicht.h b/irr/include/irrlicht.h index 14a190e53..8bac30e3d 100644 --- a/irr/include/irrlicht.h +++ b/irr/include/irrlicht.h @@ -36,119 +36,6 @@ #include "SIrrCreationParameters.h" #include "IrrCompileConfig.h" // for IRRLICHT_API and IRRCALLCONV -/*! \mainpage Irrlicht Engine 1.9 API documentation - * - *
- * - * \section intro Introduction - * - * Welcome to the Irrlicht Engine API documentation. - * Here you'll find any information you'll need to develop applications with - * the Irrlicht Engine. If you are looking for a tutorial on how to start, you'll - * find some on the homepage of the Irrlicht Engine at - * irrlicht.sourceforge.net - * or inside the SDK in the examples directory. - * - * The Irrlicht Engine is intended to be an easy-to-use 3d engine, so - * this documentation is an important part of it. If you have any questions or - * suggestions, just send a email to the author of the engine, Nikolaus Gebhardt - * (niko (at) irrlicht3d.org). - * - * - * \section links Links - * - * Namespaces: A very good place to start reading - * the documentation.
- * Class list: List of all classes with descriptions.
- * Class members: Good place to find forgotten features.
- * - * \section irrexample Short example - * - * A simple application, starting up the engine, loading a Quake 2 animated - * model file and the corresponding texture, animating and displaying it - * in front of a blue background and placing a user controlable 3d camera - * would look like the following code. I think this example shows the usage - * of the engine quite well: - * - * \code - * #include - * // include a bunch of other stuff... - * - * using namespace irr; - * - * int main() - * { - * // start up the engine - * IrrlichtDevice *device = createDevice(video::EDT_OPENGL, - * core::dimension2d(640,480)); - * - * video::IVideoDriver* driver = device->getVideoDriver(); - * scene::ISceneManager* scenemgr = device->getSceneManager(); - * - * device->setWindowCaption(L"Hello World!"); - * - * // load and show quake2 .md2 model - * scene::ISceneNode* node = scenemgr->addAnimatedMeshSceneNode( - * scenemgr->getMesh("quake2model.md2")); - * - * // if everything worked, add a texture and disable lighting - * if (node) - * { - * node->setMaterialTexture(0, driver->getTexture("texture.bmp")); - * node->setMaterialFlag(video::EMF_LIGHTING, false); - * } - * - * // add a first person shooter style user controlled camera - * scenemgr->addCameraSceneNodeFPS(); - * - * // draw everything - * while(device->run() && driver) - * { - * driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,0,0,255)); - * scenemgr->drawAll(); - * driver->endScene(); - * } - * - * // delete device - * device->drop(); - * return 0; - * } - * \endcode - * - * Irrlicht can load a lot of file formats automatically, see irr::scene::ISceneManager::getMesh() - * for a detailed list. So if you would like to replace the simple blue screen background by - * a cool Quake 3 Map, optimized by an octree, just insert this code - * somewhere before the while loop: - * - * \code - * // add .pk3 archive to the file system - * device->getFileSystem()->addZipFileArchive("quake3map.pk3"); - * - * // load .bsp file and show it using an octree - * scenemgr->addOctreeSceneNode( - * scenemgr->getMesh("quake3map.bsp")); - * \endcode - * - * As you can see, the engine uses namespaces. Everything in the engine is - * placed into the namespace 'irr', but there are also 5 sub namespaces. - * You can find a list of all namespaces with descriptions at the - * namespaces page. - * This is also a good place to start reading the documentation. If you - * don't want to write the namespace names all the time, just use all namespaces like - * this: - * \code - * using namespace core; - * using namespace scene; - * using namespace video; - * using namespace io; - * using namespace gui; - * \endcode - * - * There is a lot more the engine can do, but I hope this gave a short - * overview over the basic features of the engine. For more examples, please take - * a look into the examples directory of the SDK. - */ - //! Everything in the Irrlicht Engine can be found in this namespace. namespace irr { diff --git a/irr/src/CColorConverter.cpp b/irr/src/CColorConverter.cpp index 96b22c544..7749ececf 100644 --- a/irr/src/CColorConverter.cpp +++ b/irr/src/CColorConverter.cpp @@ -12,93 +12,6 @@ namespace irr namespace video { -//! converts a monochrome bitmap to A1R5G5B5 data -void CColorConverter::convert1BitTo16Bit(const u8 *in, s16 *out, s32 width, s32 height, s32 linepad, bool flip) -{ - if (!in || !out) - return; - - if (flip) - out += width * height; - - for (s32 y = 0; y < height; ++y) { - s32 shift = 7; - if (flip) - out -= width; - - for (s32 x = 0; x < width; ++x) { - out[x] = *in >> shift & 0x01 ? (s16)0xffff : (s16)0x8000; - - if ((--shift) < 0) { // 8 pixel done - shift = 7; - ++in; - } - } - - if (shift != 7) // width did not fill last byte - ++in; - - if (!flip) - out += width; - in += linepad; - } -} - -//! converts a 4 bit palettized image to A1R5G5B5 -void CColorConverter::convert4BitTo16Bit(const u8 *in, s16 *out, s32 width, s32 height, const s32 *palette, s32 linepad, bool flip) -{ - if (!in || !out || !palette) - return; - - if (flip) - out += width * height; - - for (s32 y = 0; y < height; ++y) { - s32 shift = 4; - if (flip) - out -= width; - - for (s32 x = 0; x < width; ++x) { - out[x] = X8R8G8B8toA1R5G5B5(palette[(u8)((*in >> shift) & 0xf)]); - - if (shift == 0) { - shift = 4; - ++in; - } else - shift = 0; - } - - if (shift == 0) // odd width - ++in; - - if (!flip) - out += width; - in += linepad; - } -} - -//! converts a 8 bit palettized image into A1R5G5B5 -void CColorConverter::convert8BitTo16Bit(const u8 *in, s16 *out, s32 width, s32 height, const s32 *palette, s32 linepad, bool flip) -{ - if (!in || !out || !palette) - return; - - if (flip) - out += width * height; - - for (s32 y = 0; y < height; ++y) { - if (flip) - out -= width; // one line back - for (s32 x = 0; x < width; ++x) { - out[x] = X8R8G8B8toA1R5G5B5(palette[(u8)(*in)]); - ++in; - } - if (!flip) - out += width; - in += linepad; - } -} - //! converts a 8 bit palettized or non palettized image (A8) into R8G8B8 void CColorConverter::convert8BitTo24Bit(const u8 *in, u8 *out, s32 width, s32 height, const u8 *palette, s32 linepad, bool flip) { diff --git a/irr/src/CColorConverter.h b/irr/src/CColorConverter.h index 7f1628297..af7b13726 100644 --- a/irr/src/CColorConverter.h +++ b/irr/src/CColorConverter.h @@ -15,14 +15,6 @@ namespace video class CColorConverter { public: - //! converts a monochrome bitmap to A1R5G5B5 - static void convert1BitTo16Bit(const u8 *in, s16 *out, s32 width, s32 height, s32 linepad = 0, bool flip = false); - - //! converts a 4 bit palettized image to A1R5G5B5 - static void convert4BitTo16Bit(const u8 *in, s16 *out, s32 width, s32 height, const s32 *palette, s32 linepad = 0, bool flip = false); - - //! converts a 8 bit palettized image to A1R5G5B5 - static void convert8BitTo16Bit(const u8 *in, s16 *out, s32 width, s32 height, const s32 *palette, s32 linepad = 0, bool flip = false); //! converts a 8 bit palettized or non palettized image (A8) into R8G8B8 static void convert8BitTo24Bit(const u8 *in, u8 *out, s32 width, s32 height, const u8 *palette, s32 linepad = 0, bool flip = false); diff --git a/irr/src/CImageLoaderBMP.cpp b/irr/src/CImageLoaderBMP.cpp deleted file mode 100644 index 40989882e..000000000 --- a/irr/src/CImageLoaderBMP.cpp +++ /dev/null @@ -1,402 +0,0 @@ -// Copyright (C) 2002-2012 Nikolaus Gebhardt -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#include "CImageLoaderBMP.h" - -#include "IReadFile.h" -#include "SColor.h" -#include "CColorConverter.h" -#include "CImage.h" -#include "coreutil.h" -#include "os.h" - -namespace irr -{ -namespace video -{ - -//! constructor -CImageLoaderBMP::CImageLoaderBMP() -{ -#ifdef _DEBUG - setDebugName("CImageLoaderBMP"); -#endif -} - -//! returns true if the file maybe is able to be loaded by this class -//! based on the file extension (e.g. ".tga") -bool CImageLoaderBMP::isALoadableFileExtension(const io::path &filename) const -{ - return core::hasFileExtension(filename, "bmp"); -} - -//! returns true if the file maybe is able to be loaded by this class -bool CImageLoaderBMP::isALoadableFileFormat(io::IReadFile *file) const -{ - u16 headerID; - file->read(&headerID, sizeof(u16)); -#ifdef __BIG_ENDIAN__ - headerID = os::Byteswap::byteswap(headerID); -#endif - return headerID == 0x4d42; -} - -// UB-safe overflow check -static inline bool overflowCheck(const void *base, size_t offset, const void *end) -{ - auto baseI = reinterpret_cast(base), - endI = reinterpret_cast(end); - return baseI > endI || offset >= (endI - baseI); -} -// check whether &p[0] to &p[_off - 1] can be accessed -#define CHECKP(_off) \ - if ((_off) < 0 || overflowCheck(p, _off, pEnd)) \ - goto exit -// same for d -#define CHECKD(_off) \ - if ((_off) < 0 || overflowCheck(d, _off, destEnd)) \ - goto exit - -void CImageLoaderBMP::decompress8BitRLE(u8 *&bmpData, s32 size, s32 width, s32 height, s32 pitch) const -{ - u8 *p = bmpData; - const u8 *pEnd = bmpData + size; - u8 *newBmp = new u8[(width + pitch) * height]; - u8 *d = newBmp; - const u8 *destEnd = newBmp + (width + pitch) * height; - s32 line = 0; - - while (p < pEnd && d < destEnd) { - if (*p == 0) { - ++p; - CHECKP(1); - - switch (*p) { - case 0: // end of line - ++p; - ++line; - d = newBmp + (line * (width + pitch)); - break; - case 1: // end of bmp - goto exit; - case 2: - ++p; - CHECKP(2); - d += (u8)*p; - ++p; // delta - d += ((u8)*p) * (width + pitch); - ++p; - break; - default: { - // absolute mode - s32 count = (u8)*p; - ++p; - s32 readAdditional = ((2 - (count % 2)) % 2); - - CHECKP(count); - CHECKD(count); - for (s32 i = 0; i < count; ++i) { - *d = *p; - ++p; - ++d; - } - - CHECKP(readAdditional); - for (s32 i = 0; i < readAdditional; ++i) - ++p; - } - } - } else { - s32 count = (u8)*p; - ++p; - CHECKP(1); - u8 color = *p; - ++p; - CHECKD(count); - for (s32 i = 0; i < count; ++i) { - *d = color; - ++d; - } - } - } - -exit: - delete[] bmpData; - bmpData = newBmp; -} - -// how many bytes will be touched given the current state of decompress4BitRLE -static inline u32 shiftedCount(s32 count, s32 shift) -{ - _IRR_DEBUG_BREAK_IF(count < 0) - u32 ret = count / 2; - if (shift == 0 || count % 2 == 1) - ++ret; - return ret; -} - -void CImageLoaderBMP::decompress4BitRLE(u8 *&bmpData, s32 size, s32 width, s32 height, s32 pitch) const -{ - const s32 lineWidth = (width + 1) / 2 + pitch; - u8 *p = bmpData; - const u8 *pEnd = bmpData + size; - u8 *newBmp = new u8[lineWidth * height]; - u8 *d = newBmp; - const u8 *destEnd = newBmp + lineWidth * height; - s32 line = 0; - s32 shift = 4; - - while (p < pEnd && d < destEnd) { - if (*p == 0) { - ++p; - CHECKP(1); - - switch (*p) { - case 0: // end of line - ++p; - ++line; - d = newBmp + (line * lineWidth); - shift = 4; - break; - case 1: // end of bmp - goto exit; - case 2: { - ++p; - CHECKP(2); - s32 x = (u8)*p; - ++p; - s32 y = (u8)*p; - ++p; - d += x / 2 + y * lineWidth; - shift = x % 2 == 0 ? 4 : 0; - } break; - default: { - // absolute mode - s32 count = (u8)*p; - ++p; - s32 readAdditional = ((2 - ((count) % 2)) % 2); - s32 readShift = 4; - - CHECKP(shiftedCount(count, readShift)); - CHECKD(shiftedCount(count, shift)); - for (s32 i = 0; i < count; ++i) { - s32 color = (((u8)*p) >> readShift) & 0x0f; - readShift -= 4; - if (readShift < 0) { - ++*p; // <- bug? - readShift = 4; - } - - u8 mask = 0x0f << shift; - *d = (*d & (~mask)) | ((color << shift) & mask); - - shift -= 4; - if (shift < 0) { - shift = 4; - ++d; - } - } - - CHECKP(readAdditional); - for (s32 i = 0; i < readAdditional; ++i) - ++p; - } - } - } else { - s32 count = (u8)*p; - ++p; - CHECKP(1); - s32 color1 = (u8)*p; - color1 = color1 & 0x0f; - s32 color2 = (u8)*p; - color2 = (color2 >> 4) & 0x0f; - ++p; - - CHECKD(shiftedCount(count, shift)); - for (s32 i = 0; i < count; ++i) { - u8 mask = 0x0f << shift; - u8 toSet = (shift == 0 ? color1 : color2) << shift; - *d = (*d & (~mask)) | (toSet & mask); - - shift -= 4; - if (shift < 0) { - shift = 4; - ++d; - } - } - } - } - -exit: - delete[] bmpData; - bmpData = newBmp; -} - -#undef CHECKOFF -#undef CHECKP -#undef CHECKD - -//! creates a surface from the file -IImage *CImageLoaderBMP::loadImage(io::IReadFile *file) const -{ - SBMPHeader header; - - file->read(&header, sizeof(header)); - -#ifdef __BIG_ENDIAN__ - header.Id = os::Byteswap::byteswap(header.Id); - header.FileSize = os::Byteswap::byteswap(header.FileSize); - header.BitmapDataOffset = os::Byteswap::byteswap(header.BitmapDataOffset); - header.BitmapHeaderSize = os::Byteswap::byteswap(header.BitmapHeaderSize); - header.Width = os::Byteswap::byteswap(header.Width); - header.Height = os::Byteswap::byteswap(header.Height); - header.Planes = os::Byteswap::byteswap(header.Planes); - header.BPP = os::Byteswap::byteswap(header.BPP); - header.Compression = os::Byteswap::byteswap(header.Compression); - header.BitmapDataSize = os::Byteswap::byteswap(header.BitmapDataSize); - header.PixelPerMeterX = os::Byteswap::byteswap(header.PixelPerMeterX); - header.PixelPerMeterY = os::Byteswap::byteswap(header.PixelPerMeterY); - header.Colors = os::Byteswap::byteswap(header.Colors); - header.ImportantColors = os::Byteswap::byteswap(header.ImportantColors); -#endif - - s32 pitch = 0; - - //! return if the header is false - - if (header.Id != 0x4d42) - return 0; - - if (header.Compression > 2) { // we'll only handle RLE-Compression - os::Printer::log("Compression mode not supported.", ELL_ERROR); - return 0; - } - - if (header.BPP > 32 || !checkImageDimensions(header.Width, header.Height)) { - os::Printer::log("Rejecting BMP with unreasonable size or BPP.", ELL_ERROR); - return 0; - } - - // adjust bitmap data size to dword boundary - header.BitmapDataSize += (4 - (header.BitmapDataSize % 4)) % 4; - - // read palette - - long pos = file->getPos(); - constexpr s32 paletteAllocSize = 256; - s32 paletteSize = (header.BitmapDataOffset - pos) / 4; - paletteSize = core::clamp(paletteSize, 0, paletteAllocSize); - - s32 *paletteData = 0; - if (paletteSize) { - // always allocate an 8-bit palette to ensure enough space - paletteData = new s32[paletteAllocSize]; - memset(paletteData, 0, paletteAllocSize * sizeof(s32)); - file->read(paletteData, paletteSize * sizeof(s32)); -#ifdef __BIG_ENDIAN__ - for (s32 i = 0; i < paletteSize; ++i) - paletteData[i] = os::Byteswap::byteswap(paletteData[i]); -#endif - } - - // read image data - - if (!header.BitmapDataSize) { - // okay, lets guess the size - // some tools simply don't set it - header.BitmapDataSize = static_cast(file->getSize()) - header.BitmapDataOffset; - } - - file->seek(header.BitmapDataOffset); - - s32 widthInBytes; - { - f32 t = (header.Width) * (header.BPP / 8.0f); - widthInBytes = (s32)t; - t -= widthInBytes; - if (t != 0.0f) - ++widthInBytes; - } - - const s32 lineSize = widthInBytes + ((4 - (widthInBytes % 4))) % 4; - pitch = lineSize - widthInBytes; - - u8 *bmpData = new u8[header.BitmapDataSize]; - file->read(bmpData, header.BitmapDataSize); - - // decompress data if needed - switch (header.Compression) { - case 1: // 8 bit rle - decompress8BitRLE(bmpData, header.BitmapDataSize, header.Width, header.Height, pitch); - header.BitmapDataSize = (header.Width + pitch) * header.Height; - break; - case 2: // 4 bit rle - decompress4BitRLE(bmpData, header.BitmapDataSize, header.Width, header.Height, pitch); - header.BitmapDataSize = ((header.Width + 1) / 2 + pitch) * header.Height; - break; - } - - if (header.BitmapDataSize < lineSize * header.Height) { - os::Printer::log("Bitmap data is cut off.", ELL_ERROR); - - delete[] paletteData; - delete[] bmpData; - return 0; - } - - // create surface - core::dimension2d dim; - dim.Width = header.Width; - dim.Height = header.Height; - - IImage *image = 0; - switch (header.BPP) { - case 1: - image = new CImage(ECF_A1R5G5B5, dim); - if (image) - CColorConverter::convert1BitTo16Bit(bmpData, (s16 *)image->getData(), header.Width, header.Height, pitch, true); - break; - case 4: - image = new CImage(ECF_A1R5G5B5, dim); - if (image) - CColorConverter::convert4BitTo16Bit(bmpData, (s16 *)image->getData(), header.Width, header.Height, paletteData, pitch, true); - break; - case 8: - image = new CImage(ECF_A1R5G5B5, dim); - if (image) - CColorConverter::convert8BitTo16Bit(bmpData, (s16 *)image->getData(), header.Width, header.Height, paletteData, pitch, true); - break; - case 16: - image = new CImage(ECF_A1R5G5B5, dim); - if (image) - CColorConverter::convert16BitTo16Bit((s16 *)bmpData, (s16 *)image->getData(), header.Width, header.Height, pitch, true); - break; - case 24: - image = new CImage(ECF_R8G8B8, dim); - if (image) - CColorConverter::convert24BitTo24Bit(bmpData, (u8 *)image->getData(), header.Width, header.Height, pitch, true, true); - break; - case 32: // thx to Reinhard Ostermeier - image = new CImage(ECF_A8R8G8B8, dim); - if (image) - CColorConverter::convert32BitTo32Bit((s32 *)bmpData, (s32 *)image->getData(), header.Width, header.Height, pitch, true); - break; - }; - - // clean up - - delete[] paletteData; - delete[] bmpData; - - return image; -} - -//! creates a loader which is able to load windows bitmaps -IImageLoader *createImageLoaderBMP() -{ - return new CImageLoaderBMP; -} - -} // end namespace video -} // end namespace irr diff --git a/irr/src/CImageLoaderBMP.h b/irr/src/CImageLoaderBMP.h deleted file mode 100644 index e7ef8ed2b..000000000 --- a/irr/src/CImageLoaderBMP.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (C) 2002-2012 Nikolaus Gebhardt -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#pragma once - -#include "IImageLoader.h" - -namespace irr -{ -namespace video -{ - -// byte-align structures -#include "irrpack.h" - -struct SBMPHeader -{ - u16 Id; // BM - Windows 3.1x, 95, NT, 98, 2000, ME, XP - // BA - OS/2 Bitmap Array - // CI - OS/2 Color Icon - // CP - OS/2 Color Pointer - // IC - OS/2 Icon - // PT - OS/2 Pointer - u32 FileSize; - u32 Reserved; - u32 BitmapDataOffset; - u32 BitmapHeaderSize; // should be 28h for windows bitmaps or - // 0Ch for OS/2 1.x or F0h for OS/2 2.x - u32 Width; - u32 Height; - u16 Planes; - u16 BPP; // 1: Monochrome bitmap - // 4: 16 color bitmap - // 8: 256 color bitmap - // 16: 16bit (high color) bitmap - // 24: 24bit (true color) bitmap - // 32: 32bit (true color) bitmap - - u32 Compression; // 0: none (Also identified by BI_RGB) - // 1: RLE 8-bit / pixel (Also identified by BI_RLE4) - // 2: RLE 4-bit / pixel (Also identified by BI_RLE8) - // 3: Bitfields (Also identified by BI_BITFIELDS) - - u32 BitmapDataSize; // Size of the bitmap data in bytes. This number must be rounded to the next 4 byte boundary. - u32 PixelPerMeterX; - u32 PixelPerMeterY; - u32 Colors; - u32 ImportantColors; -} PACK_STRUCT; - -// Default alignment -#include "irrunpack.h" - -/*! - Surface Loader for Windows bitmaps -*/ -class CImageLoaderBMP : public IImageLoader -{ -public: - //! constructor - CImageLoaderBMP(); - - //! returns true if the file maybe is able to be loaded by this class - //! based on the file extension (e.g. ".tga") - bool isALoadableFileExtension(const io::path &filename) const override; - - //! returns true if the file maybe is able to be loaded by this class - bool isALoadableFileFormat(io::IReadFile *file) const override; - - //! creates a surface from the file - IImage *loadImage(io::IReadFile *file) const override; - -private: - void decompress8BitRLE(u8 *&BmpData, s32 size, s32 width, s32 height, s32 pitch) const; - - void decompress4BitRLE(u8 *&BmpData, s32 size, s32 width, s32 height, s32 pitch) const; -}; - -} // end namespace video -} // end namespace irr diff --git a/irr/src/CMakeLists.txt b/irr/src/CMakeLists.txt index b95c3ef73..1fbfe5c9f 100644 --- a/irr/src/CMakeLists.txt +++ b/irr/src/CMakeLists.txt @@ -370,7 +370,6 @@ endif() set(IRRIMAGEOBJ CColorConverter.cpp CImage.cpp - CImageLoaderBMP.cpp CImageLoaderJPG.cpp CImageLoaderPNG.cpp CImageLoaderTGA.cpp diff --git a/irr/src/CNullDriver.cpp b/irr/src/CNullDriver.cpp index 74e8cb0f4..f17f6f454 100644 --- a/irr/src/CNullDriver.cpp +++ b/irr/src/CNullDriver.cpp @@ -22,9 +22,6 @@ namespace irr namespace video { -//! creates a loader which is able to load windows bitmaps -IImageLoader *createImageLoaderBMP(); - //! creates a loader which is able to load jpeg images IImageLoader *createImageLoaderJPG(); @@ -93,7 +90,6 @@ CNullDriver::CNullDriver(io::IFileSystem *io, const core::dimension2d &scre SurfaceLoader.push_back(video::createImageLoaderTGA()); SurfaceLoader.push_back(video::createImageLoaderPNG()); SurfaceLoader.push_back(video::createImageLoaderJPG()); - SurfaceLoader.push_back(video::createImageLoaderBMP()); SurfaceWriter.push_back(video::createImageWriterJPG()); SurfaceWriter.push_back(video::createImageWriterPNG()); diff --git a/src/client/client.cpp b/src/client/client.cpp index 6d42e7551..b308a9276 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -765,7 +765,7 @@ bool Client::loadMedia(const std::string &data, const std::string &filename, std::string name; const char *image_ext[] = { - ".png", ".jpg", ".bmp", ".tga", + ".png", ".jpg", ".tga", NULL }; name = removeStringEnd(filename, image_ext); diff --git a/src/client/texturepaths.cpp b/src/client/texturepaths.cpp index 960171859..f2efa6038 100644 --- a/src/client/texturepaths.cpp +++ b/src/client/texturepaths.cpp @@ -22,10 +22,8 @@ void clearTextureNameCache() // If failed, return "". std::string getImagePath(std::string_view path) { - // A NULL-ended list of possible image extensions - // (In newer C++ versions a fixed size array and ranges::subrange could be used - // or just modernise removeStringEnd.) - static const char *extensions[] = {".png", ".jpg", ".bmp", ".tga", nullptr}; + // possible image extensions + static const char *extensions[] = {".png", ".jpg", ".tga", nullptr}; // Remove present extension std::string_view stripped_path = removeStringEnd(path, extensions); diff --git a/src/server.cpp b/src/server.cpp index 46bc31ae7..a636364ed 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -2521,7 +2521,7 @@ bool Server::addMediaFile(const std::string &filename, } // If name is not in a supported format, ignore it const char *supported_ext[] = { - ".png", ".jpg", ".bmp", ".tga", + ".png", ".jpg", ".tga", ".ogg", ".x", ".b3d", ".obj", ".gltf", ".glb", // Translation file formats @@ -2547,13 +2547,6 @@ bool Server::addMediaFile(const std::string &filename, return false; } - const char *deprecated_ext[] = { ".bmp", nullptr }; - if (!removeStringEnd(filename, deprecated_ext).empty()) - { - warningstream << "Media file \"" << filename << "\" is using a" - " deprecated format and will stop working in the future." << std::endl; - } - SHA1 sha1; sha1.addBytes(filedata);