diff --git a/modules/scene/include/vkcv/scene/MeshPart.hpp b/modules/scene/include/vkcv/scene/MeshPart.hpp index 027c6f2016ce3b8e0437afda54218a1d72d21712..0d3467c6b57fcece69eb6f0c609c604fb99907d2 100644 --- a/modules/scene/include/vkcv/scene/MeshPart.hpp +++ b/modules/scene/include/vkcv/scene/MeshPart.hpp @@ -34,8 +34,8 @@ namespace vkcv::scene { public: ~MeshPart(); - MeshPart(const MeshPart& other) = default; - MeshPart(MeshPart&& other) = default; + MeshPart(const MeshPart& other); + MeshPart(MeshPart&& other); MeshPart& operator=(const MeshPart& other); MeshPart& operator=(MeshPart&& other) noexcept; diff --git a/modules/scene/src/vkcv/scene/MeshPart.cpp b/modules/scene/src/vkcv/scene/MeshPart.cpp index 4bed429a8a417f38e98de3dec757cd6804486b2f..46e79897719d5422151ec31837a41f7e58324a71 100644 --- a/modules/scene/src/vkcv/scene/MeshPart.cpp +++ b/modules/scene/src/vkcv/scene/MeshPart.cpp @@ -83,6 +83,28 @@ namespace vkcv::scene { m_scene.decreaseMaterialUsage(m_materialIndex); } + MeshPart::MeshPart(const MeshPart &other) : + m_scene(other.m_scene), + m_vertices(other.m_vertices), + m_vertexBindings(other.m_vertexBindings), + m_indices(other.m_indices), + m_indexCount(other.m_indexCount), + m_bounds(other.m_bounds), + m_materialIndex(other.m_materialIndex) { + m_scene.increaseMaterialUsage(m_materialIndex); + } + + MeshPart::MeshPart(MeshPart &&other) : + m_scene(other.m_scene), + m_vertices(other.m_vertices), + m_vertexBindings(other.m_vertexBindings), + m_indices(other.m_indices), + m_indexCount(other.m_indexCount), + m_bounds(other.m_bounds), + m_materialIndex(other.m_materialIndex) { + m_scene.increaseMaterialUsage(m_materialIndex); + } + MeshPart &MeshPart::operator=(const MeshPart &other) { if (&other == this) { return *this; @@ -106,8 +128,6 @@ namespace vkcv::scene { m_bounds = other.m_bounds; m_materialIndex = other.m_materialIndex; - other.m_materialIndex = std::numeric_limits<size_t>::max(); - return *this; }