diff --git a/ChangeLog.md b/ChangeLog.md index 167062f6c..6ec9c8c54 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -124,6 +124,7 @@ Nazara Engine: - Added StackVector class - ⚠️ Removed Vector[2|3]::Distancef method and made Distance method templated - Added Vector2::Distance static method +- ⚠️ Fixed compilation error on MSVC with flag /permissive- on CullingList class Nazara Development Kit: - Added ImageWidget (#139) diff --git a/SDK/include/NDK/Components/GraphicsComponent.inl b/SDK/include/NDK/Components/GraphicsComponent.inl index 69be82ba0..8ddd3e223 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.inl +++ b/SDK/include/NDK/Components/GraphicsComponent.inl @@ -37,10 +37,10 @@ namespace Ndk inline void GraphicsComponent::AddToCullingList(GraphicsComponentCullingList* cullingList) const { - m_volumeCullingEntries.emplace_back(VolumeCullingEntry{}); + m_volumeCullingEntries.emplace_back(); VolumeCullingEntry& entry = m_volumeCullingEntries.back(); entry.cullingListReleaseSlot.Connect(cullingList->OnCullingListRelease, this, &GraphicsComponent::RemoveFromCullingList); - entry.listEntry = cullingList->RegisterVolumeTest(this); + cullingList->RegisterVolumeTest(this, &entry.listEntry); InvalidateBoundingVolume(); } diff --git a/include/Nazara/Graphics/CullingList.hpp b/include/Nazara/Graphics/CullingList.hpp index 7232e9cdb..85b4ce2f9 100644 --- a/include/Nazara/Graphics/CullingList.hpp +++ b/include/Nazara/Graphics/CullingList.hpp @@ -41,9 +41,9 @@ namespace Nz std::size_t Cull(const Frustumf& frustum, bool* forceInvalidation = nullptr); - NoTestEntry RegisterNoTest(const T* renderable); - SphereEntry RegisterSphereTest(const T* renderable); - VolumeEntry RegisterVolumeTest(const T* renderable); + void RegisterNoTest(const T* renderable, NoTestEntry* entry); + void RegisterSphereTest(const T* renderable, SphereEntry* entry); + void RegisterVolumeTest(const T* renderable, VolumeEntry* entry); CullingList& operator=(const CullingList& renderable) = delete; CullingList& operator=(CullingList&& renderable) = delete; @@ -135,41 +135,53 @@ namespace Nz }; template - class CullingList::NoTestEntry : public CullingList::template Entry + class CullingList::NoTestEntry : public CullingList::template Entry { friend CullingList; public: NoTestEntry(); + NoTestEntry(NoTestEntry&&) = default; + ~NoTestEntry() = default; + + NoTestEntry& operator=(NoTestEntry&&) = default; private: NoTestEntry(CullingList* parent, std::size_t index); }; template - class CullingList::SphereEntry : public CullingList::template Entry + class CullingList::SphereEntry : public CullingList::template Entry { friend CullingList; public: SphereEntry(); + SphereEntry(SphereEntry&&) = default; + ~SphereEntry() = default; void UpdateSphere(const Spheref& sphere); + SphereEntry& operator=(SphereEntry&&) = default; + private: SphereEntry(CullingList* parent, std::size_t index); }; template - class CullingList::VolumeEntry : public CullingList::template Entry + class CullingList::VolumeEntry : public CullingList::template Entry { friend CullingList; public: VolumeEntry(); + VolumeEntry(VolumeEntry&&) = default; + ~VolumeEntry() = default; void UpdateVolume(const BoundingVolumef& sphere); + VolumeEntry& operator=(VolumeEntry&&) = default; + private: VolumeEntry(CullingList* parent, std::size_t index); }; diff --git a/include/Nazara/Graphics/CullingList.inl b/include/Nazara/Graphics/CullingList.inl index 238468b47..71cb57fe3 100644 --- a/include/Nazara/Graphics/CullingList.inl +++ b/include/Nazara/Graphics/CullingList.inl @@ -71,30 +71,26 @@ namespace Nz } template - typename CullingList::NoTestEntry CullingList::RegisterNoTest(const T* renderable) + void CullingList::RegisterNoTest(const T* renderable, NoTestEntry* entry) { - NoTestEntry entry(this, m_noTestList.size()); - m_noTestList.emplace_back(NoTestVisibilityEntry{&entry, renderable, false}); //< Address of entry will be updated when moving + *entry = NoTestEntry(this, m_noTestList.size()); + m_noTestList.emplace_back(NoTestVisibilityEntry{entry, renderable, false}); //< Address of entry will be updated when moving + } + + template + void CullingList::RegisterSphereTest(const T* renderable, SphereEntry* entry) + { + *entry = SphereEntry(this, m_sphereTestList.size()); + m_sphereTestList.emplace_back(SphereVisibilityEntry{Nz::Spheref(), entry, renderable, false}); //< Address of entry will be updated when moving return entry; } template - typename CullingList::SphereEntry CullingList::RegisterSphereTest(const T* renderable) + void CullingList::RegisterVolumeTest(const T* renderable, VolumeEntry* entry) { - SphereEntry entry(this, m_sphereTestList.size()); - m_sphereTestList.emplace_back(SphereVisibilityEntry{Nz::Spheref(), &entry, renderable, false}); //< Address of entry will be updated when moving - - return entry; - } - - template - typename CullingList::VolumeEntry CullingList::RegisterVolumeTest(const T* renderable) - { - VolumeEntry entry(this, m_volumeTestList.size()); - m_volumeTestList.emplace_back(VolumeVisibilityEntry{Nz::BoundingVolumef(), &entry, renderable, false}); //< Address of entry will be updated when moving - - return entry; + *entry = VolumeEntry(this, m_volumeTestList.size()); + m_volumeTestList.emplace_back(VolumeVisibilityEntry{Nz::BoundingVolumef(), entry, renderable, false}); //< Address of entry will be updated when moving } // Interface STD