Fix previous commit crash

This commit is contained in:
Lynix 2018-07-07 14:35:11 +02:00
parent cb6885d6a9
commit 6390da95d3
3 changed files with 18 additions and 14 deletions

View File

@ -40,7 +40,7 @@ namespace Ndk
m_volumeCullingEntries.emplace_back();
VolumeCullingEntry& entry = m_volumeCullingEntries.back();
entry.cullingListReleaseSlot.Connect(cullingList->OnCullingListRelease, this, &GraphicsComponent::RemoveFromCullingList);
cullingList->RegisterVolumeTest(this, &entry.listEntry);
entry.listEntry = cullingList->RegisterVolumeTest(this);
InvalidateBoundingVolume();
}

View File

@ -41,9 +41,9 @@ namespace Nz
std::size_t Cull(const Frustumf& frustum, bool* forceInvalidation = nullptr);
void RegisterNoTest(const T* renderable, NoTestEntry* entry);
void RegisterSphereTest(const T* renderable, SphereEntry* entry);
void RegisterVolumeTest(const T* renderable, VolumeEntry* entry);
NoTestEntry RegisterNoTest(const T* renderable);
SphereEntry RegisterSphereTest(const T* renderable);
VolumeEntry RegisterVolumeTest(const T* renderable);
CullingList& operator=(const CullingList& renderable) = delete;
CullingList& operator=(CullingList&& renderable) = delete;

View File

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