diff --git a/changes.txt b/changes.txt index 96e0779..56ecbf8 100644 --- a/changes.txt +++ b/changes.txt @@ -11,6 +11,8 @@ Changes in ogl-es (not yet released - will be merged with trunk at some point) -------------------------- Changes in 1.9 (not yet released) +- TGA loader no longer reduces 24&32 bit TGA's with palettes to 16 bit. Thanks @erlehmann for report: https://irrlicht.sourceforge.io/forum/viewtopic.php?t=52925 +- Fix compile error with OS X 10.10 SDK, bug #463. Thanks @Ryan Schmidt for report and patch. - Optimize quaternion::rotationFromTo. Thanks @Robert Eisele for patch and proof (https://raw.org/proof/quaternion-from-two-vectors) - Shader material example shows now how to pass material values. In 1.8 we could still use gl_FrontMaterial, but that is no longer supported in shaders @@ -408,6 +410,29 @@ Changes in 1.9 (not yet released) -------------------------- Changes in 1.8.6 +- CXMeshFileLoader: fix buffer overreads with text format. Thanks @sfan5 for report and patch. + Patch (commit 6f4f7c4 to Minetest): https://github.com/minetest/irrlicht/commit/6f4f7c4d75c9d563e98d3936ed8bc6e248dc14a8 +- Fix CB3DMeshFileLoader::readString. Prevent adding a character beyond file-end. Thanks @sfan5 for report and patch. + Original patch (commit 103ab16 to Minetest): https://github.com/minetest/irrlicht/commit/103ab16679a42cb1bfa4cc4e6316195ec2d139b6 +- CB3DMeshFileLoader: add some bounds checks. Thanks @sfan5 for report and patch. + Original patch (commit 64688f4 to Minetest): https://github.com/minetest/irrlicht/commit/64688f449099246ec27eb013f58d72a0abb1c6e6 +- TGA loader: Fix number overflow causing crashes. Thanks @sfan5 for fuzzing test. +- TGA loader: Fix several buffer overflows. Thanks @erlehmann for report and @sfan5 for fuzzing test: https://github.com/minetest/irrlicht/issues/236 +- COBJMeshFilerLoder: prevent buffer overruns from loading files passing negative indices. Thanks @sfan5 fore report and patch. + Patch (commit 827710f to Minetest): https://github.com/minetest/irrlicht/commit/827710f74a615f53b2a1b0c539c58c2b6124f883 +- COBJMeshFilerLoder: fix buffer overruns when loading empty face lines. Thanks @sfan5 fore report and patch. + Patch (commit 80e1609 to Minetest): https://github.com/minetest/irrlicht/commit/80e160935d3c2677344b0968c2690f63083a98dd (partially applied) +- CObjMeshFileLoader: Backport fixes from trunk to avoid unnecessary memory allocations (speedup) +- CObjMeshFileLoader: Backport fixes from trunk to avoid some buffer overruns +- CImageLoaderBMP: Fix handling 4 bit RLE encoding. Thanks @sfan5 finding first bug and reporting (had some more) +- CImageLoaderBMP: add bound checks to RLE decompression. Thanks @sfan5 for report and patch + Patch (commit 4506d23 to Minetest): https://github.com/minetest/irrlicht/commit/4506d23dc3fa48332b5ca6c05633aebdbac673be +- CImageLoaderBMP: check bitmap data against required size. Thanks @sfan5 for report and patch + Report: https://irrlicht.sourceforge.io/forum/viewtopic.php?p=307195 + Patch (commit 028cb8d to Minetest): https://github.com/minetest/irrlicht/commit/028cb8dbed8266264a5804108191f56e238db1bc +- Fix OSX 10.9X build problem related to NSApplication setDelegate calls getting casted to wrong class (Bug #462 and also fixing older Bug #297) + Thanks @Ryan Schmidt for bug report and patch. +- Backport: Fix compiling for Apple silicon (Bugs #452 and #461). Thanks @Ryan Schmidt for bug report and updated patch. - Fix compiling on OSX with case-sensitive filesystems: IrrFramework-Info.plist now always starting with upper-case. Thanks @Ryan Schmidt for bug report and patch. - Fix: The build-in libpng now uses same zlib headers as rest of Irrlicht. diff --git a/examples/21.Quake3Explorer/main.cpp b/examples/21.Quake3Explorer/main.cpp index ecb98b5..f6a1adf 100644 --- a/examples/21.Quake3Explorer/main.cpp +++ b/examples/21.Quake3Explorer/main.cpp @@ -734,7 +734,7 @@ void CQuake3EventHandler::CreateGUI() gui.Tesselation->setMax ( 12 ); gui.Tesselation->setSmallStep ( 1 ); gui.Tesselation->setLargeStep ( 1 ); - gui.Tesselation->setPos ( Game->loadParam.patchTesselation ); + gui.Tesselation->setPos ( Game->loadParam.patchTessellation ); gui.Tesselation->setToolTipText ( L"How smooth should curved surfaces be rendered" ); gui.Collision = env->addCheckBox ( true, rect( dim.Width - 400, 150, dim.Width - 300, 166 ), gui.Window,-1, L"Collision" ); @@ -1381,7 +1381,7 @@ bool CQuake3EventHandler::OnEvent(const SEvent& eve) else if ( eve.GUIEvent.Caller == gui.Tesselation && eve.GUIEvent.EventType == gui::EGET_SCROLL_BAR_CHANGED ) { - Game->loadParam.patchTesselation = gui.Tesselation->getPos (); + Game->loadParam.patchTessellation = gui.Tesselation->getPos (); } else if ( eve.GUIEvent.Caller == gui.Gamma && eve.GUIEvent.EventType == gui::EGET_SCROLL_BAR_CHANGED ) diff --git a/include/IAnimatedMesh.h b/include/IAnimatedMesh.h index ab9be06..9579761 100644 --- a/include/IAnimatedMesh.h +++ b/include/IAnimatedMesh.h @@ -5,7 +5,6 @@ #ifndef IRR_I_ANIMATED_MESH_H_INCLUDED #define IRR_I_ANIMATED_MESH_H_INCLUDED -#include "aabbox3d.h" #include "IMesh.h" namespace irr diff --git a/include/ICameraSceneNode.h b/include/ICameraSceneNode.h index 101c756..245cf7d 100644 --- a/include/ICameraSceneNode.h +++ b/include/ICameraSceneNode.h @@ -116,7 +116,7 @@ namespace scene /** \return The aspect ratio of the camera. */ virtual f32 getAspectRatio() const =0; - //! Gets the field of view of the camera. + //! Gets the vertical field of view of the camera. /** \return The field of view of the camera in radians. */ virtual f32 getFOV() const =0; @@ -135,7 +135,7 @@ namespace scene \param aspect: New aspect ratio. */ virtual void setAspectRatio(f32 aspect) =0; - //! Sets the field of view (Default: PI / 2.5f) + //! Sets the vertical field of view (Default: PI / 2.5f) /** Also changes projection matrix and resets IsOrthogonal flag. \param fovy: New field of view in radians. */ virtual void setFOV(f32 fovy) =0; diff --git a/include/IColladaMeshWriter.h b/include/IColladaMeshWriter.h index 0c70081..260ba8e 100644 --- a/include/IColladaMeshWriter.h +++ b/include/IColladaMeshWriter.h @@ -7,7 +7,6 @@ #include "IMeshWriter.h" #include "ISceneNode.h" -#include "IAnimatedMesh.h" #include "SMaterial.h" namespace irr diff --git a/include/IGUIImageList.h b/include/IGUIImageList.h index 2280f05..89d14a1 100644 --- a/include/IGUIImageList.h +++ b/include/IGUIImageList.h @@ -4,9 +4,8 @@ #ifndef IRR_I_GUI_IMAGE_LIST_H_INCLUDED #define IRR_I_GUI_IMAGE_LIST_H_INCLUDED -#include "IGUIElement.h" #include "rect.h" -#include "irrTypes.h" +#include "IReferenceCounted.h" namespace irr { diff --git a/include/IGUIWindow.h b/include/IGUIWindow.h index 88723b0..2b36494 100644 --- a/include/IGUIWindow.h +++ b/include/IGUIWindow.h @@ -6,7 +6,6 @@ #define IRR_I_GUI_WINDOW_H_INCLUDED #include "IGUIElement.h" -#include "EMessageBoxFlags.h" namespace irr { diff --git a/include/IImage.h b/include/IImage.h index d275f9d..918ced4 100644 --- a/include/IImage.h +++ b/include/IImage.h @@ -10,7 +10,6 @@ #include "rect.h" #include "SColor.h" #include "irrAllocator.h" -#include namespace irr { diff --git a/include/IImageWriter.h b/include/IImageWriter.h index 7ac8ada..7e4cc98 100644 --- a/include/IImageWriter.h +++ b/include/IImageWriter.h @@ -6,7 +6,6 @@ #define IRR_I_IMAGE_WRITER_H_INCLUDED #include "IReferenceCounted.h" -#include "irrString.h" #include "coreutil.h" namespace irr diff --git a/include/IIndexBuffer.h b/include/IIndexBuffer.h index a39e306..5582d8f 100644 --- a/include/IIndexBuffer.h +++ b/include/IIndexBuffer.h @@ -6,7 +6,6 @@ #define IRR_I_INDEX_BUFFER_H_INCLUDED #include "IReferenceCounted.h" -#include "irrArray.h" #include "EHardwareBufferFlags.h" #include "SVertexIndex.h" diff --git a/include/IMeshLoader.h b/include/IMeshLoader.h index cd81adb..74e7336 100644 --- a/include/IMeshLoader.h +++ b/include/IMeshLoader.h @@ -8,7 +8,6 @@ #include "IReferenceCounted.h" #include "path.h" #include "IMeshTextureLoader.h" -#include "SVertexIndex.h" namespace irr { diff --git a/include/ISceneManager.h b/include/ISceneManager.h index 64ab0e8..fab9a7e 100644 --- a/include/ISceneManager.h +++ b/include/ISceneManager.h @@ -7,7 +7,6 @@ #include "IReferenceCounted.h" #include "irrArray.h" -#include "irrString.h" #include "path.h" #include "vector3d.h" #include "dimension2d.h" diff --git a/include/ISceneNodeAnimator.h b/include/ISceneNodeAnimator.h index b284865..3f184a6 100644 --- a/include/ISceneNodeAnimator.h +++ b/include/ISceneNodeAnimator.h @@ -5,8 +5,6 @@ #ifndef IRR_I_SCENE_NODE_ANIMATOR_H_INCLUDED #define IRR_I_SCENE_NODE_ANIMATOR_H_INCLUDED -#include "IReferenceCounted.h" -#include "vector3d.h" #include "ESceneNodeAnimatorTypes.h" #include "IAttributeExchangingObject.h" #include "IAttributes.h" diff --git a/include/ISceneNodeAnimatorCameraFPS.h b/include/ISceneNodeAnimatorCameraFPS.h index 8caaef9..ce69ced 100644 --- a/include/ISceneNodeAnimatorCameraFPS.h +++ b/include/ISceneNodeAnimatorCameraFPS.h @@ -6,7 +6,6 @@ #define IRR_I_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED #include "ISceneNodeAnimator.h" -#include "IEventReceiver.h" #include "irrArray.h" namespace irr diff --git a/include/ISceneUserDataSerializer.h b/include/ISceneUserDataSerializer.h index 8978ce9..b4032d0 100644 --- a/include/ISceneUserDataSerializer.h +++ b/include/ISceneUserDataSerializer.h @@ -5,8 +5,6 @@ #ifndef IRR_I_SCENE_USER_DATA_SERIALIZER_H_INCLUDED #define IRR_I_SCENE_USER_DATA_SERIALIZER_H_INCLUDED -#include "IReferenceCounted.h" - namespace irr { namespace io diff --git a/include/ISkinnedMesh.h b/include/ISkinnedMesh.h index baa487a..b6c94ca 100644 --- a/include/ISkinnedMesh.h +++ b/include/ISkinnedMesh.h @@ -6,9 +6,10 @@ #define IRR_I_SKINNED_MESH_H_INCLUDED #include "irrArray.h" -#include "IBoneSceneNode.h" #include "IAnimatedMesh.h" #include "SSkinMeshBuffer.h" +#include "quaternion.h" +#include "irrString.h" namespace irr { diff --git a/include/ITexture.h b/include/ITexture.h index 9be2677..9fe7a7c 100644 --- a/include/ITexture.h +++ b/include/ITexture.h @@ -195,13 +195,17 @@ public: //! Lock function. /** Locks the Texture and returns a pointer to access the pixels. After lock() has been called and all operations on the pixels - are done, you must call unlock(). - Locks are not accumulating, hence one unlock will do for an arbitrary - number of previous locks. You should avoid locking different levels without - unlocking in between, though, because only the last level locked will be - unlocked. + are done, you must call unlock(). Locks are not accumulating, hence one + unlock will do for an arbitrary number of previous locks. You should avoid + locking different levels without unlocking in between, because only the + last level locked will be unlocked. + The size of the i-th mipmap level is defined as max(getSize().Width>>i,1) - and max(getSize().Height>>i,1) + and max(getSize().Height>>i,1). + Except for textures of EDT_SOFTWARE driver which returns data for + getOriginalSize(). Reason: Both original sized and modified sized textures are used + in that driver depending on whether the texture is used in 2d or 3d. + \param mode Specifies what kind of changes to the locked texture are allowed. Unspecified behavior will arise if texture is written in read only mode or read from in write only mode. diff --git a/include/SMaterial.h b/include/SMaterial.h index 1d71ce8..15a0048 100644 --- a/include/SMaterial.h +++ b/include/SMaterial.h @@ -7,7 +7,6 @@ #include "SColor.h" #include "matrix4.h" -#include "irrArray.h" #include "irrMath.h" #include "EMaterialTypes.h" #include "EMaterialFlags.h" diff --git a/include/irrString.h b/include/irrString.h index bc7a6a2..7c630a0 100644 --- a/include/irrString.h +++ b/include/irrString.h @@ -8,9 +8,7 @@ #include "irrTypes.h" #include "irrAllocator.h" #include "irrMath.h" -#include #include -#include namespace irr { diff --git a/include/matrix4.h b/include/matrix4.h index 3c51eac..0c0d2ba 100644 --- a/include/matrix4.h +++ b/include/matrix4.h @@ -303,20 +303,33 @@ namespace core \return Returns false if there is no inverse matrix. */ bool getInverse(CMatrix4& out) const; + //! Tool function to build a perspective projection matrix + /** Mainly for use of the other perspective projection build functions. + But can also be used by users (can be useful if you don't work with matrices with T=f32). + \param sx: x scale factor (depth/half_width from clipped frustum planes parallel to the camera) + \param sy: y scale factor (depth/half_height from clipped frustum planes parallel to the camera) + \param zNear: Distance to near plane + \param zFar: Distance to far plane + param zClipFromZero: Clipping of z can be projected from 0 to w when true (D3D style) and from -w to w when false (OGL style) + \param zSign: 1 for left-handed projection matrix, -1 for right-handed projection matrix */ + CMatrix4& buildProjectionMatrixPerspectiveFov(T sx, T sy, T zNear, T zFar, bool zClipFromZero, T zSign); + //! Builds a right-handed perspective projection matrix based on a field of view //\param zClipFromZero: Clipping of z can be projected from 0 to w when true (D3D style) and from -w to w when false (OGL style). - CMatrix4& buildProjectionMatrixPerspectiveFovRH(f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar, bool zClipFromZero=true); + CMatrix4& buildProjectionMatrixPerspectiveFovRH(f32 fieldOfViewRadiansY, f32 aspectRatio, f32 zNear, f32 zFar, bool zClipFromZero=true); //! Builds a left-handed perspective projection matrix based on a field of view - CMatrix4& buildProjectionMatrixPerspectiveFovLH(f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar, bool zClipFromZero=true); + CMatrix4& buildProjectionMatrixPerspectiveFovLH(f32 fieldOfViewRadiansY, f32 aspectRatio, f32 zNear, f32 zFar, bool zClipFromZero=true); //! Builds a left-handed perspective projection matrix based on a field of view, with far plane at infinity - CMatrix4& buildProjectionMatrixPerspectiveFovInfinityLH(f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 epsilon=0); + CMatrix4& buildProjectionMatrixPerspectiveFovInfinityLH(f32 fieldOfViewRadiansY, f32 aspectRatio, f32 zNear, f32 epsilon=0); //! Builds a right-handed perspective projection matrix. CMatrix4& buildProjectionMatrixPerspectiveRH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar, bool zClipFromZero=true); //! Builds a left-handed perspective projection matrix. + //\param widthOfViewVolume: width of clipped near frustum plane + //\param heightOfViewVolume: height of clipped near frustum plane CMatrix4& buildProjectionMatrixPerspectiveLH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar, bool zClipFromZero=true); //! Builds a left-handed orthogonal projection matrix. @@ -1568,102 +1581,70 @@ namespace core } - // Builds a right-handed perspective projection matrix based on a field of view + // Builds a perspective projection matrix template - inline CMatrix4& CMatrix4::buildProjectionMatrixPerspectiveFovRH( - f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar, bool zClipFromZero) + inline CMatrix4& CMatrix4::buildProjectionMatrixPerspectiveFov(T sx, T sy, T zNear, T zFar, bool zClipFromZero, T zSign) { - const f64 h = reciprocal(tan(fieldOfViewRadians*0.5)); - IRR_DEBUG_BREAK_IF(aspectRatio==0.f); //divide by zero - const T w = static_cast(h / aspectRatio); - IRR_DEBUG_BREAK_IF(zNear==zFar); //divide by zero - M[0] = w; + M[0] = sx; M[1] = 0; M[2] = 0; M[3] = 0; - + M[4] = 0; - M[5] = (T)h; + M[5] = sy; M[6] = 0; M[7] = 0; M[8] = 0; M[9] = 0; - //M[10] - M[11] = -1; - + //M[10] below + M[11] = zSign; + M[12] = 0; M[13] = 0; - //M[14] + //M[14] below M[15] = 0; - + if ( zClipFromZero ) // DirectX version { - M[10] = (T)(zFar/(zNear-zFar)); + M[10] = zSign*zFar/(zFar-zNear); M[14] = (T)(zNear*zFar/(zNear-zFar)); } else // OpenGL version { - M[10] = (T)((zFar+zNear)/(zNear-zFar)); + M[10] = zSign*(zFar+zNear)/(zFar-zNear); M[14] = (T)(2.0f*zNear*zFar/(zNear-zFar)); } - -#if defined ( USE_MATRIX_TEST ) - definitelyIdentityMatrix=false; -#endif + + #if defined ( USE_MATRIX_TEST ) + definitelyIdentityMatrix=false; + #endif return *this; } + // Builds a right-handed perspective projection matrix based on a field of view + template + inline CMatrix4& CMatrix4::buildProjectionMatrixPerspectiveFovRH( + f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar, bool zClipFromZero) + { + const f64 sy = reciprocal(tan(fieldOfViewRadians*0.5)); + IRR_DEBUG_BREAK_IF(aspectRatio==0.f); //divide by zero + const T sx = static_cast(sy / aspectRatio); + return buildProjectionMatrixPerspectiveFov(sx, static_cast(sy), zNear, zFar, zClipFromZero, (T)-1); + } // Builds a left-handed perspective projection matrix based on a field of view template inline CMatrix4& CMatrix4::buildProjectionMatrixPerspectiveFovLH( f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar, bool zClipFromZero) { - const f64 h = reciprocal(tan(fieldOfViewRadians*0.5)); + const f64 sy = reciprocal(tan(fieldOfViewRadians*0.5)); IRR_DEBUG_BREAK_IF(aspectRatio==0.f); //divide by zero - const T w = static_cast(h / aspectRatio); - - IRR_DEBUG_BREAK_IF(zNear==zFar); //divide by zero - M[0] = w; - M[1] = 0; - M[2] = 0; - M[3] = 0; - - M[4] = 0; - M[5] = (T)h; - M[6] = 0; - M[7] = 0; - - M[8] = 0; - M[9] = 0; - //M[10] - M[11] = 1; - - M[12] = 0; - M[13] = 0; - //M[14] - M[15] = 0; - - if ( zClipFromZero ) // DirectX version - { - M[10] = (T)(zFar/(zFar-zNear)); - M[14] = (T)(-zNear*zFar/(zFar-zNear)); - } - else // OpenGL version - { - M[10] = (T)((zFar+zNear)/(zFar-zNear)); - M[14] = (T)(2.0f*zNear*zFar/(zNear-zFar)); - } - -#if defined ( USE_MATRIX_TEST ) - definitelyIdentityMatrix=false; -#endif - return *this; + const T sx = static_cast(sy / aspectRatio); + return buildProjectionMatrixPerspectiveFov(sx, static_cast(sy), zNear, zFar, zClipFromZero, (T)1); } - // Builds a left-handed perspective projection matrix based on a field of view, with far plane culling at infinity template inline CMatrix4& CMatrix4::buildProjectionMatrixPerspectiveFovInfinityLH( @@ -1791,7 +1772,6 @@ namespace core return *this; } - // Builds a right-handed perspective projection matrix. template inline CMatrix4& CMatrix4::buildProjectionMatrixPerspectiveRH( @@ -1799,45 +1779,11 @@ namespace core { IRR_DEBUG_BREAK_IF(widthOfViewVolume==0.f); //divide by zero IRR_DEBUG_BREAK_IF(heightOfViewVolume==0.f); //divide by zero - IRR_DEBUG_BREAK_IF(zNear==zFar); //divide by zero - M[0] = (T)(2*zNear/widthOfViewVolume); - M[1] = 0; - M[2] = 0; - M[3] = 0; - - M[4] = 0; - M[5] = (T)(2*zNear/heightOfViewVolume); - M[6] = 0; - M[7] = 0; - - M[8] = 0; - M[9] = 0; - //M[10] - M[11] = -1; - - M[12] = 0; - M[13] = 0; - //M[14] - M[15] = 0; - - if ( zClipFromZero ) // DirectX version - { - M[10] = (T)(zFar/(zNear-zFar)); - M[14] = (T)(zNear*zFar/(zNear-zFar)); - } - else // OpenGL version - { - M[10] = (T)((zFar+zNear)/(zNear-zFar)); - M[14] = (T)(2.0f*zNear*zFar/(zNear-zFar)); - } - -#if defined ( USE_MATRIX_TEST ) - definitelyIdentityMatrix=false; -#endif - return *this; + const T sx = (T)(2*zNear/widthOfViewVolume); + const T sy = (T)(2*zNear/heightOfViewVolume); + return buildProjectionMatrixPerspectiveFov(sx, sy, zNear, zFar, zClipFromZero, (T)-1); } - // Builds a left-handed perspective projection matrix. template inline CMatrix4& CMatrix4::buildProjectionMatrixPerspectiveLH( @@ -1845,42 +1791,10 @@ namespace core { IRR_DEBUG_BREAK_IF(widthOfViewVolume==0.f); //divide by zero IRR_DEBUG_BREAK_IF(heightOfViewVolume==0.f); //divide by zero - IRR_DEBUG_BREAK_IF(zNear==zFar); //divide by zero - M[0] = (T)(2*zNear/widthOfViewVolume); - M[1] = 0; - M[2] = 0; - M[3] = 0; + const T sx = (T)(2*zNear/widthOfViewVolume); + const T sy = (T)(2*zNear/heightOfViewVolume); - M[4] = 0; - M[5] = (T)(2*zNear/heightOfViewVolume); - M[6] = 0; - M[7] = 0; - - M[8] = 0; - M[9] = 0; - //M[10] - M[11] = 1; - - M[12] = 0; - M[13] = 0; - //M[14] = (T)(zNear*zFar/(zNear-zFar)); - M[15] = 0; - - if ( zClipFromZero ) // DirectX version - { - M[10] = (T)(zFar/(zFar-zNear)); - M[14] = (T)(zNear*zFar/(zNear-zFar)); - } - else // OpenGL version - { - M[10] = (T)((zFar+zNear)/(zFar-zNear)); - M[14] = (T)(2.0f*zNear*zFar/(zNear-zFar)); - } - -#if defined ( USE_MATRIX_TEST ) - definitelyIdentityMatrix=false; -#endif - return *this; + return buildProjectionMatrixPerspectiveFov(sx, sy, zNear, zFar, zClipFromZero, (T)1); } @@ -2399,4 +2313,3 @@ namespace core } // end namespace irr #endif - diff --git a/include/vector3d.h b/include/vector3d.h index 3633fb7..9040696 100644 --- a/include/vector3d.h +++ b/include/vector3d.h @@ -235,7 +235,10 @@ namespace core } //! Rotates the vector by a specified number of degrees around the Y axis and the specified center. - /** \param degrees Number of degrees to rotate around the Y axis. + /** CAREFUL: For historical reasons rotateXZBy uses a right-handed rotation + (maybe to make it more similar to the 2D vector rotations which are counterclockwise). + To have this work the same way as rest of Irrlicht (nodes, matrices, other rotateBy functions) pass -1*degrees in here. + \param degrees Number of degrees to rotate around the Y axis. \param center The center of the rotation. */ void rotateXZBy(f64 degrees, const vector3d& center=vector3d()) { diff --git a/source/Irrlicht/C3DSMeshFileLoader.cpp b/source/Irrlicht/C3DSMeshFileLoader.cpp index f73bbf1..046c7de 100644 --- a/source/Irrlicht/C3DSMeshFileLoader.cpp +++ b/source/Irrlicht/C3DSMeshFileLoader.cpp @@ -8,7 +8,7 @@ #include "C3DSMeshFileLoader.h" #include "CMeshTextureLoader.h" #include "os.h" -#include "SMeshBuffer.h" +#include "CMeshBuffer.h" #include "SAnimatedMesh.h" #include "IReadFile.h" #include "IVideoDriver.h" diff --git a/source/Irrlicht/CAnimatedMeshHalfLife.cpp b/source/Irrlicht/CAnimatedMeshHalfLife.cpp index 4d03677..f9d9a92 100644 --- a/source/Irrlicht/CAnimatedMeshHalfLife.cpp +++ b/source/Irrlicht/CAnimatedMeshHalfLife.cpp @@ -10,7 +10,7 @@ #include "CColorConverter.h" #include "CImage.h" #include "coreutil.h" -#include "SMeshBuffer.h" +#include "CMeshBuffer.h" #include "IVideoDriver.h" #include "IFileSystem.h" diff --git a/source/Irrlicht/CAnimatedMeshMD2.cpp b/source/Irrlicht/CAnimatedMeshMD2.cpp index b97417a..3764d37 100644 --- a/source/Irrlicht/CAnimatedMeshMD2.cpp +++ b/source/Irrlicht/CAnimatedMeshMD2.cpp @@ -6,7 +6,6 @@ #ifdef _IRR_COMPILE_WITH_MD2_LOADER_ #include "CAnimatedMeshMD2.h" -#include "SColor.h" #include "irrMath.h" namespace irr diff --git a/source/Irrlicht/CAnimatedMeshMD2.h b/source/Irrlicht/CAnimatedMeshMD2.h index 04e0fa5..6bcf9fa 100644 --- a/source/Irrlicht/CAnimatedMeshMD2.h +++ b/source/Irrlicht/CAnimatedMeshMD2.h @@ -8,8 +8,6 @@ #include "IAnimatedMeshMD2.h" #include "IMesh.h" #include "CMeshBuffer.h" -#include "IReadFile.h" -#include "S3DVertex.h" #include "irrArray.h" #include "irrString.h" diff --git a/source/Irrlicht/CAnimatedMeshMD3.h b/source/Irrlicht/CAnimatedMeshMD3.h index bea2ea9..bf59b44 100644 --- a/source/Irrlicht/CAnimatedMeshMD3.h +++ b/source/Irrlicht/CAnimatedMeshMD3.h @@ -8,11 +8,8 @@ #include "IAnimatedMeshMD3.h" #include "IReadFile.h" #include "IFileSystem.h" -#include "irrArray.h" -#include "irrString.h" #include "SMesh.h" -#include "SMeshBuffer.h" -#include "IQ3Shader.h" +#include "CMeshBuffer.h" namespace irr { diff --git a/source/Irrlicht/CAnimatedMeshSceneNode.cpp b/source/Irrlicht/CAnimatedMeshSceneNode.cpp index e5c7f80..b6731b4 100644 --- a/source/Irrlicht/CAnimatedMeshSceneNode.cpp +++ b/source/Irrlicht/CAnimatedMeshSceneNode.cpp @@ -5,8 +5,8 @@ #include "CAnimatedMeshSceneNode.h" #include "IVideoDriver.h" #include "ISceneManager.h" -#include "S3DVertex.h" #include "os.h" +#include "IFileSystem.h" #ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_ #include "CShadowVolumeSceneNode.h" #else @@ -14,9 +14,7 @@ #endif // _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_ #include "IAnimatedMeshMD3.h" #include "CSkinnedMesh.h" -#include "IDummyTransformationSceneNode.h" #include "IBoneSceneNode.h" -#include "IMaterialRenderer.h" #include "IMesh.h" #include "IMeshCache.h" #include "IAnimatedMesh.h" diff --git a/source/Irrlicht/CAttributeImpl.h b/source/Irrlicht/CAttributeImpl.h index 6317a63..5c4ec1d 100644 --- a/source/Irrlicht/CAttributeImpl.h +++ b/source/Irrlicht/CAttributeImpl.h @@ -2,7 +2,6 @@ // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h -#include "CAttributes.h" #include "fast_atof.h" #include "ITexture.h" #include "IVideoDriver.h" diff --git a/source/Irrlicht/CB3DMeshFileLoader.cpp b/source/Irrlicht/CB3DMeshFileLoader.cpp index 05f8bf5..97c0133 100644 --- a/source/Irrlicht/CB3DMeshFileLoader.cpp +++ b/source/Irrlicht/CB3DMeshFileLoader.cpp @@ -13,7 +13,7 @@ #include "CMeshTextureLoader.h" #include "IVideoDriver.h" -#include "IFileSystem.h" +#include "IAttributes.h" #include "os.h" #ifdef _DEBUG @@ -255,7 +255,7 @@ bool CB3DMeshFileLoader::readChunkMESH(CSkinnedMesh::SJoint *inJoint) os::Printer::log(logStr.c_str(), ELL_DEBUG); #endif - s32 brushID; + s32 brushID=-1; B3DFile->read(&brushID, sizeof(brushID)); #ifdef __BIG_ENDIAN__ brushID = os::Byteswap::byteswap(brushID); @@ -283,11 +283,15 @@ bool CB3DMeshFileLoader::readChunkMESH(CSkinnedMesh::SJoint *inJoint) { scene::SSkinMeshBuffer *meshBuffer = AnimatedMesh->addMeshBuffer(); - if (brushID!=-1) + if ( brushID >= 0 && (u32)brushID < Materials.size() ) { loadTextures(Materials[brushID]); meshBuffer->Material=Materials[brushID].Material; } + else if (brushID != -1) // -1 is OK + { + os::Printer::log("Illegal brush ID found", B3DFile->getFileName(), ELL_WARNING); + } if(readChunkTRIS(meshBuffer,AnimatedMesh->getMeshBuffers().size()-1, VerticesStart)==false) return false; @@ -364,7 +368,8 @@ bool CB3DMeshFileLoader::readChunkVRTS(CSkinnedMesh::SJoint *inJoint) tex_coord_set_size = os::Byteswap::byteswap(tex_coord_set_size); #endif - if (tex_coord_sets >= max_tex_coords || tex_coord_set_size >= 4) // Something is wrong + if (tex_coord_sets < 0 || tex_coord_set_size < 0 || + tex_coord_sets >= max_tex_coords || tex_coord_set_size >= 4) // Something is wrong { os::Printer::log("tex_coord_sets or tex_coord_set_size too big", B3DFile->getFileName(), ELL_ERROR); return false; @@ -460,7 +465,7 @@ bool CB3DMeshFileLoader::readChunkTRIS(scene::SSkinMeshBuffer *meshBuffer, u32 m bool showVertexWarning=false; - s32 triangle_brush_id; // Note: Irrlicht can't have different brushes for each triangle (using a workaround) + s32 triangle_brush_id=-1; // Note: Irrlicht can't have different brushes for each triangle (using a workaround) B3DFile->read(&triangle_brush_id, sizeof(triangle_brush_id)); #ifdef __BIG_ENDIAN__ triangle_brush_id = os::Byteswap::byteswap(triangle_brush_id); @@ -468,14 +473,20 @@ bool CB3DMeshFileLoader::readChunkTRIS(scene::SSkinMeshBuffer *meshBuffer, u32 m SB3dMaterial *B3dMaterial; - if (triangle_brush_id != -1) + if (triangle_brush_id >= 0 && (u32)triangle_brush_id < Materials.size()) { loadTextures(Materials[triangle_brush_id]); B3dMaterial = &Materials[triangle_brush_id]; meshBuffer->Material = B3dMaterial->Material; } else + { B3dMaterial = 0; + if (triangle_brush_id < -1) // -1 is OK + { + os::Printer::log("Illegal material index for triangle brush found", B3DFile->getFileName(), ELL_WARNING); + } + } const s32 memoryNeeded = B3dStack.getLast().length / sizeof(s32); meshBuffer->Indices.reallocate(memoryNeeded + meshBuffer->Indices.size() + 1); @@ -594,7 +605,11 @@ bool CB3DMeshFileLoader::readChunkBONE(CSkinnedMesh::SJoint *inJoint) #endif globalVertexID += VerticesStart; - if (AnimatedVertices_VertexID[globalVertexID]==-1) + if (globalVertexID >= AnimatedVertices_VertexID.size()) + { + os::Printer::log("Illegal vertex index found", B3DFile->getFileName(), ELL_WARNING); + } + else if (AnimatedVertices_VertexID[globalVertexID]==-1) { os::Printer::log("B3dMeshLoader: Weight has bad vertex id (no link to meshbuffer index found)"); } @@ -1081,10 +1096,9 @@ void CB3DMeshFileLoader::loadTextures(SB3dMaterial& material) const void CB3DMeshFileLoader::readString(core::stringc& newstring) { newstring=""; - while (B3DFile->getPos() <= B3DFile->getSize()) + c8 character=0; + while (B3DFile->read(&character, sizeof(character)) > 0) // until eof { - c8 character; - B3DFile->read(&character, sizeof(character)); if (character==0) return; newstring.append(character); diff --git a/source/Irrlicht/CB3DMeshWriter.cpp b/source/Irrlicht/CB3DMeshWriter.cpp index 92c297a..68c0b9f 100644 --- a/source/Irrlicht/CB3DMeshWriter.cpp +++ b/source/Irrlicht/CB3DMeshWriter.cpp @@ -2,13 +2,12 @@ // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h -// TODO: replace printf's by logging messages - #include "IrrCompileConfig.h" #ifdef _IRR_COMPILE_WITH_B3D_WRITER_ #include "CB3DMeshWriter.h" +#include "SB3DStructs.h" #include "os.h" #include "ISkinnedMesh.h" #include "IMeshBuffer.h" diff --git a/source/Irrlicht/CB3DMeshWriter.h b/source/Irrlicht/CB3DMeshWriter.h index 48fe539..e856d06 100644 --- a/source/Irrlicht/CB3DMeshWriter.h +++ b/source/Irrlicht/CB3DMeshWriter.h @@ -9,11 +9,8 @@ #include "IMeshWriter.h" #include "IWriteFile.h" -#include "SB3DStructs.h" #include "ISkinnedMesh.h" - - namespace irr { namespace scene diff --git a/source/Irrlicht/CBSPMeshFileLoader.h b/source/Irrlicht/CBSPMeshFileLoader.h index f9adab7..aa8febf 100644 --- a/source/Irrlicht/CBSPMeshFileLoader.h +++ b/source/Irrlicht/CBSPMeshFileLoader.h @@ -7,7 +7,6 @@ #include "IMeshLoader.h" #include "IFileSystem.h" -#include "IVideoDriver.h" #include "ISceneManager.h" #include "IQ3Shader.h" diff --git a/source/Irrlicht/CBillboardSceneNode.cpp b/source/Irrlicht/CBillboardSceneNode.cpp index ed5cf97..1edb3e8 100644 --- a/source/Irrlicht/CBillboardSceneNode.cpp +++ b/source/Irrlicht/CBillboardSceneNode.cpp @@ -8,7 +8,6 @@ #include "IVideoDriver.h" #include "ISceneManager.h" #include "ICameraSceneNode.h" -#include "os.h" namespace irr { diff --git a/source/Irrlicht/CBillboardSceneNode.h b/source/Irrlicht/CBillboardSceneNode.h index 2e7379e..48c39f6 100644 --- a/source/Irrlicht/CBillboardSceneNode.h +++ b/source/Irrlicht/CBillboardSceneNode.h @@ -6,7 +6,7 @@ #define IRR_C_BILLBOARD_SCENE_NODE_H_INCLUDED #include "IBillboardSceneNode.h" -#include "SMeshBuffer.h" +#include "CMeshBuffer.h" namespace irr { diff --git a/source/Irrlicht/CCSMLoader.cpp b/source/Irrlicht/CCSMLoader.cpp index d560311..036be4d 100644 --- a/source/Irrlicht/CCSMLoader.cpp +++ b/source/Irrlicht/CCSMLoader.cpp @@ -18,7 +18,7 @@ #include "SMesh.h" #include "IVideoDriver.h" #include "SAnimatedMesh.h" -#include "SMeshBufferLightMap.h" +#include "CMeshBuffer.h" #ifdef _DEBUG #define _IRR_DEBUG_CSM_LOADER_ diff --git a/source/Irrlicht/CCSMLoader.h b/source/Irrlicht/CCSMLoader.h index 50ee974..f113e18 100644 --- a/source/Irrlicht/CCSMLoader.h +++ b/source/Irrlicht/CCSMLoader.h @@ -38,9 +38,7 @@ #ifndef __CSM_LOADER_H_INCLUDED__ #define __CSM_LOADER_H_INCLUDED__ -#include "irrArray.h" #include "IMesh.h" -#include "irrString.h" #include "IFileSystem.h" #include "IMeshLoader.h" diff --git a/source/Irrlicht/CColladaFileLoader.cpp b/source/Irrlicht/CColladaFileLoader.cpp index cec931f..3b92ab1 100644 --- a/source/Irrlicht/CColladaFileLoader.cpp +++ b/source/Irrlicht/CColladaFileLoader.cpp @@ -7,6 +7,7 @@ #include "CColladaFileLoader.h" #include "CMeshTextureLoader.h" +#include "CAttributes.h" #include "os.h" #include "IXMLReader.h" #include "IDummyTransformationSceneNode.h" @@ -21,6 +22,7 @@ #include "IMeshCache.h" #include "IMeshSceneNode.h" #include "CDynamicMeshBuffer.h" +#include "IVideoDriver.h" #include "irrMap.h" #ifdef _DEBUG diff --git a/source/Irrlicht/CColladaFileLoader.h b/source/Irrlicht/CColladaFileLoader.h index e3cd69e..6bf909b 100644 --- a/source/Irrlicht/CColladaFileLoader.h +++ b/source/Irrlicht/CColladaFileLoader.h @@ -7,12 +7,11 @@ #include "IMeshLoader.h" #include "IFileSystem.h" -#include "IVideoDriver.h" #include "irrString.h" #include "SMesh.h" #include "ISceneManager.h" #include "irrMap.h" -#include "CAttributes.h" +#include "IAttributes.h" namespace irr { diff --git a/source/Irrlicht/CColladaMeshWriter.cpp b/source/Irrlicht/CColladaMeshWriter.cpp index 91a0a23..a7db080 100644 --- a/source/Irrlicht/CColladaMeshWriter.cpp +++ b/source/Irrlicht/CColladaMeshWriter.cpp @@ -14,7 +14,6 @@ #include "IWriteFile.h" #include "IXMLWriter.h" #include "IMesh.h" -#include "IAttributes.h" #include "IAnimatedMeshSceneNode.h" #include "IMeshSceneNode.h" #include "ITerrainSceneNode.h" diff --git a/source/Irrlicht/CColorConverter.cpp b/source/Irrlicht/CColorConverter.cpp index 243a8c6..f2212ec 100644 --- a/source/Irrlicht/CColorConverter.cpp +++ b/source/Irrlicht/CColorConverter.cpp @@ -3,9 +3,8 @@ // For conditions of distribution and use, see copyright notice in irrlicht.h #include "CColorConverter.h" -#include "SColor.h" +#include "IImage.h" #include "os.h" -#include "irrString.h" namespace irr { diff --git a/source/Irrlicht/CColorConverter.h b/source/Irrlicht/CColorConverter.h index d9293c8..cdcb46e 100644 --- a/source/Irrlicht/CColorConverter.h +++ b/source/Irrlicht/CColorConverter.h @@ -6,7 +6,7 @@ #define IRR_C_COLOR_CONVERTER_H_INCLUDED #include "irrTypes.h" -#include "IImage.h" +#include "SColor.h" namespace irr { diff --git a/source/Irrlicht/CCubeSceneNode.cpp b/source/Irrlicht/CCubeSceneNode.cpp index a72d3be..5bf33c9 100644 --- a/source/Irrlicht/CCubeSceneNode.cpp +++ b/source/Irrlicht/CCubeSceneNode.cpp @@ -7,9 +7,6 @@ #include "CCubeSceneNode.h" #include "IVideoDriver.h" #include "ISceneManager.h" -#include "S3DVertex.h" -#include "SMeshBuffer.h" -#include "os.h" #ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_ #include "CShadowVolumeSceneNode.h" #else diff --git a/source/Irrlicht/CCubeSceneNode.h b/source/Irrlicht/CCubeSceneNode.h index fc276c2..adaa888 100644 --- a/source/Irrlicht/CCubeSceneNode.h +++ b/source/Irrlicht/CCubeSceneNode.h @@ -6,7 +6,7 @@ #define IRR_C_CUBE_SCENE_NODE_H_INCLUDED #include "IMeshSceneNode.h" -#include "SMesh.h" +#include "IMesh.h" #include "IGeometryCreator.h" namespace irr diff --git a/source/Irrlicht/CDMFLoader.cpp b/source/Irrlicht/CDMFLoader.cpp index 0e42363..1113cdc 100644 --- a/source/Irrlicht/CDMFLoader.cpp +++ b/source/Irrlicht/CDMFLoader.cpp @@ -25,10 +25,11 @@ #include "CMeshTextureLoader.h" #include "ISceneManager.h" #include "IAttributes.h" +#include "IVideoDriver.h" #include "SAnimatedMesh.h" #include "SSkinMeshBuffer.h" +#include "SMesh.h" #include "irrString.h" -#include "irrMath.h" #include "dmfsupport.h" namespace irr diff --git a/source/Irrlicht/CDMFLoader.h b/source/Irrlicht/CDMFLoader.h index bf82b39..101f424 100644 --- a/source/Irrlicht/CDMFLoader.h +++ b/source/Irrlicht/CDMFLoader.h @@ -33,10 +33,7 @@ #include "IMeshLoader.h" #include "IReadFile.h" #include "IFileSystem.h" -#include "SMesh.h" -#include "IVideoDriver.h" #include "ISceneManager.h" -#include "SAnimatedMesh.h" namespace irr { diff --git a/source/Irrlicht/CFileList.cpp b/source/Irrlicht/CFileList.cpp index 15d5410..d178e0c 100644 --- a/source/Irrlicht/CFileList.cpp +++ b/source/Irrlicht/CFileList.cpp @@ -3,11 +3,10 @@ // For conditions of distribution and use, see copyright notice in irrlicht.h #include "CFileList.h" -#include "IrrCompileConfig.h" #include "irrArray.h" #include "coreutil.h" -#include "os.h" +#include "os.h" // debug logging namespace irr { diff --git a/source/Irrlicht/CGUIColorSelectDialog.cpp b/source/Irrlicht/CGUIColorSelectDialog.cpp index 29c5482..450bc7e 100644 --- a/source/Irrlicht/CGUIColorSelectDialog.cpp +++ b/source/Irrlicht/CGUIColorSelectDialog.cpp @@ -12,10 +12,6 @@ #include "IGUIButton.h" #include "IGUIStaticText.h" #include "IGUIFont.h" -#include "IGUISpriteBank.h" -#include "IFileList.h" -#include "os.h" -#include "fast_atof.h" namespace irr { diff --git a/source/Irrlicht/CGUIComboBox.cpp b/source/Irrlicht/CGUIComboBox.cpp index 1efd345..ef04284 100644 --- a/source/Irrlicht/CGUIComboBox.cpp +++ b/source/Irrlicht/CGUIComboBox.cpp @@ -6,13 +6,11 @@ #ifdef _IRR_COMPILE_WITH_GUI_ #include "IGUIEnvironment.h" -#include "IVideoDriver.h" #include "IGUISkin.h" #include "IGUIEnvironment.h" #include "IGUIFont.h" #include "IGUIButton.h" #include "CGUIListBox.h" -#include "os.h" namespace irr { diff --git a/source/Irrlicht/CGUIContextMenu.cpp b/source/Irrlicht/CGUIContextMenu.cpp index 474d593..53a13fb 100644 --- a/source/Irrlicht/CGUIContextMenu.cpp +++ b/source/Irrlicht/CGUIContextMenu.cpp @@ -8,7 +8,6 @@ #include "IGUISkin.h" #include "IGUIEnvironment.h" -#include "IVideoDriver.h" #include "IGUIFont.h" #include "IGUISpriteBank.h" #include "os.h" diff --git a/source/Irrlicht/CGUIEditBox.cpp b/source/Irrlicht/CGUIEditBox.cpp index a55664e..2ff67d0 100644 --- a/source/Irrlicht/CGUIEditBox.cpp +++ b/source/Irrlicht/CGUIEditBox.cpp @@ -8,7 +8,6 @@ #include "IGUISkin.h" #include "IGUIEnvironment.h" #include "IGUIFont.h" -#include "IVideoDriver.h" #include "rect.h" #include "os.h" #include "Keycodes.h" diff --git a/source/Irrlicht/CGUIFileOpenDialog.cpp b/source/Irrlicht/CGUIFileOpenDialog.cpp index 25da897..dcb6fc9 100644 --- a/source/Irrlicht/CGUIFileOpenDialog.cpp +++ b/source/Irrlicht/CGUIFileOpenDialog.cpp @@ -9,13 +9,9 @@ #include "IGUISkin.h" #include "IGUIEnvironment.h" -#include "IVideoDriver.h" #include "IGUIButton.h" -#include "IGUIStaticText.h" #include "IGUIFont.h" -#include "IGUIFontBitmap.h" #include "IFileList.h" -#include "os.h" namespace irr { diff --git a/source/Irrlicht/CGUIListBox.cpp b/source/Irrlicht/CGUIListBox.cpp index 0670a21..3732047 100644 --- a/source/Irrlicht/CGUIListBox.cpp +++ b/source/Irrlicht/CGUIListBox.cpp @@ -8,7 +8,6 @@ #include "CGUIListBox.h" #include "IGUISkin.h" #include "IGUIEnvironment.h" -#include "IVideoDriver.h" #include "IGUIFont.h" #include "IGUISpriteBank.h" #include "CGUIScrollBar.h" diff --git a/source/Irrlicht/CGUIMenu.cpp b/source/Irrlicht/CGUIMenu.cpp index ce235c7..2e6cd36 100644 --- a/source/Irrlicht/CGUIMenu.cpp +++ b/source/Irrlicht/CGUIMenu.cpp @@ -7,12 +7,9 @@ #include "IGUISkin.h" #include "IGUIEnvironment.h" -#include "IVideoDriver.h" #include "IGUIFont.h" #include "IGUIWindow.h" -#include "os.h" - namespace irr { namespace gui diff --git a/source/Irrlicht/CGUIMessageBox.cpp b/source/Irrlicht/CGUIMessageBox.cpp index 57b383d..8957687 100644 --- a/source/Irrlicht/CGUIMessageBox.cpp +++ b/source/Irrlicht/CGUIMessageBox.cpp @@ -8,7 +8,6 @@ #include "IGUISkin.h" #include "IGUIEnvironment.h" #include "IGUIButton.h" -#include "IGUIFont.h" #include "ITexture.h" namespace irr diff --git a/source/Irrlicht/CGUIMessageBox.h b/source/Irrlicht/CGUIMessageBox.h index 0d17d50..91a5aaf 100644 --- a/source/Irrlicht/CGUIMessageBox.h +++ b/source/Irrlicht/CGUIMessageBox.h @@ -11,7 +11,6 @@ #include "CGUIWindow.h" #include "IGUIStaticText.h" #include "IGUIImage.h" -#include "irrArray.h" namespace irr { diff --git a/source/Irrlicht/CGUIModalScreen.cpp b/source/Irrlicht/CGUIModalScreen.cpp index 66f769e..54147d2 100644 --- a/source/Irrlicht/CGUIModalScreen.cpp +++ b/source/Irrlicht/CGUIModalScreen.cpp @@ -7,7 +7,6 @@ #include "IGUIEnvironment.h" #include "os.h" -#include "IVideoDriver.h" #include "IGUISkin.h" namespace irr diff --git a/source/Irrlicht/CGUIProfiler.cpp b/source/Irrlicht/CGUIProfiler.cpp index 693fc88..b47895b 100644 --- a/source/Irrlicht/CGUIProfiler.cpp +++ b/source/Irrlicht/CGUIProfiler.cpp @@ -8,7 +8,7 @@ #include "IGUITable.h" #include "IGUIScrollBar.h" #include "IGUIEnvironment.h" -#include "CProfiler.h" +#include "IProfiler.h" namespace irr { diff --git a/source/Irrlicht/CGUIScrollBar.cpp b/source/Irrlicht/CGUIScrollBar.cpp index a1779bd..43c26e9 100644 --- a/source/Irrlicht/CGUIScrollBar.cpp +++ b/source/Irrlicht/CGUIScrollBar.cpp @@ -7,11 +7,7 @@ #include "IGUISkin.h" #include "IGUIEnvironment.h" -#include "IVideoDriver.h" #include "CGUIButton.h" -#include "IGUIFont.h" -#include "IGUIFontBitmap.h" -#include "os.h" namespace irr { diff --git a/source/Irrlicht/CGUISpinBox.cpp b/source/Irrlicht/CGUISpinBox.cpp index 453722e..28378bf 100644 --- a/source/Irrlicht/CGUISpinBox.cpp +++ b/source/Irrlicht/CGUISpinBox.cpp @@ -4,12 +4,11 @@ #include "CGUISpinBox.h" #ifdef _IRR_COMPILE_WITH_GUI_ -#include "CGUIEditBox.h" -#include "CGUIButton.h" +#include "IGUIEditBox.h" +#include "IGUIButton.h" #include "IGUIEnvironment.h" #include "IEventReceiver.h" #include "fast_atof.h" -#include namespace irr @@ -131,7 +130,7 @@ void CGUISpinBox::setRange(f32 min, f32 max) RangeMin = min; RangeMax = max; - // we have to round the range - otherwise we can get into an infinte setValue/verifyValueRange cycle. + // we have to round the range - otherwise we can get into an infinite setValue/verifyValueRange cycle. wchar_t str[100]; swprintf_irr(str, 99, FormatString.c_str(), RangeMin); RangeMin = core::fast_atof(core::stringc(str).c_str()); diff --git a/source/Irrlicht/CGUITabControl.cpp b/source/Irrlicht/CGUITabControl.cpp index 998856b..847d846 100644 --- a/source/Irrlicht/CGUITabControl.cpp +++ b/source/Irrlicht/CGUITabControl.cpp @@ -5,13 +5,12 @@ #include "CGUITabControl.h" #ifdef _IRR_COMPILE_WITH_GUI_ -#include "CGUIButton.h" +#include "IGUIButton.h" #include "IGUISkin.h" #include "IGUIEnvironment.h" #include "IGUIFont.h" #include "IVideoDriver.h" #include "rect.h" -#include "os.h" namespace irr { diff --git a/source/Irrlicht/CGUITabControl.h b/source/Irrlicht/CGUITabControl.h index 3c34a15..c9b5e45 100644 --- a/source/Irrlicht/CGUITabControl.h +++ b/source/Irrlicht/CGUITabControl.h @@ -10,7 +10,6 @@ #include "IGUITabControl.h" #include "irrArray.h" -#include "IGUISkin.h" namespace irr { diff --git a/source/Irrlicht/CGUITable.cpp b/source/Irrlicht/CGUITable.cpp index 9c89cf1..ca70521 100644 --- a/source/Irrlicht/CGUITable.cpp +++ b/source/Irrlicht/CGUITable.cpp @@ -12,8 +12,7 @@ #include "IGUIEnvironment.h" #include "IVideoDriver.h" #include "IGUIFont.h" -#include "CGUIScrollBar.h" -#include "os.h" +#include "IGUIScrollBar.h" #define ARROW_PAD 15 diff --git a/source/Irrlicht/CGUIToolBar.cpp b/source/Irrlicht/CGUIToolBar.cpp index 2f4bf4e..7ba0147 100644 --- a/source/Irrlicht/CGUIToolBar.cpp +++ b/source/Irrlicht/CGUIToolBar.cpp @@ -7,7 +7,6 @@ #include "IGUISkin.h" #include "IGUIEnvironment.h" -#include "IVideoDriver.h" #include "IGUIButton.h" #include "IGUIFont.h" #include "CGUIButton.h" diff --git a/source/Irrlicht/CGUITreeView.cpp b/source/Irrlicht/CGUITreeView.cpp index b348a79..816e229 100644 --- a/source/Irrlicht/CGUITreeView.cpp +++ b/source/Irrlicht/CGUITreeView.cpp @@ -13,7 +13,6 @@ #include "IVideoDriver.h" #include "IGUIFont.h" #include "CGUIScrollBar.h" -#include "os.h" namespace irr { diff --git a/source/Irrlicht/CGUIWindow.cpp b/source/Irrlicht/CGUIWindow.cpp index 9769750..c353a12 100644 --- a/source/Irrlicht/CGUIWindow.cpp +++ b/source/Irrlicht/CGUIWindow.cpp @@ -7,10 +7,8 @@ #include "IGUISkin.h" #include "IGUIEnvironment.h" -#include "IVideoDriver.h" #include "IGUIButton.h" #include "IGUIFont.h" -#include "IGUIFontBitmap.h" namespace irr { diff --git a/source/Irrlicht/CGeometryCreator.cpp b/source/Irrlicht/CGeometryCreator.cpp index 4d8da4f..4c793b6 100644 --- a/source/Irrlicht/CGeometryCreator.cpp +++ b/source/Irrlicht/CGeometryCreator.cpp @@ -3,8 +3,6 @@ // For conditions of distribution and use, see copyright notice in irrlicht.h #include "CGeometryCreator.h" -#include "SAnimatedMesh.h" -#include "SMeshBuffer.h" #include "SMesh.h" #include "IMesh.h" #include "IVideoDriver.h" diff --git a/source/Irrlicht/CGeometryCreator.h b/source/Irrlicht/CGeometryCreator.h index 79ba6ee..25d4f04 100644 --- a/source/Irrlicht/CGeometryCreator.h +++ b/source/Irrlicht/CGeometryCreator.h @@ -6,7 +6,7 @@ #define IRR_C_GEOMETRY_CREATOR_H_INCLUDED #include "IGeometryCreator.h" -#include "SMeshBuffer.h" +#include "CMeshBuffer.h" namespace irr { diff --git a/source/Irrlicht/CImage.cpp b/source/Irrlicht/CImage.cpp index a076a58..c69448a 100644 --- a/source/Irrlicht/CImage.cpp +++ b/source/Irrlicht/CImage.cpp @@ -3,7 +3,6 @@ // For conditions of distribution and use, see copyright notice in irrlicht.h #include "CImage.h" -#include "irrString.h" #include "CColorConverter.h" #include "CBlit.h" #include "os.h" diff --git a/source/Irrlicht/CImageLoaderBMP.cpp b/source/Irrlicht/CImageLoaderBMP.cpp index 4bb27af..8fdb309 100644 --- a/source/Irrlicht/CImageLoaderBMP.cpp +++ b/source/Irrlicht/CImageLoaderBMP.cpp @@ -11,7 +11,6 @@ #include "CColorConverter.h" #include "CImage.h" #include "os.h" -#include "irrString.h" namespace irr { @@ -48,19 +47,35 @@ bool CImageLoaderBMP::isALoadableFileFormat(io::IReadFile* file) const } +// UB-safe overflow check +static inline bool doesOverflow(const void *base, size_t numElements, const void *end) +{ + // TODO: uintptr_t (as in original patch from sfan5) would be nicer than size_t, use once we allow c++11 + size_t baseI = reinterpret_cast(base); + size_t endI = reinterpret_cast(end); + return baseI > endI || numElements >= (endI - baseI); +} + +// check whether &p[0] to &p[_off - 1] can be accessed +#define EXIT_P_OVERFLOW(_off) if (doesOverflow(p, _off, pEnd)) goto exit +// same for d +#define EXIT_D_OVERFLOW(_off) if (doesOverflow(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; - u8* destEnd = newBmp + (width+pitch)*height; + const u8* destEnd = newBmp + (width+pitch)*height; s32 line = 0; - while (bmpData - p < size && d < destEnd) + while (p < pEnd && d < destEnd) { if (*p == 0) { ++p; + EXIT_P_OVERFLOW(1); switch(*p) { @@ -70,37 +85,43 @@ void CImageLoaderBMP::decompress8BitRLE(u8*& bmpData, s32 size, s32 width, s32 h d = newBmp + (line*(width+pitch)); break; case 1: // end of bmp - delete [] bmpData; - bmpData = newBmp; - return; + goto exit; case 2: - ++p; d +=(u8)*p; // delta - ++p; d += ((u8)*p)*(width+pitch); + ++p; + EXIT_P_OVERFLOW(2); + d += (u8)*p; // delta + ++p; + d += ((u8)*p)*(width+pitch); ++p; break; default: { // absolute mode - s32 count = (u8)*p; ++p; - s32 readAdditional = ((2-(count%2))%2); - s32 i; + const s32 count = (u8)*p; + ++p; - for (i=0; i= width ) \ + { \ + line += row/width; \ + row %= width; \ + } \ + if ( line >= height ) \ + { \ + line = 0; /* bug anyway, this way more visible maybe */ \ + } + + void CImageLoaderBMP::decompress4BitRLE(u8*& bmpData, s32 size, s32 width, s32 height, s32 pitch) const { - s32 lineWidth = (width+1)/2+pitch; + const s32 lineWidth = (width+1)/2+pitch; u8* p = bmpData; + const u8* pEnd = bmpData + size; u8* newBmp = new u8[lineWidth*height]; - u8* d = newBmp; - u8* destEnd = newBmp + lineWidth*height; + memset(newBmp, 0, lineWidth*height); // Extra cost, but otherwise we have to code pixel skipping stuff + const u8* destEnd = newBmp + lineWidth*height; s32 line = 0; - s32 shift = 4; + s32 row = 0; - while (bmpData - p < size && d < destEnd) + while (p < pEnd) { if (*p == 0) { ++p; + EXIT_P_OVERFLOW(1); switch(*p) { case 0: // end of line ++p; ++line; - d = newBmp + (line*lineWidth); - shift = 4; + row = 0; break; case 1: // end of bmp - delete [] bmpData; - bmpData = newBmp; - return; - case 2: + goto exit; + case 2: // delta { ++p; + EXIT_P_OVERFLOW(2); s32 x = (u8)*p; ++p; s32 y = (u8)*p; ++p; - d += x/2 + y*lineWidth; - shift = x%2==0 ? 4 : 0; + row += x; + line += y; } break; default: { // absolute mode - s32 count = (u8)*p; ++p; - s32 readAdditional = ((2-((count)%2))%2); + const u32 count = (u8)*p; ++p; s32 readShift = 4; - s32 i; - for (i=0; i> readShift) & 0x0f; readShift -= 4; if (readShift < 0) { - ++*p; + ++p; readShift = 4; } @@ -178,26 +233,37 @@ void CImageLoaderBMP::decompress4BitRLE(u8*& bmpData, s32 size, s32 width, s32 h shift = 4; ++d; } - } + row += count; - for (i=0; i> 4) & 0x0f; + const s32 count = (u8)*p; // pixels to draw + ++p; + EXIT_P_OVERFLOW(1); + s32 color1 = (u8)*p; color1 = color1 & 0x0f; // lo bit (2nd,4th,... pixel) + s32 color2 = (u8)*p; color2 = (color2 >> 4) & 0x0f; // hi bits (1st,3rd,... pixel) ++p; + KEEP_ROW_LINE_INSIDE; + s32 shift = row%2 == 0 ? 4 : 0; + u8* d = newBmp + (lineWidth*line + row/2); + + EXIT_D_OVERFLOW(shiftedCount(count, shift)); for (s32 i=0; i 2) // we'll only handle RLE-Compression { @@ -282,14 +365,9 @@ IImage* CImageLoaderBMP::loadImage(io::IReadFile* file) const file->seek(header.BitmapDataOffset); - f32 t = (header.Width) * (header.BPP / 8.0f); - s32 widthInBytes = (s32)t; - t -= widthInBytes; - if (t!=0.0f) - ++widthInBytes; - - s32 lineData = widthInBytes + ((4-(widthInBytes%4)))%4; - pitch = lineData - widthInBytes; + const s32 widthInBytes = core::ceil32(header.Width * (header.BPP / 8.0f)); + const s32 lineSize = widthInBytes + ((4-(widthInBytes%4)))%4; + const s32 pitch = lineSize - widthInBytes; u8* bmpData = new u8[header.BitmapDataSize]; file->read(bmpData, header.BitmapDataSize); @@ -297,14 +375,25 @@ IImage* CImageLoaderBMP::loadImage(io::IReadFile* file) const // decompress data if needed switch(header.Compression) { - case 1: // 8 bit rle + 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 + 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 // no default constructor from packed area! ARM problem! @@ -359,6 +448,9 @@ cleanup: delete [] paletteData; delete [] bmpData; + if ( image && topDown ) + image->flip(true, false); + return image; } diff --git a/source/Irrlicht/CImageLoaderDDS.cpp b/source/Irrlicht/CImageLoaderDDS.cpp index 68e1164..e48d708 100644 --- a/source/Irrlicht/CImageLoaderDDS.cpp +++ b/source/Irrlicht/CImageLoaderDDS.cpp @@ -18,9 +18,7 @@ #include "IReadFile.h" #include "os.h" -#include "CColorConverter.h" #include "CImage.h" -#include "irrString.h" // Header flag values #define DDSD_CAPS 0x00000001 @@ -721,9 +719,8 @@ IImage* CImageLoaderDDS::loadImage(io::IReadFile* file) const image = new CImage(ECF_A8R8G8B8, core::dimension2d(width, height)); - if (DDSDecompress(&header, memFile, (u8*)image->lock()) == -1) + if (DDSDecompress(&header, memFile, (u8*)image->getData()) == -1) { - image->unlock(); image->drop(); image = 0; } diff --git a/source/Irrlicht/CImageLoaderPCX.cpp b/source/Irrlicht/CImageLoaderPCX.cpp index 1c59447..4f5c8f6 100644 --- a/source/Irrlicht/CImageLoaderPCX.cpp +++ b/source/Irrlicht/CImageLoaderPCX.cpp @@ -11,7 +11,6 @@ #include "CColorConverter.h" #include "CImage.h" #include "os.h" -#include "irrString.h" namespace irr diff --git a/source/Irrlicht/CImageLoaderPNG.cpp b/source/Irrlicht/CImageLoaderPNG.cpp index 076871f..6aacbb3 100644 --- a/source/Irrlicht/CImageLoaderPNG.cpp +++ b/source/Irrlicht/CImageLoaderPNG.cpp @@ -15,7 +15,7 @@ #endif // _IRR_COMPILE_WITH_LIBPNG_ #include "CImage.h" -#include "CReadFile.h" +#include "IReadFile.h" #include "os.h" namespace irr diff --git a/source/Irrlicht/CImageLoaderPSD.cpp b/source/Irrlicht/CImageLoaderPSD.cpp index 00aadd6..b380b98 100644 --- a/source/Irrlicht/CImageLoaderPSD.cpp +++ b/source/Irrlicht/CImageLoaderPSD.cpp @@ -9,7 +9,6 @@ #include "IReadFile.h" #include "os.h" #include "CImage.h" -#include "irrString.h" namespace irr diff --git a/source/Irrlicht/CImageLoaderPVR.cpp b/source/Irrlicht/CImageLoaderPVR.cpp index ceae56f..d565aea 100644 --- a/source/Irrlicht/CImageLoaderPVR.cpp +++ b/source/Irrlicht/CImageLoaderPVR.cpp @@ -9,7 +9,6 @@ #include "IReadFile.h" #include "os.h" #include "CImage.h" -#include "irrString.h" namespace irr { diff --git a/source/Irrlicht/CImageLoaderRGB.cpp b/source/Irrlicht/CImageLoaderRGB.cpp index dfb4b8b..c516fd3 100644 --- a/source/Irrlicht/CImageLoaderRGB.cpp +++ b/source/Irrlicht/CImageLoaderRGB.cpp @@ -130,7 +130,6 @@ DUMMY - This 404 bytes of data should be set to 0. This makes the Header exactl #include "CColorConverter.h" #include "CImage.h" #include "os.h" -#include "irrString.h" namespace irr diff --git a/source/Irrlicht/CImageLoaderTGA.cpp b/source/Irrlicht/CImageLoaderTGA.cpp index 8d91bd0..c6c3ae4 100644 --- a/source/Irrlicht/CImageLoaderTGA.cpp +++ b/source/Irrlicht/CImageLoaderTGA.cpp @@ -10,7 +10,6 @@ #include "os.h" #include "CColorConverter.h" #include "CImage.h" -#include "irrString.h" namespace irr @@ -33,10 +32,10 @@ u8 *CImageLoaderTGA::loadCompressedImage(io::IReadFile *file, const STGAHeader& // This was written and sent in by Jon Pry, thank you very much! // I only changed the formatting a little bit. - s32 bytesPerPixel = header.PixelDepth/8; - s32 imageSize = header.ImageHeight * header.ImageWidth * bytesPerPixel; + const u32 bytesPerPixel = header.PixelDepth/8; + const u32 imageSize = header.ImageHeight * header.ImageWidth * bytesPerPixel; u8* data = new u8[imageSize]; - s32 currentByte = 0; + u32 currentByte = 0; while(currentByte < imageSize) { @@ -47,8 +46,17 @@ u8 *CImageLoaderTGA::loadCompressedImage(io::IReadFile *file, const STGAHeader& { chunkheader++; // Add 1 To The Value To Get Total Number Of Raw Pixels - file->read(&data[currentByte], bytesPerPixel * chunkheader); - currentByte += bytesPerPixel * chunkheader; + const u32 bytesToRead = bytesPerPixel * chunkheader; + if ( currentByte+bytesToRead < imageSize ) + { + file->read(&data[currentByte], bytesToRead); + currentByte += bytesToRead; + } + else + { + os::Printer::log("Compressed TGA file RAW chunk tries writing beyond buffer", file->getFileName(), ELL_WARNING); + break; + } } else { @@ -57,15 +65,27 @@ u8 *CImageLoaderTGA::loadCompressedImage(io::IReadFile *file, const STGAHeader& // If It's An RLE Header chunkheader -= 127; // Subtract 127 To Get Rid Of The ID Bit - s32 dataOffset = currentByte; - file->read(&data[dataOffset], bytesPerPixel); - - currentByte += bytesPerPixel; - - for(s32 counter = 1; counter < chunkheader; counter++) + u32 dataOffset = currentByte; + if ( dataOffset+bytesPerPixel < imageSize ) { - for(s32 elementCounter=0; elementCounter < bytesPerPixel; elementCounter++) - data[currentByte + elementCounter] = data[dataOffset + elementCounter]; + file->read(&data[dataOffset], bytesPerPixel); + currentByte += bytesPerPixel; + } + else + { + os::Printer::log("Compressed TGA file RLE headertries writing beyond buffer", file->getFileName(), ELL_WARNING); + break; + } + + for(u32 counter = 1; counter < chunkheader; counter++) + { + if ( currentByte + bytesPerPixel <= imageSize ) + { + for(u32 elementCounter=0; elementCounter < bytesPerPixel; elementCounter++) + { + data[currentByte + elementCounter] = data[dataOffset + elementCounter]; + } + } currentByte += bytesPerPixel; } @@ -118,8 +138,17 @@ IImage* CImageLoaderTGA::loadImage(io::IReadFile* file) const if (header.ColorMapType) { - // create 32 bit palette - palette = new u32[ header.ColorMapLength]; + // Create 32 bit palette + const irr::u16 paletteSize = core::max_((u16)256, header.ColorMapLength); // ColorMapLength can lie, but so far we only use palette for 8-bit, so ensure it has 256 entries + palette = new u32[paletteSize]; + + if( paletteSize > header.ColorMapLength ) + { + // To catch images using palette colors with invalid indices + const irr::u32 errorCol = irr::video::SColor(255,255, 0, 205).color; // bright magenta + for ( irr::u16 i = header.ColorMapLength; i< paletteSize; ++i ) + palette[i] = errorCol; + } // read color map u8 * colorMap = new u8[header.ColorMapEntrySize/8 * header.ColorMapLength]; @@ -150,7 +179,7 @@ IImage* CImageLoaderTGA::loadImage(io::IReadFile* file) const header.ImageType == 3 // Uncompressed, black and white images ) { - const s32 imageSize = header.ImageHeight * header.ImageWidth * header.PixelDepth/8; + const s32 imageSize = header.ImageHeight * header.ImageWidth * (header.PixelDepth/8); data = new u8[imageSize]; file->read(data, imageSize); } @@ -185,14 +214,28 @@ IImage* CImageLoaderTGA::loadImage(io::IReadFile* file) const } else { - image = new CImage(ECF_A1R5G5B5, - core::dimension2d(header.ImageWidth, header.ImageHeight)); - if (image) - CColorConverter::convert8BitTo16Bit((u8*)data, - (s16*)image->getData(), - header.ImageWidth,header.ImageHeight, - (s32*) palette, 0, - (header.ImageDescriptor&0x20)==0); + switch ( header.ColorMapEntrySize ) + { + case 16: + image = new CImage(ECF_A1R5G5B5, core::dimension2d(header.ImageWidth, header.ImageHeight)); + if ( image ) + CColorConverter::convert8BitTo16Bit((u8*)data, + (s16*)image->getData(), + header.ImageWidth,header.ImageHeight, + (s32*) palette, 0, + (header.ImageDescriptor&0x20)==0); + break; + // Note: 24 bit with palette would need a 24 bit palette, too lazy doing that now (textures will prefer 32-bit later anyway) + default: + image = new CImage(ECF_A8R8G8B8, core::dimension2d(header.ImageWidth, header.ImageHeight)); + if ( image ) + CColorConverter::convert8BitTo32Bit((u8*)data, + (u8*)image->getData(), + header.ImageWidth,header.ImageHeight, + (u8*) palette, 0, + (header.ImageDescriptor&0x20)==0); + break; + } } } break; diff --git a/source/Irrlicht/CImageLoaderWAL.cpp b/source/Irrlicht/CImageLoaderWAL.cpp index cd210de..219f952 100644 --- a/source/Irrlicht/CImageLoaderWAL.cpp +++ b/source/Irrlicht/CImageLoaderWAL.cpp @@ -9,8 +9,6 @@ #include "CImage.h" #include "os.h" #include "dimension2d.h" -#include "IVideoDriver.h" -#include "IFileSystem.h" #include "IReadFile.h" #include "irrString.h" diff --git a/source/Irrlicht/CImageWriterBMP.cpp b/source/Irrlicht/CImageWriterBMP.cpp index 04d3973..7383805 100644 --- a/source/Irrlicht/CImageWriterBMP.cpp +++ b/source/Irrlicht/CImageWriterBMP.cpp @@ -9,7 +9,6 @@ #include "CImageLoaderBMP.h" #include "IWriteFile.h" #include "CColorConverter.h" -#include "irrString.h" #include "os.h" namespace irr diff --git a/source/Irrlicht/CImageWriterJPG.cpp b/source/Irrlicht/CImageWriterJPG.cpp index 793aed2..4c937b8 100644 --- a/source/Irrlicht/CImageWriterJPG.cpp +++ b/source/Irrlicht/CImageWriterJPG.cpp @@ -8,8 +8,7 @@ #include "CColorConverter.h" #include "IWriteFile.h" -#include "CImage.h" -#include "irrString.h" +#include "IImage.h" #include "os.h" #ifdef _IRR_COMPILE_WITH_LIBJPEG_ diff --git a/source/Irrlicht/CImageWriterPCX.cpp b/source/Irrlicht/CImageWriterPCX.cpp index 5ace342..0edec0e 100644 --- a/source/Irrlicht/CImageWriterPCX.cpp +++ b/source/Irrlicht/CImageWriterPCX.cpp @@ -6,10 +6,9 @@ #ifdef _IRR_COMPILE_WITH_PCX_WRITER_ -#include "CImageLoaderPCX.h" #include "IWriteFile.h" +#include "IImage.h" #include "os.h" // for logging -#include "irrString.h" namespace irr { diff --git a/source/Irrlicht/CImageWriterPNG.cpp b/source/Irrlicht/CImageWriterPNG.cpp index c08100f..6dc1e6f 100644 --- a/source/Irrlicht/CImageWriterPNG.cpp +++ b/source/Irrlicht/CImageWriterPNG.cpp @@ -6,10 +6,9 @@ #ifdef _IRR_COMPILE_WITH_PNG_WRITER_ -#include "CImageLoaderPNG.h" +#include "IImage.h" #include "CColorConverter.h" #include "IWriteFile.h" -#include "irrString.h" #include "os.h" // for logging #ifdef _IRR_COMPILE_WITH_LIBPNG_ diff --git a/source/Irrlicht/CImageWriterPPM.cpp b/source/Irrlicht/CImageWriterPPM.cpp index fd0db97..ed76592 100644 --- a/source/Irrlicht/CImageWriterPPM.cpp +++ b/source/Irrlicht/CImageWriterPPM.cpp @@ -9,7 +9,6 @@ #include "IWriteFile.h" #include "IImage.h" #include "dimension2d.h" -#include "irrString.h" namespace irr { diff --git a/source/Irrlicht/CImageWriterPSD.cpp b/source/Irrlicht/CImageWriterPSD.cpp index 952eb0b..cf0ce08 100644 --- a/source/Irrlicht/CImageWriterPSD.cpp +++ b/source/Irrlicht/CImageWriterPSD.cpp @@ -9,7 +9,6 @@ #include "CImageLoaderPSD.h" #include "IWriteFile.h" #include "os.h" // for logging -#include "irrString.h" namespace irr { diff --git a/source/Irrlicht/CImageWriterTGA.cpp b/source/Irrlicht/CImageWriterTGA.cpp index 35f7afe..12a9662 100644 --- a/source/Irrlicht/CImageWriterTGA.cpp +++ b/source/Irrlicht/CImageWriterTGA.cpp @@ -9,7 +9,6 @@ #include "CImageLoaderTGA.h" #include "IWriteFile.h" #include "CColorConverter.h" -#include "irrString.h" #include "os.h" namespace irr diff --git a/source/Irrlicht/CIrrDeviceOSX.h b/source/Irrlicht/CIrrDeviceOSX.h index 7034feb..61838f2 100644 --- a/source/Irrlicht/CIrrDeviceOSX.h +++ b/source/Irrlicht/CIrrDeviceOSX.h @@ -26,7 +26,7 @@ namespace irr class CIrrDeviceMacOSX; } -@interface CIrrDelegateOSX : NSObject +@interface CIrrDelegateOSX : NSObject - (id)initWithDevice:(irr::CIrrDeviceMacOSX*)device; - (void)terminate:(id)sender; diff --git a/source/Irrlicht/CIrrDeviceOSX.mm b/source/Irrlicht/CIrrDeviceOSX.mm index fbe2a5b..6f9647d 100644 --- a/source/Irrlicht/CIrrDeviceOSX.mm +++ b/source/Irrlicht/CIrrDeviceOSX.mm @@ -579,7 +579,7 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param) { [[NSAutoreleasePool alloc] init]; [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; - [NSApp setDelegate:(id)[[[CIrrDelegateOSX alloc] initWithDevice:this] autorelease]]; + [[NSApplication sharedApplication] setDelegate:[[[CIrrDelegateOSX alloc] initWithDevice:this] autorelease]]; // Create menu @@ -794,7 +794,7 @@ bool CIrrDeviceMacOSX::createWindow() { if (Window) { - [Window setDelegate:(id)[NSApp delegate]]; + [Window setDelegate:(CIrrDelegateOSX *)[NSApp delegate]]; [Window setAcceptsMouseMovedEvents:TRUE]; [Window setIsVisible:TRUE]; [Window makeKeyAndOrderFront:nil]; @@ -867,7 +867,7 @@ void CIrrDeviceMacOSX::createDriver() SoftwareRendererType = 2; if (Window) { - Window.contentView.wantsLayer = YES; + [[Window contentView] setWantsLayer:YES]; } #else os::Printer::log("No Software driver support compiled in.", ELL_ERROR); @@ -880,7 +880,7 @@ void CIrrDeviceMacOSX::createDriver() SoftwareRendererType = 1; if (Window) { - Window.contentView.wantsLayer = YES; + [[Window contentView] setWantsLayer:YES]; [ Window setOpaque:YES]; } @@ -1602,7 +1602,7 @@ bool CIrrDeviceMacOSX::present(video::IImage* surface, void* windowId, core::rec NSImage *image = [[[NSImage alloc] initWithSize: imageSize] autorelease]; [image addRepresentation: rep]; - Window.contentView.layer.contents = image; + [[[Window contentView] layer] setContents:image]; } return true; } diff --git a/source/Irrlicht/CIrrDeviceWin32.h b/source/Irrlicht/CIrrDeviceWin32.h index f2641e4..caa169a 100644 --- a/source/Irrlicht/CIrrDeviceWin32.h +++ b/source/Irrlicht/CIrrDeviceWin32.h @@ -9,8 +9,6 @@ #ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_ #include "CIrrDeviceStub.h" -#include "IrrlichtDevice.h" -#include "IImagePresenter.h" #define WIN32_LEAN_AND_MEAN #if !defined(_IRR_XBOX_PLATFORM_) @@ -71,7 +69,7 @@ namespace irr virtual video::IVideoModeList* getVideoModeList() IRR_OVERRIDE; //! Notifies the device, that it has been resized - /** Must be publis as it is called from free function (event handler) */ + /** Must be public as it is called from free function (event handler) */ void OnResized(); //! Sets if the window should be resizable in windowed mode. diff --git a/source/Irrlicht/CIrrMeshFileLoader.cpp b/source/Irrlicht/CIrrMeshFileLoader.cpp index 84754ea..10fad47 100644 --- a/source/Irrlicht/CIrrMeshFileLoader.cpp +++ b/source/Irrlicht/CIrrMeshFileLoader.cpp @@ -9,12 +9,12 @@ #include "os.h" #include "IXMLReader.h" #include "SAnimatedMesh.h" +#include "SMesh.h" #include "fast_atof.h" #include "IReadFile.h" #include "IAttributes.h" -#include "IMeshSceneNode.h" +#include "IVideoDriver.h" #include "CDynamicMeshBuffer.h" -#include "SMeshBufferLightMap.h" namespace irr { diff --git a/source/Irrlicht/CIrrMeshFileLoader.h b/source/Irrlicht/CIrrMeshFileLoader.h index 90ace99..921266c 100644 --- a/source/Irrlicht/CIrrMeshFileLoader.h +++ b/source/Irrlicht/CIrrMeshFileLoader.h @@ -7,10 +7,6 @@ #include "IMeshLoader.h" #include "IFileSystem.h" -#include "IVideoDriver.h" -#include "irrString.h" -#include "SMesh.h" -#include "SMeshBuffer.h" #include "CDynamicMeshBuffer.h" #include "ISceneManager.h" diff --git a/source/Irrlicht/CLMTSMeshFileLoader.cpp b/source/Irrlicht/CLMTSMeshFileLoader.cpp index b972ec5..dd33450 100644 --- a/source/Irrlicht/CLMTSMeshFileLoader.cpp +++ b/source/Irrlicht/CLMTSMeshFileLoader.cpp @@ -70,13 +70,12 @@ Version 1.0 - 29 July 2004 #include "CLMTSMeshFileLoader.h" #include "CMeshTextureLoader.h" -#include "SMeshBufferLightMap.h" +#include "CMeshBuffer.h" #include "SAnimatedMesh.h" -#include "SMeshBuffer.h" +#include "SceneParameters.h" #include "irrString.h" #include "IReadFile.h" #include "IAttributes.h" -#include "ISceneManager.h" #include "os.h" namespace irr diff --git a/source/Irrlicht/CLWOMeshFileLoader.h b/source/Irrlicht/CLWOMeshFileLoader.h index edcd7e8..a3fca8a 100644 --- a/source/Irrlicht/CLWOMeshFileLoader.h +++ b/source/Irrlicht/CLWOMeshFileLoader.h @@ -6,7 +6,7 @@ #define IRR_C_LWO_MESH_FILE_LOADER_H_INCLUDED #include "IMeshLoader.h" -#include "SMeshBuffer.h" +#include "CMeshBuffer.h" #include "irrString.h" namespace irr diff --git a/source/Irrlicht/CLimitReadFile.cpp b/source/Irrlicht/CLimitReadFile.cpp index f65b700..1a80225 100644 --- a/source/Irrlicht/CLimitReadFile.cpp +++ b/source/Irrlicht/CLimitReadFile.cpp @@ -3,7 +3,6 @@ // For conditions of distribution and use, see copyright notice in irrlicht.h #include "CLimitReadFile.h" -#include "irrString.h" namespace irr { diff --git a/source/Irrlicht/CLimitReadFile.h b/source/Irrlicht/CLimitReadFile.h index 817ab2d..7ff52af 100644 --- a/source/Irrlicht/CLimitReadFile.h +++ b/source/Irrlicht/CLimitReadFile.h @@ -6,7 +6,6 @@ #define IRR_C_LIMIT_READ_FILE_H_INCLUDED #include "IReadFile.h" -#include "irrString.h" namespace irr { diff --git a/source/Irrlicht/CLogger.cpp b/source/Irrlicht/CLogger.cpp index 5b3feec..f01c3ca 100644 --- a/source/Irrlicht/CLogger.cpp +++ b/source/Irrlicht/CLogger.cpp @@ -3,6 +3,8 @@ // For conditions of distribution and use, see copyright notice in irrlicht.h #include "CLogger.h" +#include "os.h" +#include "irrString.h" namespace irr { diff --git a/source/Irrlicht/CLogger.h b/source/Irrlicht/CLogger.h index c635787..e484b30 100644 --- a/source/Irrlicht/CLogger.h +++ b/source/Irrlicht/CLogger.h @@ -6,8 +6,6 @@ #define IRR_C_LOGGER_H_INCLUDED #include "ILogger.h" -#include "os.h" -#include "irrString.h" #include "IEventReceiver.h" namespace irr diff --git a/source/Irrlicht/CMD2MeshFileLoader.cpp b/source/Irrlicht/CMD2MeshFileLoader.cpp index 78136e7..326a60c 100644 --- a/source/Irrlicht/CMD2MeshFileLoader.cpp +++ b/source/Irrlicht/CMD2MeshFileLoader.cpp @@ -7,6 +7,8 @@ #include "CMD2MeshFileLoader.h" #include "CAnimatedMeshMD2.h" +#include "coreutil.h" +#include "IReadFile.h" #include "os.h" namespace irr diff --git a/source/Irrlicht/CMD3MeshFileLoader.cpp b/source/Irrlicht/CMD3MeshFileLoader.cpp index 68f8d80..5fe4abd 100644 --- a/source/Irrlicht/CMD3MeshFileLoader.cpp +++ b/source/Irrlicht/CMD3MeshFileLoader.cpp @@ -7,7 +7,7 @@ #include "CMD3MeshFileLoader.h" #include "CAnimatedMeshMD3.h" -#include "irrString.h" +#include "IVideoDriver.h" namespace irr { diff --git a/source/Irrlicht/CMD3MeshFileLoader.h b/source/Irrlicht/CMD3MeshFileLoader.h index d677857..05cf095 100644 --- a/source/Irrlicht/CMD3MeshFileLoader.h +++ b/source/Irrlicht/CMD3MeshFileLoader.h @@ -6,10 +6,7 @@ #define IRR_C_MD3_MESH_FILE_LOADER_H_INCLUDED #include "IMeshLoader.h" -#include "IFileSystem.h" -#include "IVideoDriver.h" #include "ISceneManager.h" -#include "IQ3Shader.h" namespace irr { diff --git a/source/Irrlicht/CMY3DMeshFileLoader.cpp b/source/Irrlicht/CMY3DMeshFileLoader.cpp index 91a0124..b4d55f7 100644 --- a/source/Irrlicht/CMY3DMeshFileLoader.cpp +++ b/source/Irrlicht/CMY3DMeshFileLoader.cpp @@ -15,7 +15,7 @@ #include "CMeshTextureLoader.h" #include "SAnimatedMesh.h" -#include "SMeshBuffer.h" +#include "SMesh.h" #include "IReadFile.h" #include "IAttributes.h" diff --git a/source/Irrlicht/CMY3DMeshFileLoader.h b/source/Irrlicht/CMY3DMeshFileLoader.h index b2160e8..ae119e3 100644 --- a/source/Irrlicht/CMY3DMeshFileLoader.h +++ b/source/Irrlicht/CMY3DMeshFileLoader.h @@ -29,8 +29,7 @@ #include "IMeshLoader.h" -#include "SMesh.h" -#include "SMeshBufferLightMap.h" +#include "CMeshBuffer.h" #include "IFileSystem.h" #include "IVideoDriver.h" #include "irrString.h" diff --git a/source/Irrlicht/CMemoryFile.cpp b/source/Irrlicht/CMemoryFile.cpp index a214361..48c477d 100644 --- a/source/Irrlicht/CMemoryFile.cpp +++ b/source/Irrlicht/CMemoryFile.cpp @@ -3,7 +3,6 @@ // For conditions of distribution and use, see copyright notice in irrlicht.h #include "CMemoryFile.h" -#include "irrString.h" namespace irr { diff --git a/source/Irrlicht/CMemoryFile.h b/source/Irrlicht/CMemoryFile.h index fb59170..e30d637 100644 --- a/source/Irrlicht/CMemoryFile.h +++ b/source/Irrlicht/CMemoryFile.h @@ -7,7 +7,6 @@ #include "IMemoryReadFile.h" #include "IWriteFile.h" -#include "irrString.h" namespace irr { diff --git a/source/Irrlicht/CMeshSceneNode.cpp b/source/Irrlicht/CMeshSceneNode.cpp index c317604..cd7bbe8 100644 --- a/source/Irrlicht/CMeshSceneNode.cpp +++ b/source/Irrlicht/CMeshSceneNode.cpp @@ -6,11 +6,8 @@ #include "CBufferRenderNode.h" #include "IVideoDriver.h" #include "ISceneManager.h" -#include "S3DVertex.h" -#include "ICameraSceneNode.h" #include "IMeshCache.h" #include "IAnimatedMesh.h" -#include "IMaterialRenderer.h" #include "IFileSystem.h" #ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_ #include "CShadowVolumeSceneNode.h" diff --git a/source/Irrlicht/CMountPointReader.cpp b/source/Irrlicht/CMountPointReader.cpp index 1f5049d..fb6986a 100644 --- a/source/Irrlicht/CMountPointReader.cpp +++ b/source/Irrlicht/CMountPointReader.cpp @@ -7,7 +7,6 @@ #ifdef __IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_ #include "CReadFile.h" -#include "os.h" namespace irr { diff --git a/source/Irrlicht/CNPKReader.h b/source/Irrlicht/CNPKReader.h index ca6c2e2..2477a3c 100644 --- a/source/Irrlicht/CNPKReader.h +++ b/source/Irrlicht/CNPKReader.h @@ -10,9 +10,7 @@ #ifdef __IRR_COMPILE_WITH_NPK_ARCHIVE_LOADER_ -#include "IReferenceCounted.h" #include "IReadFile.h" -#include "irrArray.h" #include "irrString.h" #include "IFileSystem.h" #include "CFileList.h" diff --git a/source/Irrlicht/CNullDriver.cpp b/source/Irrlicht/CNullDriver.cpp index 1f89e37..1a03921 100644 --- a/source/Irrlicht/CNullDriver.cpp +++ b/source/Irrlicht/CNullDriver.cpp @@ -11,6 +11,7 @@ #include "IImageLoader.h" #include "IImageWriter.h" #include "IMaterialRenderer.h" +#include "IMeshSceneNode.h" #include "IAnimatedMeshSceneNode.h" #include "CMeshManipulator.h" #include "CColorConverter.h" diff --git a/source/Irrlicht/CNullDriver.h b/source/Irrlicht/CNullDriver.h index 98515ed..f5e85c7 100644 --- a/source/Irrlicht/CNullDriver.h +++ b/source/Irrlicht/CNullDriver.h @@ -7,7 +7,6 @@ #include "IVideoDriver.h" #include "IFileSystem.h" -#include "IImagePresenter.h" #include "IGPUProgrammingServices.h" #include "irrArray.h" #include "irrString.h" diff --git a/source/Irrlicht/COBJMeshFileLoader.cpp b/source/Irrlicht/COBJMeshFileLoader.cpp index 369f6f2..b7de81b 100644 --- a/source/Irrlicht/COBJMeshFileLoader.cpp +++ b/source/Irrlicht/COBJMeshFileLoader.cpp @@ -10,7 +10,6 @@ #include "IMeshManipulator.h" #include "IVideoDriver.h" #include "SMesh.h" -#include "SMeshBuffer.h" #include "SAnimatedMesh.h" #include "IReadFile.h" #include "IAttributes.h" @@ -68,13 +67,26 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file) { if (!file) return 0; + size_t filesize = file->getSize(); + if (filesize == 0 || filesize == (size_t)-1L) + return 0; + + const io::path fullName = file->getFileName(); + const io::path relPath = FileSystem->getFileDir(fullName)+"/"; + + c8* buf = new c8[filesize+1]; // plus null-terminator (some string functions used in parsing) + filesize = file->read((void*)buf, filesize); + if ( filesize == 0 ) + { + delete[] buf; + return 0; + } + buf[filesize] = 0; if ( getMeshTextureLoader() ) getMeshTextureLoader()->setMeshFile(file); - const long filesize = file->getSize(); - if (!filesize) - return 0; + const c8* const bufEnd = buf+filesize; const u32 WORD_BUFFER_LENGTH = 512; @@ -86,14 +98,6 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file) Materials.push_back(currMtl); u32 smoothingGroup=0; - const io::path fullName = file->getFileName(); - const io::path relPath = FileSystem->getFileDir(fullName)+"/"; - - c8* buf = new c8[filesize]; - memset(buf, 0, filesize); - file->read((void*)buf, filesize); - const c8* const bufEnd = buf+filesize; - // Process obj information const c8* bufPtr = buf; core::stringc grpName, mtlName; @@ -246,19 +250,20 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file) u32 wlength = copyWord(vertexWord, linePtr, WORD_BUFFER_LENGTH, endPtr); // this function will also convert obj's 1-based index to c++'s 0-based index retrieveVertexIndices(vertexWord, Idx, vertexWord+wlength+1, vertexBuffer.size(), textureCoordBuffer.size(), normalsBuffer.size()); - if ( -1 != Idx[0] && Idx[0] < (irr::s32)vertexBuffer.size() ) + if ( Idx[0] >= 0 && Idx[0] < (irr::s32)vertexBuffer.size() ) v.Pos = vertexBuffer[Idx[0]]; else { os::Printer::log("Invalid vertex index in this line", wordBuffer.c_str(), ELL_ERROR); delete [] buf; + cleanUp(); return 0; } - if ( -1 != Idx[1] && Idx[1] < (irr::s32)textureCoordBuffer.size() ) + if ( Idx[1] >= 0 && Idx[1] < (irr::s32)textureCoordBuffer.size() ) v.TCoords = textureCoordBuffer[Idx[1]]; else v.TCoords.set(0.0f,0.0f); - if ( -1 != Idx[2] && Idx[2] < (irr::s32)normalsBuffer.size() ) + if ( Idx[2] >= 0 && Idx[2] < (irr::s32)normalsBuffer.size() ) v.Normal = normalsBuffer[Idx[2]]; else { @@ -286,23 +291,30 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file) } // triangulate the face - const int c = faceCorners[0]; - for ( u32 i = 1; i < faceCorners.size() - 1; ++i ) + if ( faceCorners.size() >= 3) { - // Add a triangle - const int a = faceCorners[i + 1]; - const int b = faceCorners[i]; - if (a != b && a != c && b != c) // ignore degenerated faces. We can get them when we merge vertices above in the VertMap. + const int c = faceCorners[0]; + for ( u32 i = 1; i < faceCorners.size() - 1; ++i ) { - mbIndexBuffer.push_back(a); - mbIndexBuffer.push_back(b); - mbIndexBuffer.push_back(c); - } - else - { - ++degeneratedFaces; + // Add a triangle + const int a = faceCorners[i + 1]; + const int b = faceCorners[i]; + if (a != b && a != c && b != c) // ignore degenerated faces. We can get them when we merge vertices above in the VertMap. + { + mbIndexBuffer.push_back(a); + mbIndexBuffer.push_back(b); + mbIndexBuffer.push_back(c); + } + else + { + ++degeneratedFaces; + } } } + else + { + os::Printer::log("Too few vertices in this line", wordBuffer.c_str()); + } } break; diff --git a/source/Irrlicht/COBJMeshWriter.cpp b/source/Irrlicht/COBJMeshWriter.cpp index 7c1232e..b9a60e4 100644 --- a/source/Irrlicht/COBJMeshWriter.cpp +++ b/source/Irrlicht/COBJMeshWriter.cpp @@ -10,9 +10,7 @@ #include "os.h" #include "IMesh.h" #include "IMeshBuffer.h" -#include "IAttributes.h" #include "ISceneManager.h" -#include "IMeshCache.h" #include "IWriteFile.h" #include "IFileSystem.h" #include "ITexture.h" diff --git a/source/Irrlicht/COCTLoader.cpp b/source/Irrlicht/COCTLoader.cpp index c09120e..3410229 100644 --- a/source/Irrlicht/COCTLoader.cpp +++ b/source/Irrlicht/COCTLoader.cpp @@ -17,8 +17,9 @@ #include "IVideoDriver.h" #include "IFileSystem.h" #include "os.h" +#include "SMesh.h" #include "SAnimatedMesh.h" -#include "SMeshBufferLightMap.h" +#include "CMeshBuffer.h" #include "irrString.h" #include "ISceneManager.h" diff --git a/source/Irrlicht/COCTLoader.h b/source/Irrlicht/COCTLoader.h index 98acdcb..2e4e972 100644 --- a/source/Irrlicht/COCTLoader.h +++ b/source/Irrlicht/COCTLoader.h @@ -45,8 +45,6 @@ #include "IMeshLoader.h" #include "IReadFile.h" -#include "SMesh.h" -#include "irrString.h" namespace irr { diff --git a/source/Irrlicht/COgreMeshFileLoader.cpp b/source/Irrlicht/COgreMeshFileLoader.cpp index 9df2087..8246062 100644 --- a/source/Irrlicht/COgreMeshFileLoader.cpp +++ b/source/Irrlicht/COgreMeshFileLoader.cpp @@ -9,7 +9,8 @@ #include "COgreMeshFileLoader.h" #include "CMeshTextureLoader.h" #include "os.h" -#include "SMeshBuffer.h" +#include "CMeshBuffer.h" +#include "SMesh.h" #include "SAnimatedMesh.h" #include "IReadFile.h" #include "fast_atof.h" diff --git a/source/Irrlicht/COgreMeshFileLoader.h b/source/Irrlicht/COgreMeshFileLoader.h index facab78..7f8275e 100644 --- a/source/Irrlicht/COgreMeshFileLoader.h +++ b/source/Irrlicht/COgreMeshFileLoader.h @@ -10,12 +10,8 @@ #include "IFileSystem.h" #include "IVideoDriver.h" #include "irrString.h" -#include "SMesh.h" -#include "SMeshBuffer.h" -#include "SMeshBufferLightMap.h" -#include "IMeshManipulator.h" -#include "matrix4.h" #include "quaternion.h" +#include "CMeshBuffer.h" #include "CSkinnedMesh.h" namespace irr diff --git a/source/Irrlicht/COpenGLCacheHandler.h b/source/Irrlicht/COpenGLCacheHandler.h index 54365ba..9472e8b 100644 --- a/source/Irrlicht/COpenGLCacheHandler.h +++ b/source/Irrlicht/COpenGLCacheHandler.h @@ -11,8 +11,6 @@ #include "COpenGLCommon.h" -#include "COpenGLCoreFeature.h" -#include "COpenGLCoreTexture.h" #include "COpenGLCoreCacheHandler.h" namespace irr diff --git a/source/Irrlicht/COpenGLCoreCacheHandler.h b/source/Irrlicht/COpenGLCoreCacheHandler.h index 7f54452..2404b79 100644 --- a/source/Irrlicht/COpenGLCoreCacheHandler.h +++ b/source/Irrlicht/COpenGLCoreCacheHandler.h @@ -9,6 +9,8 @@ #if defined(_IRR_COMPILE_WITH_OPENGL_) || defined(_IRR_COMPILE_WITH_OGLES1_) || defined(_IRR_COMPILE_WITH_OGLES2_) +#include "COpenGLCoreFeature.h" +#include "COpenGLCoreTexture.h" #include "SMaterial.h" #include "ITexture.h" diff --git a/source/Irrlicht/COpenGLNormalMapRenderer.cpp b/source/Irrlicht/COpenGLNormalMapRenderer.cpp index 5bbad4f..d6591fc 100644 --- a/source/Irrlicht/COpenGLNormalMapRenderer.cpp +++ b/source/Irrlicht/COpenGLNormalMapRenderer.cpp @@ -6,8 +6,6 @@ #ifdef _IRR_COMPILE_WITH_OPENGL_ -#include "IGPUProgrammingServices.h" -#include "IShaderConstantSetCallBack.h" #include "IVideoDriver.h" #include "os.h" diff --git a/source/Irrlicht/COpenGLParallaxMapRenderer.cpp b/source/Irrlicht/COpenGLParallaxMapRenderer.cpp index d0edb74..cc33bf1 100644 --- a/source/Irrlicht/COpenGLParallaxMapRenderer.cpp +++ b/source/Irrlicht/COpenGLParallaxMapRenderer.cpp @@ -6,8 +6,6 @@ #ifdef _IRR_COMPILE_WITH_OPENGL_ -#include "IGPUProgrammingServices.h" -#include "IShaderConstantSetCallBack.h" #include "IVideoDriver.h" #include "os.h" diff --git a/source/Irrlicht/COpenGLSLMaterialRenderer.cpp b/source/Irrlicht/COpenGLSLMaterialRenderer.cpp index 09a1925..f6c6716 100644 --- a/source/Irrlicht/COpenGLSLMaterialRenderer.cpp +++ b/source/Irrlicht/COpenGLSLMaterialRenderer.cpp @@ -14,7 +14,6 @@ #ifdef _IRR_COMPILE_WITH_OPENGL_ -#include "IGPUProgrammingServices.h" #include "IShaderConstantSetCallBack.h" #include "IMaterialRendererServices.h" #include "IVideoDriver.h" @@ -22,7 +21,6 @@ #include "COpenGLDriver.h" #include "COpenGLCacheHandler.h" -#include "COpenGLMaterialRenderer.h" #include "COpenGLCoreFeature.h" diff --git a/source/Irrlicht/COpenGLShaderMaterialRenderer.cpp b/source/Irrlicht/COpenGLShaderMaterialRenderer.cpp index 1dabd31..ef5d10c 100644 --- a/source/Irrlicht/COpenGLShaderMaterialRenderer.cpp +++ b/source/Irrlicht/COpenGLShaderMaterialRenderer.cpp @@ -6,14 +6,12 @@ #ifdef _IRR_COMPILE_WITH_OPENGL_ -#include "IGPUProgrammingServices.h" #include "IShaderConstantSetCallBack.h" #include "IVideoDriver.h" #include "os.h" #include "COpenGLDriver.h" #include "COpenGLCacheHandler.h" -#include "COpenGLMaterialRenderer.h" namespace irr { diff --git a/source/Irrlicht/COpenGLShaderMaterialRenderer.h b/source/Irrlicht/COpenGLShaderMaterialRenderer.h index 06ebf30..82a51eb 100644 --- a/source/Irrlicht/COpenGLShaderMaterialRenderer.h +++ b/source/Irrlicht/COpenGLShaderMaterialRenderer.h @@ -10,6 +10,7 @@ #ifdef _IRR_COMPILE_WITH_OPENGL_ #include "IMaterialRenderer.h" +#include "irrArray.h" #include "COpenGLCommon.h" diff --git a/source/Irrlicht/CPakReader.h b/source/Irrlicht/CPakReader.h index bb7cc18..c13108e 100644 --- a/source/Irrlicht/CPakReader.h +++ b/source/Irrlicht/CPakReader.h @@ -9,10 +9,7 @@ #ifdef __IRR_COMPILE_WITH_PAK_ARCHIVE_LOADER_ -#include "IReferenceCounted.h" #include "IReadFile.h" -#include "irrArray.h" -#include "irrString.h" #include "IFileSystem.h" #include "CFileList.h" diff --git a/source/Irrlicht/CParticleGravityAffector.cpp b/source/Irrlicht/CParticleGravityAffector.cpp index 1938a54..d4a6918 100644 --- a/source/Irrlicht/CParticleGravityAffector.cpp +++ b/source/Irrlicht/CParticleGravityAffector.cpp @@ -6,7 +6,6 @@ #ifdef _IRR_COMPILE_WITH_PARTICLES_ -#include "os.h" #include "IAttributes.h" namespace irr diff --git a/source/Irrlicht/CParticleGravityAffector.h b/source/Irrlicht/CParticleGravityAffector.h index d3bd619..0d31cdd 100644 --- a/source/Irrlicht/CParticleGravityAffector.h +++ b/source/Irrlicht/CParticleGravityAffector.h @@ -9,7 +9,6 @@ #ifdef _IRR_COMPILE_WITH_PARTICLES_ #include "IParticleGravityAffector.h" -#include "SColor.h" namespace irr { diff --git a/source/Irrlicht/CParticleMeshEmitter.cpp b/source/Irrlicht/CParticleMeshEmitter.cpp index ef667c5..5fa0463 100644 --- a/source/Irrlicht/CParticleMeshEmitter.cpp +++ b/source/Irrlicht/CParticleMeshEmitter.cpp @@ -8,6 +8,7 @@ #ifdef _IRR_COMPILE_WITH_PARTICLES_ #include "os.h" +#include "IMeshBuffer.h" namespace irr { diff --git a/source/Irrlicht/CParticleMeshEmitter.h b/source/Irrlicht/CParticleMeshEmitter.h index 2863c93..90ddb52 100644 --- a/source/Irrlicht/CParticleMeshEmitter.h +++ b/source/Irrlicht/CParticleMeshEmitter.h @@ -9,9 +9,8 @@ #ifdef _IRR_COMPILE_WITH_PARTICLES_ #include "IParticleMeshEmitter.h" +#include "IMesh.h" #include "irrArray.h" -#include "aabbox3d.h" -#include "IMeshBuffer.h" namespace irr { diff --git a/source/Irrlicht/CParticlePointEmitter.h b/source/Irrlicht/CParticlePointEmitter.h index c88645d..c4bddb6 100644 --- a/source/Irrlicht/CParticlePointEmitter.h +++ b/source/Irrlicht/CParticlePointEmitter.h @@ -9,7 +9,6 @@ #ifdef _IRR_COMPILE_WITH_PARTICLES_ #include "IParticleEmitter.h" -#include "irrArray.h" namespace irr { diff --git a/source/Irrlicht/CParticleSphereEmitter.h b/source/Irrlicht/CParticleSphereEmitter.h index 96060fc..25a2556 100644 --- a/source/Irrlicht/CParticleSphereEmitter.h +++ b/source/Irrlicht/CParticleSphereEmitter.h @@ -10,7 +10,6 @@ #include "IParticleSphereEmitter.h" #include "irrArray.h" -#include "aabbox3d.h" namespace irr { diff --git a/source/Irrlicht/CParticleSystemSceneNode.h b/source/Irrlicht/CParticleSystemSceneNode.h index 1510549..d3d8488 100644 --- a/source/Irrlicht/CParticleSystemSceneNode.h +++ b/source/Irrlicht/CParticleSystemSceneNode.h @@ -11,7 +11,7 @@ #include "IParticleSystemSceneNode.h" #include "irrArray.h" #include "irrList.h" -#include "SMeshBuffer.h" +#include "CMeshBuffer.h" namespace irr { diff --git a/source/Irrlicht/CProfiler.cpp b/source/Irrlicht/CProfiler.cpp index 537bea4..a313169 100644 --- a/source/Irrlicht/CProfiler.cpp +++ b/source/Irrlicht/CProfiler.cpp @@ -3,6 +3,7 @@ // Written by Michael Zeilfelder #include "CProfiler.h" +#include "IrrCompileConfig.h" #include "CTimer.h" namespace irr diff --git a/source/Irrlicht/CProfiler.h b/source/Irrlicht/CProfiler.h index ac4c1f2..3fbb820 100644 --- a/source/Irrlicht/CProfiler.h +++ b/source/Irrlicht/CProfiler.h @@ -5,7 +5,6 @@ #ifndef IRR_C_PROFILER_H_INCLUDED #define IRR_C_PROFILER_H_INCLUDED -#include "IrrCompileConfig.h" #include "IProfiler.h" namespace irr diff --git a/source/Irrlicht/CQ3LevelMesh.cpp b/source/Irrlicht/CQ3LevelMesh.cpp index ca7d96e..1e720c4 100644 --- a/source/Irrlicht/CQ3LevelMesh.cpp +++ b/source/Irrlicht/CQ3LevelMesh.cpp @@ -8,9 +8,7 @@ #include "CQ3LevelMesh.h" #include "ISceneManager.h" #include "os.h" -#include "SMeshBufferLightMap.h" #include "irrString.h" -#include "ILightSceneNode.h" #include "IQ3Shader.h" #include "IFileList.h" diff --git a/source/Irrlicht/CQ3LevelMesh.h b/source/Irrlicht/CQ3LevelMesh.h index a6045d9..a9feaeb 100644 --- a/source/Irrlicht/CQ3LevelMesh.h +++ b/source/Irrlicht/CQ3LevelMesh.h @@ -9,11 +9,10 @@ #include "IReadFile.h" #include "IFileSystem.h" #include "SMesh.h" -#include "SMeshBufferLightMap.h" +#include "CMeshBuffer.h" #include "IVideoDriver.h" #include "irrString.h" #include "ISceneManager.h" -#include "os.h" namespace irr { diff --git a/source/Irrlicht/CQuake3ShaderSceneNode.cpp b/source/Irrlicht/CQuake3ShaderSceneNode.cpp index 972f131..7efeab9 100644 --- a/source/Irrlicht/CQuake3ShaderSceneNode.cpp +++ b/source/Irrlicht/CQuake3ShaderSceneNode.cpp @@ -13,7 +13,6 @@ #include "SViewFrustum.h" #include "IMeshManipulator.h" #include "SMesh.h" -#include "IMaterialRenderer.h" #ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_ #include "CShadowVolumeSceneNode.h" #else diff --git a/source/Irrlicht/CQuake3ShaderSceneNode.h b/source/Irrlicht/CQuake3ShaderSceneNode.h index 6b9948e..9afba59 100644 --- a/source/Irrlicht/CQuake3ShaderSceneNode.h +++ b/source/Irrlicht/CQuake3ShaderSceneNode.h @@ -8,8 +8,7 @@ #include "IMeshSceneNode.h" #include "IQ3Shader.h" #include "IFileSystem.h" -#include "SMeshBuffer.h" -#include "SMeshBufferLightMap.h" +#include "CMeshBuffer.h" #include "SMesh.h" #include "ISceneManager.h" diff --git a/source/Irrlicht/CReadFile.h b/source/Irrlicht/CReadFile.h index 4f7e135..29e5388 100644 --- a/source/Irrlicht/CReadFile.h +++ b/source/Irrlicht/CReadFile.h @@ -7,7 +7,6 @@ #include #include "IReadFile.h" -#include "irrString.h" namespace irr { diff --git a/source/Irrlicht/CSMFMeshFileLoader.cpp b/source/Irrlicht/CSMFMeshFileLoader.cpp index d6ddb13..b083031 100644 --- a/source/Irrlicht/CSMFMeshFileLoader.cpp +++ b/source/Irrlicht/CSMFMeshFileLoader.cpp @@ -9,7 +9,7 @@ #include "CSMFMeshFileLoader.h" #include "CMeshTextureLoader.h" #include "SAnimatedMesh.h" -#include "SMeshBuffer.h" +#include "CMeshBuffer.h" #include "IReadFile.h" #include "coreutil.h" #include "os.h" diff --git a/source/Irrlicht/CSTLMeshWriter.h b/source/Irrlicht/CSTLMeshWriter.h index 58974f3..463cfbd 100644 --- a/source/Irrlicht/CSTLMeshWriter.h +++ b/source/Irrlicht/CSTLMeshWriter.h @@ -6,7 +6,7 @@ #define IRR_STL_MESH_WRITER_H_INCLUDED #include "IMeshWriter.h" -#include "S3DVertex.h" +#include "vector3d.h" #include "irrString.h" namespace irr diff --git a/source/Irrlicht/CSceneCollisionManager.cpp b/source/Irrlicht/CSceneCollisionManager.cpp index 78ba131..cdbd7eb 100644 --- a/source/Irrlicht/CSceneCollisionManager.cpp +++ b/source/Irrlicht/CSceneCollisionManager.cpp @@ -8,7 +8,6 @@ #include "ITriangleSelector.h" #include "SViewFrustum.h" -#include "os.h" #include "irrMath.h" namespace irr diff --git a/source/Irrlicht/CSceneLoaderIrr.cpp b/source/Irrlicht/CSceneLoaderIrr.cpp index 7705436..4d1f111 100644 --- a/source/Irrlicht/CSceneLoaderIrr.cpp +++ b/source/Irrlicht/CSceneLoaderIrr.cpp @@ -3,11 +3,12 @@ // For conditions of distribution and use, see copyright notice in irrlicht.h #include "CSceneLoaderIrr.h" -#include "ISceneNodeAnimatorFactory.h" #include "ISceneUserDataSerializer.h" #include "ISceneManager.h" +#include "ISceneNode.h" #include "IVideoDriver.h" #include "IFileSystem.h" +#include "IAttributes.h" #include "os.h" namespace irr diff --git a/source/Irrlicht/CSceneManager.cpp b/source/Irrlicht/CSceneManager.cpp index 6255cfe..93dd919 100644 --- a/source/Irrlicht/CSceneManager.cpp +++ b/source/Irrlicht/CSceneManager.cpp @@ -12,7 +12,6 @@ #include "IXMLWriter.h" #include "ISceneUserDataSerializer.h" #include "IGUIEnvironment.h" -#include "IMaterialRenderer.h" #include "IReadFile.h" #include "IWriteFile.h" #include "ISceneLoader.h" diff --git a/source/Irrlicht/CSceneNodeAnimatorCameraFPS.h b/source/Irrlicht/CSceneNodeAnimatorCameraFPS.h index 65acdf4..b1dc6ec 100644 --- a/source/Irrlicht/CSceneNodeAnimatorCameraFPS.h +++ b/source/Irrlicht/CSceneNodeAnimatorCameraFPS.h @@ -6,7 +6,6 @@ #define IRR_C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED #include "ISceneNodeAnimatorCameraFPS.h" -#include "vector2d.h" #include "position2d.h" #include "SKeyMap.h" #include "irrArray.h" diff --git a/source/Irrlicht/CSceneNodeAnimatorCameraMaya.h b/source/Irrlicht/CSceneNodeAnimatorCameraMaya.h index 9b3993d..07a6d5f 100644 --- a/source/Irrlicht/CSceneNodeAnimatorCameraMaya.h +++ b/source/Irrlicht/CSceneNodeAnimatorCameraMaya.h @@ -7,7 +7,7 @@ #include "ISceneNodeAnimatorCameraMaya.h" #include "ICameraSceneNode.h" -#include "vector2d.h" +#include "position2d.h" namespace irr { diff --git a/source/Irrlicht/CSkinnedMesh.h b/source/Irrlicht/CSkinnedMesh.h index b51c038..7e246b1 100644 --- a/source/Irrlicht/CSkinnedMesh.h +++ b/source/Irrlicht/CSkinnedMesh.h @@ -8,10 +8,6 @@ #define IRR_C_SKINNED_MESH_H_INCLUDED #include "ISkinnedMesh.h" -#include "SMeshBuffer.h" -#include "S3DVertex.h" -#include "irrString.h" -#include "matrix4.h" #include "quaternion.h" namespace irr @@ -21,6 +17,7 @@ namespace scene class IAnimatedMeshSceneNode; class IBoneSceneNode; + class ISceneManager; class CSkinnedMesh: public ISkinnedMesh { diff --git a/source/Irrlicht/CSkyBoxSceneNode.cpp b/source/Irrlicht/CSkyBoxSceneNode.cpp index 2ad3fe6..c28bc37 100644 --- a/source/Irrlicht/CSkyBoxSceneNode.cpp +++ b/source/Irrlicht/CSkyBoxSceneNode.cpp @@ -7,7 +7,6 @@ #include "ISceneManager.h" #include "ICameraSceneNode.h" #include "S3DVertex.h" -#include "os.h" namespace irr { diff --git a/source/Irrlicht/CSkyDomeSceneNode.cpp b/source/Irrlicht/CSkyDomeSceneNode.cpp index 7cf81f3..f4ca022 100644 --- a/source/Irrlicht/CSkyDomeSceneNode.cpp +++ b/source/Irrlicht/CSkyDomeSceneNode.cpp @@ -9,8 +9,6 @@ #include "IVideoDriver.h" #include "ISceneManager.h" #include "ICameraSceneNode.h" -#include "IAnimatedMesh.h" -#include "os.h" namespace irr { diff --git a/source/Irrlicht/CSkyDomeSceneNode.h b/source/Irrlicht/CSkyDomeSceneNode.h index 68d8c08..d17925d 100644 --- a/source/Irrlicht/CSkyDomeSceneNode.h +++ b/source/Irrlicht/CSkyDomeSceneNode.h @@ -7,7 +7,7 @@ #define IRR_C_SKY_DOME_SCENE_NODE_H_INCLUDED #include "ISceneNode.h" -#include "SMeshBuffer.h" +#include "CMeshBuffer.h" namespace irr { diff --git a/source/Irrlicht/CSoftwareDriver.cpp b/source/Irrlicht/CSoftwareDriver.cpp index 426aac2..eb2d5b7 100644 --- a/source/Irrlicht/CSoftwareDriver.cpp +++ b/source/Irrlicht/CSoftwareDriver.cpp @@ -11,6 +11,7 @@ #include "CBlit.h" #include "os.h" #include "S3DVertex.h" +#include "SViewFrustum.h" namespace irr { diff --git a/source/Irrlicht/CSoftwareDriver.h b/source/Irrlicht/CSoftwareDriver.h index c51eb29..d121b07 100644 --- a/source/Irrlicht/CSoftwareDriver.h +++ b/source/Irrlicht/CSoftwareDriver.h @@ -6,8 +6,8 @@ #define IRR_C_SOFTWARE_DRIVER_H_INCLUDED #include "ITriangleRenderer.h" +#include "IImagePresenter.h" #include "CNullDriver.h" -#include "SViewFrustum.h" #include "CImage.h" namespace irr diff --git a/source/Irrlicht/CSoftwareDriver2.h b/source/Irrlicht/CSoftwareDriver2.h index 01ae812..1716200 100644 --- a/source/Irrlicht/CSoftwareDriver2.h +++ b/source/Irrlicht/CSoftwareDriver2.h @@ -7,6 +7,7 @@ #include "SoftwareDriver2_compile_config.h" #include "IBurningShader.h" +#include "IImagePresenter.h" #include "CNullDriver.h" #include "CImage.h" #include "os.h" diff --git a/source/Irrlicht/CSphereSceneNode.cpp b/source/Irrlicht/CSphereSceneNode.cpp index 1693f5e..0592588 100644 --- a/source/Irrlicht/CSphereSceneNode.cpp +++ b/source/Irrlicht/CSphereSceneNode.cpp @@ -7,8 +7,6 @@ #include "CSphereSceneNode.h" #include "IVideoDriver.h" #include "ISceneManager.h" -#include "S3DVertex.h" -#include "os.h" #ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_ #include "CShadowVolumeSceneNode.h" #else diff --git a/source/Irrlicht/CTarReader.cpp b/source/Irrlicht/CTarReader.cpp index 6fd5ea7..5df4c40 100644 --- a/source/Irrlicht/CTarReader.cpp +++ b/source/Irrlicht/CTarReader.cpp @@ -7,7 +7,7 @@ #ifdef __IRR_COMPILE_WITH_TAR_ARCHIVE_LOADER_ #include "CFileList.h" -#include "CLimitReadFile.h" +#include "IReadFile.h" #include "os.h" #include "coreutil.h" #include "errno.h" diff --git a/source/Irrlicht/CTarReader.h b/source/Irrlicht/CTarReader.h index a446fcc..0a17a8b 100644 --- a/source/Irrlicht/CTarReader.h +++ b/source/Irrlicht/CTarReader.h @@ -9,10 +9,7 @@ #ifdef __IRR_COMPILE_WITH_TAR_ARCHIVE_LOADER_ -#include "IReferenceCounted.h" #include "IReadFile.h" -#include "irrArray.h" -#include "irrString.h" #include "IFileSystem.h" #include "CFileList.h" diff --git a/source/Irrlicht/CTerrainSceneNode.cpp b/source/Irrlicht/CTerrainSceneNode.cpp index 0dbb96a..08cd077 100644 --- a/source/Irrlicht/CTerrainSceneNode.cpp +++ b/source/Irrlicht/CTerrainSceneNode.cpp @@ -19,11 +19,8 @@ #include "SViewFrustum.h" #include "irrMath.h" #include "os.h" -#include "IGUIFont.h" #include "IFileSystem.h" #include "IReadFile.h" -#include "ITextSceneNode.h" -#include "IAnimatedMesh.h" #include "SMesh.h" #include "CDynamicMeshBuffer.h" diff --git a/source/Irrlicht/CTextSceneNode.cpp b/source/Irrlicht/CTextSceneNode.cpp index e97dc91..a4f83fb 100644 --- a/source/Irrlicht/CTextSceneNode.cpp +++ b/source/Irrlicht/CTextSceneNode.cpp @@ -7,7 +7,7 @@ #include "IVideoDriver.h" #include "ICameraSceneNode.h" #include "IGUISpriteBank.h" -#include "SMeshBuffer.h" +#include "CMeshBuffer.h" #include "os.h" diff --git a/source/Irrlicht/CTimer.h b/source/Irrlicht/CTimer.h index 6cfc64e..3a942ed 100644 --- a/source/Irrlicht/CTimer.h +++ b/source/Irrlicht/CTimer.h @@ -53,7 +53,7 @@ namespace irr //! Stops the game timer. /** The timer is reference counted, which means everything which calls stopTimer() will also have to call startTimer(), otherwise the timer may not start/stop - corretly again. */ + correctly again. */ virtual void stop() IRR_OVERRIDE { os::Timer::stopTimer(); @@ -62,7 +62,7 @@ namespace irr //! Starts the game timer. /** The timer is reference counted, which means everything which calls stopTimer() will also have to call startTimer(), otherwise the timer may not start/stop - corretly again. */ + correctly again. */ virtual void start() IRR_OVERRIDE { os::Timer::startTimer(); diff --git a/source/Irrlicht/CVolumeLightSceneNode.cpp b/source/Irrlicht/CVolumeLightSceneNode.cpp index 720c360..47df293 100644 --- a/source/Irrlicht/CVolumeLightSceneNode.cpp +++ b/source/Irrlicht/CVolumeLightSceneNode.cpp @@ -5,8 +5,6 @@ #include "CVolumeLightSceneNode.h" #include "IVideoDriver.h" #include "ISceneManager.h" -#include "S3DVertex.h" -#include "os.h" namespace irr { diff --git a/source/Irrlicht/CWADReader.h b/source/Irrlicht/CWADReader.h index 8d9a01a..66d18ee 100644 --- a/source/Irrlicht/CWADReader.h +++ b/source/Irrlicht/CWADReader.h @@ -8,9 +8,7 @@ #include "IrrCompileConfig.h" #ifdef __IRR_COMPILE_WITH_WAD_ARCHIVE_LOADER_ -#include "IReferenceCounted.h" #include "IReadFile.h" -#include "irrArray.h" #include "irrString.h" #include "IFileSystem.h" #include "CFileList.h" diff --git a/source/Irrlicht/CWriteFile.cpp b/source/Irrlicht/CWriteFile.cpp index ef816b6..ba551ae 100644 --- a/source/Irrlicht/CWriteFile.cpp +++ b/source/Irrlicht/CWriteFile.cpp @@ -3,7 +3,6 @@ // For conditions of distribution and use, see copyright notice in irrlicht.h #include "CWriteFile.h" -#include namespace irr { diff --git a/source/Irrlicht/CWriteFile.h b/source/Irrlicht/CWriteFile.h index 9f6f450..646f197 100644 --- a/source/Irrlicht/CWriteFile.h +++ b/source/Irrlicht/CWriteFile.h @@ -7,7 +7,6 @@ #include #include "IWriteFile.h" -#include "irrString.h" namespace irr { diff --git a/source/Irrlicht/CXMLWriter.cpp b/source/Irrlicht/CXMLWriter.cpp index 4e9d690..ed42f39 100644 --- a/source/Irrlicht/CXMLWriter.cpp +++ b/source/Irrlicht/CXMLWriter.cpp @@ -6,7 +6,6 @@ #ifdef _IRR_COMPILE_WITH_XML_ -#include #include "irrString.h" #include "IrrCompileConfig.h" diff --git a/source/Irrlicht/CXMeshFileLoader.cpp b/source/Irrlicht/CXMeshFileLoader.cpp index db72b21..840773e 100644 --- a/source/Irrlicht/CXMeshFileLoader.cpp +++ b/source/Irrlicht/CXMeshFileLoader.cpp @@ -408,7 +408,8 @@ bool CXMeshFileLoader::readFileIntoMemory(io::IReadFile* file) return false; } - Buffer = new c8[size]; + Buffer = new c8[size+1]; + Buffer[size] = 0x0; // null-terminate (thx @ sfan5) //! read all into memory if (file->read(Buffer, size) != static_cast(size)) diff --git a/source/Irrlicht/CZipReader.h b/source/Irrlicht/CZipReader.h index 80ba644..af6be71 100644 --- a/source/Irrlicht/CZipReader.h +++ b/source/Irrlicht/CZipReader.h @@ -11,7 +11,6 @@ #include "IReadFile.h" #include "irrArray.h" -#include "irrString.h" #include "IFileSystem.h" #include "CFileList.h" diff --git a/source/Irrlicht/EProfileIDs.h b/source/Irrlicht/EProfileIDs.h index ea62193..eb48848 100644 --- a/source/Irrlicht/EProfileIDs.h +++ b/source/Irrlicht/EProfileIDs.h @@ -5,11 +5,12 @@ #define E_PROFILE_IDS_H_INCLUDED__ #include "IrrCompileConfig.h" + +#ifdef _IRR_COMPILE_WITH_PROFILING_ #include "limits.h" namespace irr { -#ifdef _IRR_COMPILE_WITH_PROFILING_ enum EPROFILE_ID { // We use negative ID's to avoid clashing with user application id's. @@ -49,7 +50,8 @@ namespace irr EPID_ES2_SET_RENDERSTATE_TEXTURE, EPID_ES2_DRAW_SHADOW }; -#endif } // end namespace irr +#endif + #endif // E_PROFILE_IDS_H_INCLUDED__ diff --git a/source/Irrlicht/Irrlicht17.0.vcxproj b/source/Irrlicht/Irrlicht17.0.vcxproj index 465cdd3..5da6b92 100644 --- a/source/Irrlicht/Irrlicht17.0.vcxproj +++ b/source/Irrlicht/Irrlicht17.0.vcxproj @@ -277,6 +277,7 @@ MultiThreadedDebugDLL + true _DEBUG;%(PreprocessorDefinitions) @@ -359,6 +360,7 @@ true + true NDEBUG;%(PreprocessorDefinitions) @@ -420,6 +422,7 @@ false Level3 4577 + true _DEBUG;%(PreprocessorDefinitions) @@ -490,6 +493,7 @@ false 4577 + true NDEBUG;%(PreprocessorDefinitions) @@ -559,6 +563,7 @@ false Level3 4577 + true _DEBUG;%(PreprocessorDefinitions) diff --git a/source/Irrlicht/SB3DStructs.h b/source/Irrlicht/SB3DStructs.h index 8f88a85..dfec8f8 100644 --- a/source/Irrlicht/SB3DStructs.h +++ b/source/Irrlicht/SB3DStructs.h @@ -12,6 +12,7 @@ #define SB3DSTRUCTS_H #include "SMaterial.h" +#include "irrMath.h" namespace irr { namespace scene { @@ -27,6 +28,7 @@ struct SB3dChunk SB3dChunk(const SB3dChunkHeader& header, long sp) : length(header.size+8), startposition(sp) { + length = core::max_(length, 8); name[0]=header.name[0]; name[1]=header.name[1]; name[2]=header.name[2]; diff --git a/source/Irrlicht/irrXML.cpp b/source/Irrlicht/irrXML.cpp index 003b3b2..cc2a96b 100644 --- a/source/Irrlicht/irrXML.cpp +++ b/source/Irrlicht/irrXML.cpp @@ -6,9 +6,6 @@ #ifdef _IRR_COMPILE_WITH_XML_ -#include "irrString.h" -#include "irrArray.h" -#include "fast_atof.h" #include "CXMLReaderImpl.h" namespace irr diff --git a/source/Irrlicht/os.h b/source/Irrlicht/os.h index ae524c8..5087366 100644 --- a/source/Irrlicht/os.h +++ b/source/Irrlicht/os.h @@ -7,7 +7,6 @@ #include "IrrCompileConfig.h" // for endian check #include "irrTypes.h" -#include "irrString.h" #include "path.h" #include "ILogger.h" #include "ITimer.h" diff --git a/source/Irrlicht/utf8.cpp b/source/Irrlicht/utf8.cpp index 806296b..d745fe8 100644 --- a/source/Irrlicht/utf8.cpp +++ b/source/Irrlicht/utf8.cpp @@ -3,7 +3,6 @@ // under the zlib license, reproduced below. #include "irrTypes.h" -#include "irrString.h" namespace irr { diff --git a/tests/tests-last-passed-at.txt b/tests/tests-last-passed-at.txt index 2fc244f..683dc84 100644 --- a/tests/tests-last-passed-at.txt +++ b/tests/tests-last-passed-at.txt @@ -1,4 +1,4 @@ Tests finished. 72 tests of 72 passed. Compiled as DEBUG -Test suite pass at GMT Tue May 09 10:09:52 2023 +Test suite pass at GMT Fri Sep 22 15:57:32 2023