mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-05 19:31: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:
parent
cca65fde08
commit
f2b1cc3e61
34 changed files with 67 additions and 53 deletions
|
@ -101,7 +101,7 @@ std::vector<DistanceSortedActiveObject> ActiveObjectMgr::getActiveSelectableObje
|
|||
if (!obj)
|
||||
continue;
|
||||
|
||||
aabb3f selection_box;
|
||||
aabb3f selection_box{{0.0f, 0.0f, 0.0f}};
|
||||
if (!obj->getSelectionBox(&selection_box))
|
||||
continue;
|
||||
|
||||
|
|
|
@ -430,7 +430,7 @@ void ClientEnvironment::getSelectedActiveObjects(
|
|||
|
||||
for (const auto &allObject : allObjects) {
|
||||
ClientActiveObject *obj = allObject.obj;
|
||||
aabb3f selection_box;
|
||||
aabb3f selection_box{{0.0f, 0.0f, 0.0f}};
|
||||
if (!obj->getSelectionBox(&selection_box))
|
||||
continue;
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ private:
|
|||
// Was the mesh ever generated?
|
||||
bool m_mesh_valid = false;
|
||||
|
||||
aabb3f m_box;
|
||||
aabb3f m_box{{0.0f, 0.0f, 0.0f}};
|
||||
v2f m_origin;
|
||||
u16 m_cloud_radius_i;
|
||||
u32 m_seed;
|
||||
|
|
|
@ -3200,7 +3200,7 @@ PointedThing Game::updatePointedThing(
|
|||
hud->pointing_at_object = true;
|
||||
|
||||
runData.selected_object = client->getEnv().getActiveObject(result.object_id);
|
||||
aabb3f selection_box;
|
||||
aabb3f selection_box{{0.0f, 0.0f, 0.0f}};
|
||||
if (show_entity_selectionbox && runData.selected_object->doShowSelectionBox() &&
|
||||
runData.selected_object->getSelectionBox(&selection_box)) {
|
||||
v3f pos = runData.selected_object->getPosition();
|
||||
|
|
|
@ -75,10 +75,8 @@ static aabb3f getNodeBoundingBox(const std::vector<aabb3f> &nodeboxes)
|
|||
if (nodeboxes.empty())
|
||||
return aabb3f(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
aabb3f b_max;
|
||||
|
||||
std::vector<aabb3f>::const_iterator it = nodeboxes.begin();
|
||||
b_max = aabb3f(it->MinEdge, it->MaxEdge);
|
||||
auto it = nodeboxes.begin();
|
||||
aabb3f b_max(it->MinEdge, it->MaxEdge);
|
||||
|
||||
++it;
|
||||
for (; it != nodeboxes.end(); ++it)
|
||||
|
|
|
@ -105,8 +105,7 @@ void scaleMesh(scene::IMesh *mesh, v3f scale)
|
|||
if (mesh == NULL)
|
||||
return;
|
||||
|
||||
aabb3f bbox;
|
||||
bbox.reset(0, 0, 0);
|
||||
aabb3f bbox{{0.0f, 0.0f, 0.0f}};
|
||||
|
||||
u32 mc = mesh->getMeshBufferCount();
|
||||
for (u32 j = 0; j < mc; j++) {
|
||||
|
@ -134,8 +133,7 @@ void translateMesh(scene::IMesh *mesh, v3f vec)
|
|||
if (mesh == NULL)
|
||||
return;
|
||||
|
||||
aabb3f bbox;
|
||||
bbox.reset(0, 0, 0);
|
||||
aabb3f bbox{{0.0f, 0.0f, 0.0f}};
|
||||
|
||||
u32 mc = mesh->getMeshBufferCount();
|
||||
for (u32 j = 0; j < mc; j++) {
|
||||
|
@ -296,8 +294,7 @@ void rotateMeshBy6dFacedir(scene::IMesh *mesh, u8 facedir)
|
|||
|
||||
void recalculateBoundingBox(scene::IMesh *src_mesh)
|
||||
{
|
||||
aabb3f bbox;
|
||||
bbox.reset(0,0,0);
|
||||
aabb3f bbox{{0.0f, 0.0f, 0.0f}};
|
||||
for (u16 j = 0; j < src_mesh->getMeshBufferCount(); j++) {
|
||||
scene::IMeshBuffer *buf = src_mesh->getMeshBuffer(j);
|
||||
buf->recalculateBoundingBox();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -50,8 +50,6 @@ Sky::Sky(s32 id, RenderingEngine *rendering_engine, ITextureSource *tsrc, IShade
|
|||
m_seed = (u64)myrand() << 32 | myrand();
|
||||
|
||||
setAutomaticCulling(scene::EAC_OFF);
|
||||
m_box.MaxEdge.set(0, 0, 0);
|
||||
m_box.MinEdge.set(0, 0, 0);
|
||||
|
||||
m_sky_params = SkyboxDefaults::getSkyDefaults();
|
||||
m_sun_params = SkyboxDefaults::getSunDefaults();
|
||||
|
|
|
@ -122,7 +122,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
aabb3f m_box;
|
||||
aabb3f m_box{{0.0f, 0.0f, 0.0f}};
|
||||
video::SMaterial m_materials[SKY_MATERIAL_COUNT];
|
||||
// How much sun & moon transition should affect horizon color
|
||||
float m_horizon_blend()
|
||||
|
|
|
@ -195,8 +195,7 @@ WieldMeshSceneNode::WieldMeshSceneNode(scene::ISceneManager *mgr, s32 id):
|
|||
else
|
||||
g_extrusion_mesh_cache->grab();
|
||||
|
||||
// Disable bounding box culling for this scene node
|
||||
// since we won't calculate the bounding box.
|
||||
// This class doesn't render anything, so disable culling.
|
||||
setAutomaticCulling(scene::EAC_OFF);
|
||||
|
||||
// Create the child scene node
|
||||
|
|
|
@ -134,7 +134,7 @@ private:
|
|||
// Bounding box culling is disabled for this type of scene node,
|
||||
// so this variable is just required so we can implement
|
||||
// getBoundingBox() and is set to an empty box.
|
||||
aabb3f m_bounding_box;
|
||||
aabb3f m_bounding_box{{0, 0, 0}};
|
||||
|
||||
ShadowRenderer *m_shadow;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue