1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Fix situation around aabbox3d default constructor (#15586)

Co-authored-by: JosiahWI <41302989+JosiahWI@users.noreply.github.com>
This commit is contained in:
sfan5 2024-12-29 14:36:30 +01:00 committed by GitHub
parent cca65fde08
commit f2b1cc3e61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 67 additions and 53 deletions

View file

@ -619,15 +619,22 @@ const core::aabbox3df &ParticleBuffer::getBoundingBox() const
if (!m_bounding_box_dirty)
return m_mesh_buffer->BoundingBox;
core::aabbox3df box;
core::aabbox3df box{{0, 0, 0}};
bool first = true;
for (u16 i = 0; i < m_count; i++) {
// check if this index is used
static_assert(quad_indices[1] != 0);
if (m_mesh_buffer->getIndices()[6 * i + 1] == 0)
continue;
for (u16 j = 0; j < 4; j++)
box.addInternalPoint(m_mesh_buffer->getPosition(i * 4 + j));
for (u16 j = 0; j < 4; j++) {
const auto pos = m_mesh_buffer->getPosition(i * 4 + j);
if (first)
box.reset(pos);
else
box.addInternalPoint(pos);
first = false;
}
}
m_mesh_buffer->BoundingBox = box;