Graphics/CullingList: Fix compilation errors on MSVC with /permissive-

This commit is contained in:
Jérôme Leclercq 2018-07-06 15:24:30 +02:00
parent aafb79f06c
commit cb6885d6a9
4 changed files with 34 additions and 25 deletions

View File

@ -124,6 +124,7 @@ Nazara Engine:
- Added StackVector class - Added StackVector class
- ⚠️ Removed Vector[2|3]::Distancef method and made Distance method templated - ⚠️ Removed Vector[2|3]::Distancef method and made Distance method templated
- Added Vector2::Distance static method - Added Vector2::Distance static method
- ⚠️ Fixed compilation error on MSVC with flag /permissive- on CullingList class
Nazara Development Kit: Nazara Development Kit:
- Added ImageWidget (#139) - Added ImageWidget (#139)

View File

@ -37,10 +37,10 @@ namespace Ndk
inline void GraphicsComponent::AddToCullingList(GraphicsComponentCullingList* cullingList) const inline void GraphicsComponent::AddToCullingList(GraphicsComponentCullingList* cullingList) const
{ {
m_volumeCullingEntries.emplace_back(VolumeCullingEntry{}); m_volumeCullingEntries.emplace_back();
VolumeCullingEntry& entry = m_volumeCullingEntries.back(); VolumeCullingEntry& entry = m_volumeCullingEntries.back();
entry.cullingListReleaseSlot.Connect(cullingList->OnCullingListRelease, this, &GraphicsComponent::RemoveFromCullingList); entry.cullingListReleaseSlot.Connect(cullingList->OnCullingListRelease, this, &GraphicsComponent::RemoveFromCullingList);
entry.listEntry = cullingList->RegisterVolumeTest(this); cullingList->RegisterVolumeTest(this, &entry.listEntry);
InvalidateBoundingVolume(); InvalidateBoundingVolume();
} }

View File

@ -41,9 +41,9 @@ namespace Nz
std::size_t Cull(const Frustumf& frustum, bool* forceInvalidation = nullptr); std::size_t Cull(const Frustumf& frustum, bool* forceInvalidation = nullptr);
NoTestEntry RegisterNoTest(const T* renderable); void RegisterNoTest(const T* renderable, NoTestEntry* entry);
SphereEntry RegisterSphereTest(const T* renderable); void RegisterSphereTest(const T* renderable, SphereEntry* entry);
VolumeEntry RegisterVolumeTest(const T* renderable); void RegisterVolumeTest(const T* renderable, VolumeEntry* entry);
CullingList& operator=(const CullingList& renderable) = delete; CullingList& operator=(const CullingList& renderable) = delete;
CullingList& operator=(CullingList&& renderable) = delete; CullingList& operator=(CullingList&& renderable) = delete;
@ -135,41 +135,53 @@ namespace Nz
}; };
template<typename T> template<typename T>
class CullingList<T>::NoTestEntry : public CullingList::template Entry<CullTest::NoTest> class CullingList<T>::NoTestEntry : public CullingList<T>::template Entry<CullTest::NoTest>
{ {
friend CullingList; friend CullingList;
public: public:
NoTestEntry(); NoTestEntry();
NoTestEntry(NoTestEntry&&) = default;
~NoTestEntry() = default;
NoTestEntry& operator=(NoTestEntry&&) = default;
private: private:
NoTestEntry(CullingList* parent, std::size_t index); NoTestEntry(CullingList* parent, std::size_t index);
}; };
template<typename T> template<typename T>
class CullingList<T>::SphereEntry : public CullingList::template Entry<CullTest::Sphere> class CullingList<T>::SphereEntry : public CullingList<T>::template Entry<CullTest::Sphere>
{ {
friend CullingList; friend CullingList;
public: public:
SphereEntry(); SphereEntry();
SphereEntry(SphereEntry&&) = default;
~SphereEntry() = default;
void UpdateSphere(const Spheref& sphere); void UpdateSphere(const Spheref& sphere);
SphereEntry& operator=(SphereEntry&&) = default;
private: private:
SphereEntry(CullingList* parent, std::size_t index); SphereEntry(CullingList* parent, std::size_t index);
}; };
template<typename T> template<typename T>
class CullingList<T>::VolumeEntry : public CullingList::template Entry<CullTest::Volume> class CullingList<T>::VolumeEntry : public CullingList<T>::template Entry<CullTest::Volume>
{ {
friend CullingList; friend CullingList;
public: public:
VolumeEntry(); VolumeEntry();
VolumeEntry(VolumeEntry&&) = default;
~VolumeEntry() = default;
void UpdateVolume(const BoundingVolumef& sphere); void UpdateVolume(const BoundingVolumef& sphere);
VolumeEntry& operator=(VolumeEntry&&) = default;
private: private:
VolumeEntry(CullingList* parent, std::size_t index); VolumeEntry(CullingList* parent, std::size_t index);
}; };

View File

@ -71,30 +71,26 @@ namespace Nz
} }
template<typename T> template<typename T>
typename CullingList<T>::NoTestEntry CullingList<T>::RegisterNoTest(const T* renderable) void CullingList<T>::RegisterNoTest(const T* renderable, NoTestEntry* entry)
{ {
NoTestEntry entry(this, m_noTestList.size()); *entry = NoTestEntry(this, m_noTestList.size());
m_noTestList.emplace_back(NoTestVisibilityEntry{&entry, renderable, false}); //< Address of entry will be updated when moving m_noTestList.emplace_back(NoTestVisibilityEntry{entry, renderable, false}); //< Address of entry will be updated when moving
}
template<typename T>
void CullingList<T>::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; return entry;
} }
template<typename T> template<typename T>
typename CullingList<T>::SphereEntry CullingList<T>::RegisterSphereTest(const T* renderable) void CullingList<T>::RegisterVolumeTest(const T* renderable, VolumeEntry* entry)
{ {
SphereEntry entry(this, m_sphereTestList.size()); *entry = VolumeEntry(this, m_volumeTestList.size());
m_sphereTestList.emplace_back(SphereVisibilityEntry{Nz::Spheref(), &entry, renderable, false}); //< Address of entry will be updated when moving m_volumeTestList.emplace_back(VolumeVisibilityEntry{Nz::BoundingVolumef(), entry, renderable, false}); //< Address of entry will be updated when moving
return entry;
}
template<typename T>
typename CullingList<T>::VolumeEntry CullingList<T>::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;
} }
// Interface STD // Interface STD