From 858d0da5f221f20718b036410e5a53bd7372bdfe Mon Sep 17 00:00:00 2001 From: S6066 Date: Sun, 17 Jun 2018 18:54:02 +0200 Subject: [PATCH] Fix Sprite & GraphicsComponent copy constructors leaving some members uninitialized (#166) * Fix Sprite copy constructor (corner colors) * Also add change to changelog * [GraphicsComponent] Bugfix: Initialize m_scissorRect in copy ctor * Add change to changelog * Move GraphicsComponent fix change to correct section in Changelog * Use default copy constructor for Sprite --- ChangeLog.md | 2 ++ SDK/include/NDK/Components/GraphicsComponent.inl | 1 + include/Nazara/Graphics/Sprite.hpp | 2 +- include/Nazara/Graphics/Sprite.inl | 15 --------------- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 5eb093e46..1a5abbb6b 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -115,6 +115,7 @@ Nazara Engine: - ⚠️ SocketPoller::Wait now returns the number of socket marked as ready, and takes an additional optional parameter allowing to query the last error. - SocketPoller will now silently ignore "interrupt errors" - Added RigidBody2D::ClosestPointQuery +- Fix Sprite copy constructor not copying corner colors Nazara Development Kit: - Added ImageWidget (#139) @@ -166,6 +167,7 @@ Nazara Development Kit: - Add GraphicsComponent:ForEachRenderable method - Fixed GraphicsComponent reflective material count which was not initialized - Added PhysicsComponent2D::ClosestPointQuery +- Fix GraphicsComponent copy constructor not copying scissor rect # 0.4: diff --git a/SDK/include/NDK/Components/GraphicsComponent.inl b/SDK/include/NDK/Components/GraphicsComponent.inl index adf653351..69be82ba0 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.inl +++ b/SDK/include/NDK/Components/GraphicsComponent.inl @@ -26,6 +26,7 @@ namespace Ndk m_reflectiveMaterialCount(0), m_boundingVolume(graphicsComponent.m_boundingVolume), m_transformMatrix(graphicsComponent.m_transformMatrix), + m_scissorRect(graphicsComponent.m_scissorRect), m_boundingVolumeUpdated(graphicsComponent.m_boundingVolumeUpdated), m_transformMatrixUpdated(graphicsComponent.m_transformMatrixUpdated) { diff --git a/include/Nazara/Graphics/Sprite.hpp b/include/Nazara/Graphics/Sprite.hpp index 6548f461a..587060467 100644 --- a/include/Nazara/Graphics/Sprite.hpp +++ b/include/Nazara/Graphics/Sprite.hpp @@ -29,7 +29,7 @@ namespace Nz inline Sprite(); inline Sprite(MaterialRef material); inline Sprite(Texture* texture); - inline Sprite(const Sprite& sprite); + Sprite(const Sprite&) = default; Sprite(Sprite&&) = delete; ~Sprite() = default; diff --git a/include/Nazara/Graphics/Sprite.inl b/include/Nazara/Graphics/Sprite.inl index a296f5d61..7412793b7 100644 --- a/include/Nazara/Graphics/Sprite.inl +++ b/include/Nazara/Graphics/Sprite.inl @@ -50,21 +50,6 @@ namespace Nz SetTexture(texture, true); } - /*! - * \brief Constructs a Sprite object by assignation - * - * \param sprite Sprite to copy into this - */ - - inline Sprite::Sprite(const Sprite& sprite) : - InstancedRenderable(sprite), - m_color(sprite.m_color), - m_textureCoords(sprite.m_textureCoords), - m_size(sprite.m_size), - m_origin(sprite.m_origin) - { - } - /*! * \brief Gets the color of the sprite *