From 67f852be576027e07c94f08ff65f8065244e59a0 Mon Sep 17 00:00:00 2001 From: numzero Date: Mon, 20 Feb 2023 00:55:45 +0300 Subject: [PATCH] Drop obsolete configuration macros --- include/IrrCompileConfig.h | 21 +---- include/irrMath.h | 8 -- include/irrTypes.h | 2 - source/Irrlicht/BuiltInFont.h | 15 ---- source/Irrlicht/CAnimatedMeshSceneNode.cpp | 2 + source/Irrlicht/CB3DMeshFileLoader.cpp | 6 -- source/Irrlicht/CB3DMeshWriter.cpp | 5 -- source/Irrlicht/CBillboardSceneNode.cpp | 3 - source/Irrlicht/CBoneSceneNode.cpp | 5 -- source/Irrlicht/CFileSystem.cpp | 2 - source/Irrlicht/CGUIEnvironment.cpp | 5 +- source/Irrlicht/CImageLoaderBMP.cpp | 5 -- source/Irrlicht/CImageLoaderBMP.h | 10 --- source/Irrlicht/CImageLoaderJPG.cpp | 41 +++------ source/Irrlicht/CImageLoaderJPG.h | 16 +--- source/Irrlicht/CImageLoaderPNG.cpp | 23 +---- source/Irrlicht/CImageLoaderPNG.h | 4 - source/Irrlicht/CImageLoaderTGA.cpp | 5 -- source/Irrlicht/CImageLoaderTGA.h | 9 -- source/Irrlicht/CImageWriterJPG.cpp | 12 +-- source/Irrlicht/CImageWriterJPG.h | 4 - source/Irrlicht/CImageWriterPNG.cpp | 19 +---- source/Irrlicht/CImageWriterPNG.h | 4 - source/Irrlicht/CMakeLists.txt | 6 ++ source/Irrlicht/CNullDriver.cpp | 98 +--------------------- source/Irrlicht/COBJMeshFileLoader.cpp | 5 -- source/Irrlicht/CSceneManager.cpp | 63 -------------- source/Irrlicht/CSkinnedMesh.cpp | 5 -- source/Irrlicht/CXMeshFileLoader.cpp | 5 -- source/Irrlicht/CZipReader.cpp | 14 +--- source/Irrlicht/CZipReader.h | 4 - 31 files changed, 30 insertions(+), 396 deletions(-) diff --git a/include/IrrCompileConfig.h b/include/IrrCompileConfig.h index 5a4f8984..7536a849 100644 --- a/include/IrrCompileConfig.h +++ b/include/IrrCompileConfig.h @@ -23,7 +23,7 @@ //! Maximum number of texture an SMaterial can have, up to 8 are supported by Irrlicht. #define _IRR_MATERIAL_MAX_TEXTURES_ 4 - +#define _IRR_COMPILE_WITH_GUI_ #ifdef _WIN32 #define IRRCALLCONV __stdcall @@ -36,25 +36,6 @@ #endif -#define _IRR_COMPILE_WITH_GUI_ -#define _IRR_COMPILE_WITH_LIBJPEG_ -#define _IRR_COMPILE_WITH_LIBPNG_ -#define _IRR_COMPILE_WITH_BILLBOARD_SCENENODE_ -#define _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_ -#define _IRR_COMPILE_WITH_B3D_LOADER_ -#define _IRR_COMPILE_WITH_X_LOADER_ -#define _IRR_COMPILE_WITH_OBJ_LOADER_ -#define _IRR_COMPILE_WITH_BMP_LOADER_ -#define _IRR_COMPILE_WITH_JPG_LOADER_ -#define _IRR_COMPILE_WITH_PNG_LOADER_ -#define _IRR_COMPILE_WITH_TGA_LOADER_ -#define _IRR_COMPILE_WITH_JPG_WRITER_ -#define _IRR_COMPILE_WITH_PNG_WRITER_ -#define __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_ -#define _IRR_COMPILE_WITH_ZLIB_ -#define __IRR_HAS_S64 - - #ifdef _DEBUG //! A few attributes are written in CSceneManager when _IRR_SCENEMANAGER_DEBUG is enabled // NOTE: Those attributes were used always until 1.8.0 and became a global define for 1.8.1 diff --git a/include/irrMath.h b/include/irrMath.h index 994f8cd2..af00f440 100644 --- a/include/irrMath.h +++ b/include/irrMath.h @@ -21,9 +21,7 @@ namespace core const s32 ROUNDING_ERROR_S32 = 0; -#ifdef __IRR_HAS_S64 const s64 ROUNDING_ERROR_S64 = 0; -#endif const f32 ROUNDING_ERROR_f32 = 0.000001f; const f64 ROUNDING_ERROR_f64 = 0.00000001; @@ -186,7 +184,6 @@ namespace core return ROUNDING_ERROR_S32; } -#ifdef __IRR_HAS_S64 template <> inline s64 roundingError() { @@ -198,7 +195,6 @@ namespace core { return ROUNDING_ERROR_S64; } -#endif template inline T relativeErrorFactor() @@ -310,13 +306,11 @@ namespace core return a <= tolerance; } -#ifdef __IRR_HAS_S64 //! returns if a equals zero, taking rounding errors into account inline bool iszero(const s64 a, const s64 tolerance = 0) { return abs_(a) <= tolerance; } -#endif inline s32 s32_min(s32 a, s32 b) { @@ -406,13 +400,11 @@ namespace core return static_cast(squareroot(static_cast(f))); } -#ifdef __IRR_HAS_S64 // calculate: sqrt ( x ) REALINLINE s64 squareroot(const s64 f) { return static_cast(squareroot(static_cast(f))); } -#endif // calculate: 1 / sqrt ( x ) REALINLINE f64 reciprocal_squareroot(const f64 x) diff --git a/include/irrTypes.h b/include/irrTypes.h index e67b3958..eda3a21c 100644 --- a/include/irrTypes.h +++ b/include/irrTypes.h @@ -38,13 +38,11 @@ typedef uint32_t u32; typedef int32_t s32; -#ifdef __IRR_HAS_S64 //! 64 bit unsigned variable. typedef uint64_t u64; //! 64 bit signed variable. typedef int64_t s64; -#endif // __IRR_HAS_S64 diff --git a/source/Irrlicht/BuiltInFont.h b/source/Irrlicht/BuiltInFont.h index 467a49d1..be3a7f93 100644 --- a/source/Irrlicht/BuiltInFont.h +++ b/source/Irrlicht/BuiltInFont.h @@ -6,7 +6,6 @@ #define __BUILD_IN_FONT_H_INCLUDED__ #include "IrrCompileConfig.h" -#ifdef _IRR_COMPILE_WITH_GUI_ // header file generated by Bin2H, copyright 2002 by N.Gebhardt. // Bin2H is Freeware. Download it freely from www.code3d.com. @@ -16,7 +15,6 @@ namespace irr { namespace gui { -#ifdef _IRR_COMPILE_WITH_BMP_LOADER_ const u8 BuiltInFontData[] = { 0x42, 0x4d, 0x4a, 0x20, 0x00, 0x00, 0x00, 0x00, @@ -1056,20 +1054,7 @@ const u8 BuiltInFontData[] = }; const u32 BuiltInFontDataSize = sizeof(BuiltInFontData); - -#else // !defined(_IRR_COMPILE_WITH_BMP_LOADER_) - - // built-in font cannot be loaded if there is no BMP loader - - const u8 * const BuiltInFontData=0; - - const u32 BuiltInFontDataSize = 0; - -#endif } // end namespace gui } // end namespace irr -#endif // _IRR_COMPILE_WITH_GUI_ - #endif - diff --git a/source/Irrlicht/CAnimatedMeshSceneNode.cpp b/source/Irrlicht/CAnimatedMeshSceneNode.cpp index 9d92e038..cea8ef29 100644 --- a/source/Irrlicht/CAnimatedMeshSceneNode.cpp +++ b/source/Irrlicht/CAnimatedMeshSceneNode.cpp @@ -7,7 +7,9 @@ #include "ISceneManager.h" #include "S3DVertex.h" #include "os.h" +#ifdef _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_ #include "CSkinnedMesh.h" +#endif #include "IDummyTransformationSceneNode.h" #include "IBoneSceneNode.h" #include "IMaterialRenderer.h" diff --git a/source/Irrlicht/CB3DMeshFileLoader.cpp b/source/Irrlicht/CB3DMeshFileLoader.cpp index ca86a6a4..83ec3736 100644 --- a/source/Irrlicht/CB3DMeshFileLoader.cpp +++ b/source/Irrlicht/CB3DMeshFileLoader.cpp @@ -7,8 +7,6 @@ // declared public domain #include "IrrCompileConfig.h" -#ifdef _IRR_COMPILE_WITH_B3D_LOADER_ - #include "CB3DMeshFileLoader.h" #include "IVideoDriver.h" @@ -1055,7 +1053,3 @@ void CB3DMeshFileLoader::readFloats(f32* vec, u32 count) } // end namespace scene } // end namespace irr - - -#endif // _IRR_COMPILE_WITH_B3D_LOADER_ - diff --git a/source/Irrlicht/CB3DMeshWriter.cpp b/source/Irrlicht/CB3DMeshWriter.cpp index aaca1680..0b588fc0 100644 --- a/source/Irrlicht/CB3DMeshWriter.cpp +++ b/source/Irrlicht/CB3DMeshWriter.cpp @@ -6,8 +6,6 @@ #include "IrrCompileConfig.h" -#ifdef _IRR_COMPILE_WITH_B3D_WRITER_ - #include "CB3DMeshWriter.h" #include "os.h" #include "ISkinnedMesh.h" @@ -531,6 +529,3 @@ void CB3DMeshWriter::writeSizeFrom(io::IWriteFile* file, const u32 from, const u } // end namespace } // end namespace - -#endif // _IRR_COMPILE_WITH_B3D_WRITER_ - diff --git a/source/Irrlicht/CBillboardSceneNode.cpp b/source/Irrlicht/CBillboardSceneNode.cpp index a1464eb1..c297978e 100644 --- a/source/Irrlicht/CBillboardSceneNode.cpp +++ b/source/Irrlicht/CBillboardSceneNode.cpp @@ -3,7 +3,6 @@ // For conditions of distribution and use, see copyright notice in irrlicht.h #include "IrrCompileConfig.h" -#ifdef _IRR_COMPILE_WITH_BILLBOARD_SCENENODE_ #include "CBillboardSceneNode.h" #include "IVideoDriver.h" #include "ISceneManager.h" @@ -281,5 +280,3 @@ ISceneNode* CBillboardSceneNode::clone(ISceneNode* newParent, ISceneManager* new } // end namespace scene } // end namespace irr - -#endif // _IRR_COMPILE_WITH_BILLBOARD_SCENENODE_ diff --git a/source/Irrlicht/CBoneSceneNode.cpp b/source/Irrlicht/CBoneSceneNode.cpp index 04ef8c7d..4f05b842 100644 --- a/source/Irrlicht/CBoneSceneNode.cpp +++ b/source/Irrlicht/CBoneSceneNode.cpp @@ -3,8 +3,6 @@ // For conditions of distribution and use, see copyright notice in irrlicht.h #include "IrrCompileConfig.h" -#ifdef _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_ - #include "CBoneSceneNode.h" namespace irr @@ -98,6 +96,3 @@ void CBoneSceneNode::updateAbsolutePositionOfAllChildren() } // namespace scene } // namespace irr - -#endif - diff --git a/source/Irrlicht/CFileSystem.cpp b/source/Irrlicht/CFileSystem.cpp index 45e8680c..17ae7b33 100644 --- a/source/Irrlicht/CFileSystem.cpp +++ b/source/Irrlicht/CFileSystem.cpp @@ -54,9 +54,7 @@ CFileSystem::CFileSystem() //! reset current working directory getWorkingDirectory(); -#ifdef __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_ ArchiveLoader.push_back(new CArchiveLoaderZIP(this)); -#endif } diff --git a/source/Irrlicht/CGUIEnvironment.cpp b/source/Irrlicht/CGUIEnvironment.cpp index 6d15706b..8ad956de 100644 --- a/source/Irrlicht/CGUIEnvironment.cpp +++ b/source/Irrlicht/CGUIEnvironment.cpp @@ -25,8 +25,9 @@ #include "CGUIComboBox.h" #include "IWriteFile.h" - +#ifdef IRR_ENABLE_BUILTIN_FONT #include "BuiltInFont.h" +#endif #include "os.h" namespace irr @@ -143,6 +144,7 @@ CGUIEnvironment::~CGUIEnvironment() void CGUIEnvironment::loadBuiltInFont() { +#ifdef IRR_ENABLE_BUILTIN_FONT io::IReadFile* file = FileSystem->createMemoryReadFile(BuiltInFontData, BuiltInFontDataSize, DefaultFontName, false); @@ -161,6 +163,7 @@ void CGUIEnvironment::loadBuiltInFont() Fonts.push_back(f); file->drop(); +#endif } diff --git a/source/Irrlicht/CImageLoaderBMP.cpp b/source/Irrlicht/CImageLoaderBMP.cpp index 234c5157..a913101a 100644 --- a/source/Irrlicht/CImageLoaderBMP.cpp +++ b/source/Irrlicht/CImageLoaderBMP.cpp @@ -4,8 +4,6 @@ #include "CImageLoaderBMP.h" -#ifdef _IRR_COMPILE_WITH_BMP_LOADER_ - #include "IReadFile.h" #include "SColor.h" #include "CColorConverter.h" @@ -371,6 +369,3 @@ IImageLoader* createImageLoaderBMP() } // end namespace video } // end namespace irr - -#endif - diff --git a/source/Irrlicht/CImageLoaderBMP.h b/source/Irrlicht/CImageLoaderBMP.h index 5d993ce5..6217f1b2 100644 --- a/source/Irrlicht/CImageLoaderBMP.h +++ b/source/Irrlicht/CImageLoaderBMP.h @@ -15,9 +15,6 @@ namespace irr namespace video { -#if defined(_IRR_COMPILE_WITH_BMP_LOADER_) || defined(_IRR_COMPILE_WITH_BMP_WRITER_) - - // byte-align structures #include "irrpack.h" @@ -59,10 +56,6 @@ namespace video // Default alignment #include "irrunpack.h" -#endif // defined with loader or writer - -#ifdef _IRR_COMPILE_WITH_BMP_LOADER_ - /*! Surface Loader for Windows bitmaps */ @@ -91,10 +84,7 @@ private: }; -#endif // compiled with loader - } // end namespace video } // end namespace irr #endif - diff --git a/source/Irrlicht/CImageLoaderJPG.cpp b/source/Irrlicht/CImageLoaderJPG.cpp index 0d19d713..c7b5df20 100644 --- a/source/Irrlicht/CImageLoaderJPG.cpp +++ b/source/Irrlicht/CImageLoaderJPG.cpp @@ -4,8 +4,6 @@ #include "CImageLoaderJPG.h" -#ifdef _IRR_COMPILE_WITH_JPG_LOADER_ - #include "IReadFile.h" #include "CImage.h" #include "os.h" @@ -40,21 +38,18 @@ bool CImageLoaderJPG::isALoadableFileExtension(const io::path& filename) const return core::hasFileExtension ( filename, "jpg", "jpeg" ); } +// struct for handling jpeg errors +struct irr_jpeg_error_mgr +{ + // public jpeg error fields + struct jpeg_error_mgr pub; -#ifdef _IRR_COMPILE_WITH_LIBJPEG_ + // for longjmp, to return to caller on a fatal error + jmp_buf setjmp_buffer; - // struct for handling jpeg errors - struct irr_jpeg_error_mgr - { - // public jpeg error fields - struct jpeg_error_mgr pub; - - // for longjmp, to return to caller on a fatal error - jmp_buf setjmp_buffer; - - // for having access to the filename when printing the error messages - core::stringc* filename; - }; + // for having access to the filename when printing the error messages + core::stringc* filename; +}; void CImageLoaderJPG::init_source (j_decompress_ptr cinfo) { @@ -116,31 +111,20 @@ void CImageLoaderJPG::output_message(j_common_ptr cinfo) errMsg += *myerr->filename; os::Printer::log(errMsg.c_str(),temp1, ELL_ERROR); } -#endif // _IRR_COMPILE_WITH_LIBJPEG_ //! returns true if the file maybe is able to be loaded by this class bool CImageLoaderJPG::isALoadableFileFormat(io::IReadFile* file) const { - #ifndef _IRR_COMPILE_WITH_LIBJPEG_ - return false; - #else - if (!(file && file->seek(0))) return false; unsigned char header[3]; size_t headerLen = file->read(header, sizeof(header)); return headerLen >= 3 && !memcmp(header, "\xFF\xD8\xFF", 3); - #endif } //! creates a surface from the file IImage* CImageLoaderJPG::loadImage(io::IReadFile* file) const { - #ifndef _IRR_COMPILE_WITH_LIBJPEG_ - os::Printer::log("Can't load as not compiled with _IRR_COMPILE_WITH_LIBJPEG_:", file->getFileName(), ELL_DEBUG); - return 0; - #else - if (!file) return 0; @@ -288,8 +272,6 @@ IImage* CImageLoaderJPG::loadImage(io::IReadFile* file) const delete [] input; return image; - - #endif } @@ -302,6 +284,3 @@ IImageLoader* createImageLoaderJPG() } // end namespace video } // end namespace irr - -#endif - diff --git a/source/Irrlicht/CImageLoaderJPG.h b/source/Irrlicht/CImageLoaderJPG.h index 146adbe8..7e727a38 100644 --- a/source/Irrlicht/CImageLoaderJPG.h +++ b/source/Irrlicht/CImageLoaderJPG.h @@ -7,17 +7,11 @@ #include "IrrCompileConfig.h" -#ifdef _IRR_COMPILE_WITH_JPG_LOADER_ - #include "IImageLoader.h" #include // required for jpeglib.h -#ifdef _IRR_COMPILE_WITH_LIBJPEG_ -extern "C" { - #include // use system lib - #include -} -#endif // _IRR_COMPILE_WITH_LIBJPEG_ +#include // use system lib +#include namespace irr @@ -48,8 +42,6 @@ public: IImage* loadImage(io::IReadFile* file) const override; private: - -#ifdef _IRR_COMPILE_WITH_LIBJPEG_ // several methods used via function pointers by jpeglib /* Receives control for a fatal error. Information sufficient to @@ -95,8 +87,6 @@ private: /* Terminate source --- called by jpeg_finish_decompress() after all data has been read. Often a no-op. */ static void term_source (j_decompress_ptr cinfo); - - #endif // _IRR_COMPILE_WITH_LIBJPEG_ }; @@ -105,5 +95,3 @@ private: #endif -#endif - diff --git a/source/Irrlicht/CImageLoaderPNG.cpp b/source/Irrlicht/CImageLoaderPNG.cpp index b4680173..59709bfb 100644 --- a/source/Irrlicht/CImageLoaderPNG.cpp +++ b/source/Irrlicht/CImageLoaderPNG.cpp @@ -4,11 +4,7 @@ #include "CImageLoaderPNG.h" -#ifdef _IRR_COMPILE_WITH_PNG_LOADER_ - -#ifdef _IRR_COMPILE_WITH_LIBPNG_ - #include // use system lib png -#endif // _IRR_COMPILE_WITH_LIBPNG_ +#include // use system lib png #include "CImage.h" #include "CReadFile.h" @@ -19,7 +15,6 @@ namespace irr namespace video { -#ifdef _IRR_COMPILE_WITH_LIBPNG_ // PNG function for error handling static void png_cpexcept_error(png_structp png_ptr, png_const_charp msg) { @@ -46,25 +41,19 @@ void PNGAPI user_read_data_fcn(png_structp png_ptr, png_bytep data, png_size_t l if (check != length) png_error(png_ptr, "Read Error"); } -#endif // _IRR_COMPILE_WITH_LIBPNG_ //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".tga") bool CImageLoaderPng::isALoadableFileExtension(const io::path& filename) const { -#ifdef _IRR_COMPILE_WITH_LIBPNG_ return core::hasFileExtension ( filename, "png" ); -#else - return false; -#endif // _IRR_COMPILE_WITH_LIBPNG_ } //! returns true if the file maybe is able to be loaded by this class bool CImageLoaderPng::isALoadableFileFormat(io::IReadFile* file) const { -#ifdef _IRR_COMPILE_WITH_LIBPNG_ if (!file) return false; @@ -75,16 +64,12 @@ bool CImageLoaderPng::isALoadableFileFormat(io::IReadFile* file) const // Check if it really is a PNG file return !png_sig_cmp(buffer, 0, 8); -#else - return false; -#endif // _IRR_COMPILE_WITH_LIBPNG_ } // load in the image data IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const { -#ifdef _IRR_COMPILE_WITH_LIBPNG_ if (!file) return 0; @@ -267,9 +252,6 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const png_destroy_read_struct(&png_ptr,&info_ptr, 0); // Clean up memory return image; -#else - return 0; -#endif // _IRR_COMPILE_WITH_LIBPNG_ } @@ -281,6 +263,3 @@ IImageLoader* createImageLoaderPNG() }// end namespace irr }//end namespace video - -#endif - diff --git a/source/Irrlicht/CImageLoaderPNG.h b/source/Irrlicht/CImageLoaderPNG.h index 6e631b72..ed135db9 100644 --- a/source/Irrlicht/CImageLoaderPNG.h +++ b/source/Irrlicht/CImageLoaderPNG.h @@ -11,8 +11,6 @@ #include "IrrCompileConfig.h" -#ifdef _IRR_COMPILE_WITH_PNG_LOADER_ - #include "IImageLoader.h" namespace irr @@ -41,5 +39,3 @@ public: } // end namespace irr #endif -#endif - diff --git a/source/Irrlicht/CImageLoaderTGA.cpp b/source/Irrlicht/CImageLoaderTGA.cpp index af4fad55..3286bddd 100644 --- a/source/Irrlicht/CImageLoaderTGA.cpp +++ b/source/Irrlicht/CImageLoaderTGA.cpp @@ -4,8 +4,6 @@ #include "CImageLoaderTGA.h" -#ifdef _IRR_COMPILE_WITH_TGA_LOADER_ - #include "IReadFile.h" #include "os.h" #include "CColorConverter.h" @@ -238,6 +236,3 @@ IImageLoader* createImageLoaderTGA() } // end namespace video } // end namespace irr - -#endif - diff --git a/source/Irrlicht/CImageLoaderTGA.h b/source/Irrlicht/CImageLoaderTGA.h index d8f7368b..f31c6825 100644 --- a/source/Irrlicht/CImageLoaderTGA.h +++ b/source/Irrlicht/CImageLoaderTGA.h @@ -15,8 +15,6 @@ namespace irr namespace video { -#if defined(_IRR_COMPILE_WITH_TGA_LOADER_) || defined(_IRR_COMPILE_WITH_TGA_WRITER_) - // byte-align structures #include "irrpack.h" @@ -46,10 +44,6 @@ namespace video // Default alignment #include "irrunpack.h" -#endif // compiled with loader or reader - -#ifdef _IRR_COMPILE_WITH_TGA_LOADER_ - /*! Surface Loader for targa images */ @@ -73,10 +67,7 @@ private: u8* loadCompressedImage(io::IReadFile *file, const STGAHeader& header) const; }; -#endif // compiled with loader - } // end namespace video } // end namespace irr #endif - diff --git a/source/Irrlicht/CImageWriterJPG.cpp b/source/Irrlicht/CImageWriterJPG.cpp index 97a64b84..1fb9fb37 100644 --- a/source/Irrlicht/CImageWriterJPG.cpp +++ b/source/Irrlicht/CImageWriterJPG.cpp @@ -4,15 +4,12 @@ #include "CImageWriterJPG.h" -#ifdef _IRR_COMPILE_WITH_JPG_WRITER_ - #include "CColorConverter.h" #include "IWriteFile.h" #include "CImage.h" #include "irrString.h" #include "os.h" -#ifdef _IRR_COMPILE_WITH_LIBJPEG_ #include // required for jpeglib.h extern "C" { @@ -181,7 +178,7 @@ static bool writeJPEGFile(io::IWriteFile* file, IImage* image, u32 quality) } // namespace video } // namespace irr -#endif // _IRR_COMPILE_WITH_LIBJPEG_ + namespace irr { @@ -209,15 +206,8 @@ bool CImageWriterJPG::isAWriteableFileExtension(const io::path& filename) const bool CImageWriterJPG::writeImage(io::IWriteFile *file, IImage *image, u32 quality) const { -#ifndef _IRR_COMPILE_WITH_LIBJPEG_ - return false; -#else return writeJPEGFile(file, image, quality); -#endif } } // namespace video } // namespace irr - -#endif - diff --git a/source/Irrlicht/CImageWriterJPG.h b/source/Irrlicht/CImageWriterJPG.h index ec8a1b85..facf67d2 100644 --- a/source/Irrlicht/CImageWriterJPG.h +++ b/source/Irrlicht/CImageWriterJPG.h @@ -7,8 +7,6 @@ #include "IrrCompileConfig.h" -#ifdef _IRR_COMPILE_WITH_JPG_WRITER_ - #include "IImageWriter.h" namespace irr @@ -33,5 +31,3 @@ public: } #endif // _C_IMAGE_WRITER_JPG_H_INCLUDED__ -#endif - diff --git a/source/Irrlicht/CImageWriterPNG.cpp b/source/Irrlicht/CImageWriterPNG.cpp index 55ae00ec..0e2a71ec 100644 --- a/source/Irrlicht/CImageWriterPNG.cpp +++ b/source/Irrlicht/CImageWriterPNG.cpp @@ -4,17 +4,13 @@ #include "CImageWriterPNG.h" -#ifdef _IRR_COMPILE_WITH_PNG_WRITER_ - #include "CImageLoaderPNG.h" #include "CColorConverter.h" #include "IWriteFile.h" #include "irrString.h" #include "os.h" // for logging -#ifdef _IRR_COMPILE_WITH_LIBPNG_ - #include // use system lib png -#endif // _IRR_COMPILE_WITH_LIBPNG_ +#include // use system lib png namespace irr { @@ -26,7 +22,6 @@ IImageWriter* createImageWriterPNG() return new CImageWriterPNG; } -#ifdef _IRR_COMPILE_WITH_LIBPNG_ // PNG function for error handling static void png_cpexcept_error(png_structp png_ptr, png_const_charp msg) { @@ -51,7 +46,6 @@ void PNGAPI user_write_data_fcn(png_structp png_ptr, png_bytep data, png_size_t if (check != length) png_error(png_ptr, "Write Error"); } -#endif // _IRR_COMPILE_WITH_LIBPNG_ CImageWriterPNG::CImageWriterPNG() { @@ -62,16 +56,11 @@ CImageWriterPNG::CImageWriterPNG() bool CImageWriterPNG::isAWriteableFileExtension(const io::path& filename) const { -#ifdef _IRR_COMPILE_WITH_LIBPNG_ return core::hasFileExtension ( filename, "png" ); -#else - return false; -#endif } bool CImageWriterPNG::writeImage(io::IWriteFile* file, IImage* image,u32 param) const { -#ifdef _IRR_COMPILE_WITH_LIBPNG_ if (!file || !image) return false; @@ -206,13 +195,7 @@ bool CImageWriterPNG::writeImage(io::IWriteFile* file, IImage* image,u32 param) delete [] tmpImage; png_destroy_write_struct(&png_ptr, &info_ptr); return true; -#else - return false; -#endif } } // namespace video } // namespace irr - -#endif - diff --git a/source/Irrlicht/CImageWriterPNG.h b/source/Irrlicht/CImageWriterPNG.h index eec12ff0..4d6619f5 100644 --- a/source/Irrlicht/CImageWriterPNG.h +++ b/source/Irrlicht/CImageWriterPNG.h @@ -7,8 +7,6 @@ #include "IrrCompileConfig.h" -#ifdef _IRR_COMPILE_WITH_PNG_WRITER_ - #include "IImageWriter.h" namespace irr @@ -33,5 +31,3 @@ public: } // namespace irr #endif // _C_IMAGE_WRITER_PNG_H_INCLUDED__ -#endif - diff --git a/source/Irrlicht/CMakeLists.txt b/source/Irrlicht/CMakeLists.txt index eeb1029a..7b511455 100644 --- a/source/Irrlicht/CMakeLists.txt +++ b/source/Irrlicht/CMakeLists.txt @@ -63,6 +63,12 @@ if(NOT REVISION_SANITY_CHECK) message(FATAL_ERROR "IrrlichtMt revision number mismatches between CMake and headers.") endif() +# Platform-independent configuration (hard-coded currently) +add_definitions( + -DIRR_ENABLE_BUILTIN_FONT + -D_IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_ + ) + # Platform-specific configuration if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") diff --git a/source/Irrlicht/CNullDriver.cpp b/source/Irrlicht/CNullDriver.cpp index 775a22c9..5834e01c 100644 --- a/source/Irrlicht/CNullDriver.cpp +++ b/source/Irrlicht/CNullDriver.cpp @@ -32,57 +32,15 @@ IImageLoader* createImageLoaderJPG(); //! creates a loader which is able to load targa images IImageLoader* createImageLoaderTGA(); -//! creates a loader which is able to load psd images -IImageLoader* createImageLoaderPSD(); - -//! creates a loader which is able to load psd images -IImageLoader* createImageLoaderPVR(); - -//! creates a loader which is able to load dds images -IImageLoader* createImageLoaderDDS(); - -//! creates a loader which is able to load pcx images -IImageLoader* createImageLoaderPCX(); - //! creates a loader which is able to load png images IImageLoader* createImageLoaderPNG(); -//! creates a loader which is able to load WAL images -IImageLoader* createImageLoaderWAL(); - -//! creates a loader which is able to load halflife images -IImageLoader* createImageLoaderHalfLife(); - -//! creates a loader which is able to load lmp images -IImageLoader* createImageLoaderLMP(); - -//! creates a loader which is able to load ppm/pgm/pbm images -IImageLoader* createImageLoaderPPM(); - -//! creates a loader which is able to load rgb images -IImageLoader* createImageLoaderRGB(); - - -//! creates a writer which is able to save bmp images -IImageWriter* createImageWriterBMP(); - //! creates a writer which is able to save jpg images IImageWriter* createImageWriterJPG(); -//! creates a writer which is able to save tga images -IImageWriter* createImageWriterTGA(); - -//! creates a writer which is able to save psd images -IImageWriter* createImageWriterPSD(); - -//! creates a writer which is able to save pcx images -IImageWriter* createImageWriterPCX(); - //! creates a writer which is able to save png images IImageWriter* createImageWriterPNG(); -//! creates a writer which is able to save ppm images -IImageWriter* createImageWriterPPM(); //! constructor CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d& screenSize) @@ -124,68 +82,14 @@ CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d& scre if (FileSystem) FileSystem->grab(); - // create surface loader - -#ifdef _IRR_COMPILE_WITH_WAL_LOADER_ - SurfaceLoader.push_back(video::createImageLoaderHalfLife()); - SurfaceLoader.push_back(video::createImageLoaderWAL()); -#endif -#ifdef _IRR_COMPILE_WITH_LMP_LOADER_ - SurfaceLoader.push_back(video::createImageLoaderLMP()); -#endif -#ifdef _IRR_COMPILE_WITH_PPM_LOADER_ - SurfaceLoader.push_back(video::createImageLoaderPPM()); -#endif -#ifdef _IRR_COMPILE_WITH_RGB_LOADER_ - SurfaceLoader.push_back(video::createImageLoaderRGB()); -#endif -#ifdef _IRR_COMPILE_WITH_PSD_LOADER_ - SurfaceLoader.push_back(video::createImageLoaderPSD()); -#endif -#ifdef _IRR_COMPILE_WITH_PVR_LOADER_ - SurfaceLoader.push_back(video::createImageLoaderPVR()); -#endif -#if defined(_IRR_COMPILE_WITH_DDS_LOADER_) || defined(_IRR_COMPILE_WITH_DDS_DECODER_LOADER_) - SurfaceLoader.push_back(video::createImageLoaderDDS()); -#endif -#ifdef _IRR_COMPILE_WITH_PCX_LOADER_ - SurfaceLoader.push_back(video::createImageLoaderPCX()); -#endif -#ifdef _IRR_COMPILE_WITH_TGA_LOADER_ + // create surface loaders and writers SurfaceLoader.push_back(video::createImageLoaderTGA()); -#endif -#ifdef _IRR_COMPILE_WITH_PNG_LOADER_ SurfaceLoader.push_back(video::createImageLoaderPNG()); -#endif -#ifdef _IRR_COMPILE_WITH_JPG_LOADER_ SurfaceLoader.push_back(video::createImageLoaderJPG()); -#endif -#ifdef _IRR_COMPILE_WITH_BMP_LOADER_ SurfaceLoader.push_back(video::createImageLoaderBMP()); -#endif - -#ifdef _IRR_COMPILE_WITH_PPM_WRITER_ - SurfaceWriter.push_back(video::createImageWriterPPM()); -#endif -#ifdef _IRR_COMPILE_WITH_PCX_WRITER_ - SurfaceWriter.push_back(video::createImageWriterPCX()); -#endif -#ifdef _IRR_COMPILE_WITH_PSD_WRITER_ - SurfaceWriter.push_back(video::createImageWriterPSD()); -#endif -#ifdef _IRR_COMPILE_WITH_TGA_WRITER_ - SurfaceWriter.push_back(video::createImageWriterTGA()); -#endif -#ifdef _IRR_COMPILE_WITH_JPG_WRITER_ SurfaceWriter.push_back(video::createImageWriterJPG()); -#endif -#ifdef _IRR_COMPILE_WITH_PNG_WRITER_ SurfaceWriter.push_back(video::createImageWriterPNG()); -#endif -#ifdef _IRR_COMPILE_WITH_BMP_WRITER_ - SurfaceWriter.push_back(video::createImageWriterBMP()); -#endif // set ExposedData to 0 diff --git a/source/Irrlicht/COBJMeshFileLoader.cpp b/source/Irrlicht/COBJMeshFileLoader.cpp index c4fee234..11fa484a 100644 --- a/source/Irrlicht/COBJMeshFileLoader.cpp +++ b/source/Irrlicht/COBJMeshFileLoader.cpp @@ -3,8 +3,6 @@ // For conditions of distribution and use, see copyright notice in irrlicht.h #include "IrrCompileConfig.h" -#ifdef _IRR_COMPILE_WITH_OBJ_LOADER_ - #include "COBJMeshFileLoader.h" #include "IMeshManipulator.h" #include "IVideoDriver.h" @@ -612,6 +610,3 @@ void COBJMeshFileLoader::cleanUp() } // end namespace scene } // end namespace irr - -#endif // _IRR_COMPILE_WITH_OBJ_LOADER_ - diff --git a/source/Irrlicht/CSceneManager.cpp b/source/Irrlicht/CSceneManager.cpp index 664e672d..b664c772 100644 --- a/source/Irrlicht/CSceneManager.cpp +++ b/source/Irrlicht/CSceneManager.cpp @@ -15,27 +15,11 @@ #include "os.h" -// We need this include for the case of skinned mesh support without -// any such loader -#ifdef _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_ #include "CSkinnedMesh.h" -#endif - -#ifdef _IRR_COMPILE_WITH_X_LOADER_ #include "CXMeshFileLoader.h" -#endif - -#ifdef _IRR_COMPILE_WITH_OBJ_LOADER_ #include "COBJMeshFileLoader.h" -#endif - -#ifdef _IRR_COMPILE_WITH_B3D_LOADER_ #include "CB3DMeshFileLoader.h" -#endif - -#ifdef _IRR_COMPILE_WITH_BILLBOARD_SCENENODE_ #include "CBillboardSceneNode.h" -#endif // _IRR_COMPILE_WITH_BILLBOARD_SCENENODE_ #include "CAnimatedMeshSceneNode.h" #include "CCameraSceneNode.h" #include "CMeshSceneNode.h" @@ -96,15 +80,9 @@ CSceneManager::CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs, // TODO: now that we have multiple scene managers, these should be // shallow copies from the previous manager if there is one. - #ifdef _IRR_COMPILE_WITH_X_LOADER_ MeshLoaderList.push_back(new CXMeshFileLoader(this, FileSystem)); - #endif - #ifdef _IRR_COMPILE_WITH_OBJ_LOADER_ MeshLoaderList.push_back(new COBJMeshFileLoader(this, FileSystem)); - #endif - #ifdef _IRR_COMPILE_WITH_B3D_LOADER_ MeshLoaderList.push_back(new CB3DMeshFileLoader(this)); - #endif } @@ -316,7 +294,6 @@ IBillboardSceneNode* CSceneManager::addBillboardSceneNode(ISceneNode* parent, video::SColor colorTop, video::SColor colorBottom ) { -#ifdef _IRR_COMPILE_WITH_BILLBOARD_SCENENODE_ if (!parent) parent = this; @@ -325,9 +302,6 @@ IBillboardSceneNode* CSceneManager::addBillboardSceneNode(ISceneNode* parent, node->drop(); return node; -#else - return 0; -#endif } @@ -971,49 +945,12 @@ const video::SColorf& CSceneManager::getAmbientLight() const //! Get a skinned mesh, which is not available as header-only code ISkinnedMesh* CSceneManager::createSkinnedMesh() { -#ifdef _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_ return new CSkinnedMesh(); -#else - return 0; -#endif } //! Returns a mesh writer implementation if available IMeshWriter* CSceneManager::createMeshWriter(EMESH_WRITER_TYPE type) { - switch(type) - { - case EMWT_IRR_MESH: - case EMWT_COLLADA: - return 0; - case EMWT_STL: -#ifdef _IRR_COMPILE_WITH_STL_WRITER_ - return new CSTLMeshWriter(this); -#else - return 0; -#endif - case EMWT_OBJ: -#ifdef _IRR_COMPILE_WITH_OBJ_WRITER_ - return new COBJMeshWriter(this, FileSystem); -#else - return 0; -#endif - - case EMWT_PLY: -#ifdef _IRR_COMPILE_WITH_PLY_WRITER_ - return new CPLYMeshWriter(); -#else - return 0; -#endif - - case EMWT_B3D: -#ifdef _IRR_COMPILE_WITH_B3D_WRITER_ - return new CB3DMeshWriter(); -#else - return 0; -#endif - } - return 0; } diff --git a/source/Irrlicht/CSkinnedMesh.cpp b/source/Irrlicht/CSkinnedMesh.cpp index 9f47f3b6..5e01e060 100644 --- a/source/Irrlicht/CSkinnedMesh.cpp +++ b/source/Irrlicht/CSkinnedMesh.cpp @@ -3,8 +3,6 @@ // For conditions of distribution and use, see copyright notice in irrlicht.h #include "IrrCompileConfig.h" -#ifdef _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_ - #include "CSkinnedMesh.h" #include "CBoneSceneNode.h" #include "IAnimatedMeshSceneNode.h" @@ -1539,6 +1537,3 @@ void CSkinnedMesh::calculateTangents( } // end namespace scene } // end namespace irr - -#endif // _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_ - diff --git a/source/Irrlicht/CXMeshFileLoader.cpp b/source/Irrlicht/CXMeshFileLoader.cpp index 2de099fe..dfeefd33 100644 --- a/source/Irrlicht/CXMeshFileLoader.cpp +++ b/source/Irrlicht/CXMeshFileLoader.cpp @@ -4,8 +4,6 @@ #include "IrrCompileConfig.h" -#ifdef _IRR_COMPILE_WITH_X_LOADER_ - #include "CXMeshFileLoader.h" #include "os.h" @@ -2359,6 +2357,3 @@ bool CXMeshFileLoader::readMatrix(core::matrix4& mat) } // end namespace scene } // end namespace irr - -#endif // _IRR_COMPILE_WITH_X_LOADER_ - diff --git a/source/Irrlicht/CZipReader.cpp b/source/Irrlicht/CZipReader.cpp index d394313d..500db900 100644 --- a/source/Irrlicht/CZipReader.cpp +++ b/source/Irrlicht/CZipReader.cpp @@ -7,16 +7,12 @@ #include "os.h" -#ifdef __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_ - #include "CFileList.h" #include "CReadFile.h" #include "coreutil.h" #include "IrrCompileConfig.h" -#ifdef _IRR_COMPILE_WITH_ZLIB_ - #include // use system lib -#endif +#include // use system lib namespace irr { @@ -464,8 +460,6 @@ IReadFile* CZipReader::createAndOpenFile(u32 index) } case 8: { - #ifdef _IRR_COMPILE_WITH_ZLIB_ - const u32 uncompressedSize = e.header.DataDescriptor.UncompressedSize; c8* pBuf = new c8[ uncompressedSize ]; if (!pBuf) @@ -531,10 +525,6 @@ IReadFile* CZipReader::createAndOpenFile(u32 index) } else return FileSystem->createMemoryReadFile(pBuf, uncompressedSize, Files[index].FullName, true); - - #else - return 0; // zlib not compiled, we cannot decompress the data. - #endif } case 12: { @@ -560,5 +550,3 @@ IReadFile* CZipReader::createAndOpenFile(u32 index) } // end namespace io } // end namespace irr - -#endif // __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_ diff --git a/source/Irrlicht/CZipReader.h b/source/Irrlicht/CZipReader.h index 458b6db4..02de98fb 100644 --- a/source/Irrlicht/CZipReader.h +++ b/source/Irrlicht/CZipReader.h @@ -7,8 +7,6 @@ #include "IrrCompileConfig.h" -#ifdef __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_ - #include "IReadFile.h" #include "irrArray.h" #include "irrString.h" @@ -226,6 +224,4 @@ namespace io } // end namespace io } // end namespace irr -#endif // __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_ #endif // __C_ZIP_READER_H_INCLUDED__ -