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
- ⚠️ 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)

View File

@ -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();
}

View File

@ -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<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;
public:
NoTestEntry();
NoTestEntry(NoTestEntry&&) = default;
~NoTestEntry() = default;
NoTestEntry& operator=(NoTestEntry&&) = default;
private:
NoTestEntry(CullingList* parent, std::size_t index);
};
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;
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<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;
public:
VolumeEntry();
VolumeEntry(VolumeEntry&&) = default;
~VolumeEntry() = default;
void UpdateVolume(const BoundingVolumef& sphere);
VolumeEntry& operator=(VolumeEntry&&) = default;
private:
VolumeEntry(CullingList* parent, std::size_t index);
};

View File

@ -71,30 +71,26 @@ namespace Nz
}
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());
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<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;
}
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());
m_sphereTestList.emplace_back(SphereVisibilityEntry{Nz::Spheref(), &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;
*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