From 5163d74e3f630655564736f8aefcf5883e260796 Mon Sep 17 00:00:00 2001 From: cutealien Date: Thu, 21 Apr 2022 22:24:14 +0000 Subject: [PATCH] Remove trivial copy constructors and assignment operators Thanks @sfan5 for patch for Mintest: https://github.com/minetest/irrlicht/commit/4931b346253c64069d45947960405c8f6afc0b55 Forum: https://irrlicht.sourceforge.io/forum/viewtopic.php?f=2&t=52819 Note - patch is not applied exaclty yet. SMaterial and matrix4 still missing (might be applied later). Also patch was based on older Irrlicht and we removed a few already earlier this year (around r6280). git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6355 dfc29bdd-3216-0410-991c-e03cc46cb475 --- changes.txt | 10 +++++++--- include/IAnimatedMeshMD3.h | 28 +--------------------------- include/irrMap.h | 20 +------------------- include/vector2d.h | 4 ---- include/vector3d.h | 4 ---- tests/tests-last-passed-at.txt | 8 ++++---- 6 files changed, 13 insertions(+), 61 deletions(-) diff --git a/changes.txt b/changes.txt index a0fa6367..b2c436f6 100644 --- a/changes.txt +++ b/changes.txt @@ -1,14 +1,18 @@ -------------------------- Changes in 1.9 (not yet released) + +- Fix OSX nor resizing properly. Thanks @torleif, Jordach and sfan5 for patch and report: https://irrlicht.sourceforge.io/forum/viewtopic.php?f=2&t=52819 +- X meshloader fixes bug with uninitialized normals. Thanks @sfan5 for patch: https://irrlicht.sourceforge.io/forum/viewtopic.php?f=2&t=52819 - stl meshloader now faster, especially with text format -- CMemoryReadFile::seek no longer allowed to go _before_ start. +- CMemoryReadFile::seek CMemoryWriteFile::seek and no longer allowed to go _before_ start. + Thanks @sfan5 for patch: https://irrlicht.sourceforge.io/forum/viewtopic.php?f=2&t=52819 - stl meshloader can now load 32 bit buffers. - Thanks @Foaly for the patch (https://irrlicht.sourceforge.io/forum/viewtopic.php?f=9&t=51441) + Thanks @Foaly for the patch: https://irrlicht.sourceforge.io/forum/viewtopic.php?f=9&t=51441 - Add IMeshBufffer::clone function to create buffer copies. CMeshManipulator::createMeshCopy uses that now and works now with all types of meshbuffers. - obj writer can now write 32 bit buffers - obj meshloader can now load 32 bit buffers when setIndexTypeHint is set correspondingly It's 16 bit meshes use now also an IDynamicMeshbuffer instead of an SMeshBuffer. - Thanks @Wol101 for original patch proposal (https://irrlicht.sourceforge.io/forum/viewtopic.php?f=9&t=51441) + Thanks @Wol101 for original patch proposal: https://irrlicht.sourceforge.io/forum/viewtopic.php?f=9&t=51441 - Add IMeshLoader::setIndexTypeHint and getIndexTypeHint to allow setting hints for the loaders if users prefer 16 or 32 bit meshbuffers. Default is now to use optimal meshbuffer depending on number of vertices (if the loader supports it). - Add IMeshBuffer::getType to allow finding out which class type a meshbuffer has (similar to ISceneNode::getType). diff --git a/include/IAnimatedMeshMD3.h b/include/IAnimatedMeshMD3.h index 6612516b..dc6f9b2a 100644 --- a/include/IAnimatedMeshMD3.h +++ b/include/IAnimatedMeshMD3.h @@ -153,13 +153,7 @@ namespace scene { virtual ~SMD3QuaternionTag() { - position.X = 0.f; - } - - // construct copy constructor - SMD3QuaternionTag( const SMD3QuaternionTag & copyMe ) - { - *this = copyMe; + position.X = 0.f; // anyone got an idea why? } // construct for searching @@ -181,14 +175,6 @@ namespace scene return Name == other.Name; } - SMD3QuaternionTag & operator=( const SMD3QuaternionTag & copyMe ) - { - Name = copyMe.Name; - position = copyMe.position; - rotation = copyMe.rotation; - return *this; - } - core::stringc Name; core::vector3df position; core::quaternion rotation; @@ -202,12 +188,6 @@ namespace scene Container.setAllocStrategy(core::ALLOC_STRATEGY_SAFE); } - // construct copy constructor - SMD3QuaternionTagList(const SMD3QuaternionTagList& copyMe) - { - *this = copyMe; - } - virtual ~SMD3QuaternionTagList() {} SMD3QuaternionTag* get(const core::stringc& name) @@ -250,12 +230,6 @@ namespace scene Container.push_back(other); } - SMD3QuaternionTagList& operator = (const SMD3QuaternionTagList & copyMe) - { - Container = copyMe.Container; - return *this; - } - private: core::array < SMD3QuaternionTag > Container; }; diff --git a/include/irrMap.h b/include/irrMap.h index 35ea6a3c..ff55e438 100644 --- a/include/irrMap.h +++ b/include/irrMap.h @@ -140,9 +140,6 @@ class map reset(); } - // Copy constructor - Iterator(const Iterator& src) : Root(src.Root), Cur(src.Cur) {} - void reset(bool atLowest=true) { if (atLowest) @@ -161,13 +158,6 @@ class map return Cur; } - Iterator& operator=(const Iterator& src) - { - Root = src.Root; - Cur = src.Cur; - return (*this); - } - void operator++(int) { inc(); @@ -287,8 +277,7 @@ class map reset(); } - // Copy constructor - ConstIterator(const ConstIterator& src) : Root(src.Root), Cur(src.Cur) {} + // Constructor(Iterator) ConstIterator(const Iterator& src) : Root(src.Root), Cur(src.Cur) {} void reset(bool atLowest=true) @@ -309,13 +298,6 @@ class map return Cur; } - ConstIterator& operator=(const ConstIterator& src) - { - Root = src.Root; - Cur = src.Cur; - return (*this); - } - void operator++(int) { inc(); diff --git a/include/vector2d.h b/include/vector2d.h index 93ab5049..816d4983 100644 --- a/include/vector2d.h +++ b/include/vector2d.h @@ -27,8 +27,6 @@ public: vector2d(T nx, T ny) : X(nx), Y(ny) {} //! Constructor with the same value for both members explicit vector2d(T n) : X(n), Y(n) {} - //! Copy constructor - vector2d(const vector2d& other) : X(other.X), Y(other.Y) {} vector2d(const dimension2d& other) : X(other.Width), Y(other.Height) {} @@ -36,8 +34,6 @@ public: vector2d operator-() const { return vector2d(-X, -Y); } - vector2d& operator=(const vector2d& other) { X = other.X; Y = other.Y; return *this; } - vector2d& operator=(const dimension2d& other) { X = other.Width; Y = other.Height; return *this; } vector2d operator+(const vector2d& other) const { return vector2d(X + other.X, Y + other.Y); } diff --git a/include/vector3d.h b/include/vector3d.h index ebea7c46..dfc35b58 100644 --- a/include/vector3d.h +++ b/include/vector3d.h @@ -28,15 +28,11 @@ namespace core vector3d(T nx, T ny, T nz) : X(nx), Y(ny), Z(nz) {} //! Constructor with the same value for all elements explicit vector3d(T n) : X(n), Y(n), Z(n) {} - //! Copy constructor - vector3d(const vector3d& other) : X(other.X), Y(other.Y), Z(other.Z) {} // operators vector3d operator-() const { return vector3d(-X, -Y, -Z); } - vector3d& operator=(const vector3d& other) { X = other.X; Y = other.Y; Z = other.Z; return *this; } - vector3d operator+(const vector3d& other) const { return vector3d(X + other.X, Y + other.Y, Z + other.Z); } vector3d& operator+=(const vector3d& other) { X+=other.X; Y+=other.Y; Z+=other.Z; return *this; } vector3d operator+(const T val) const { return vector3d(X + val, Y + val, Z + val); } diff --git a/tests/tests-last-passed-at.txt b/tests/tests-last-passed-at.txt index b2e7b88e..cd5f8857 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 Thu Apr 14 16:41:11 2022 - +Tests finished. 72 tests of 72 passed. +Compiled as DEBUG +Test suite pass at GMT Thu Apr 21 21:46:37 2022 +