1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +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

@ -134,7 +134,7 @@ public:
//! Index buffer
SIndexBuffer *Indices;
//! Bounding box of this meshbuffer.
core::aabbox3d<f32> BoundingBox;
core::aabbox3d<f32> BoundingBox{{0, 0, 0}};
//! Primitive type used for rendering (triangles, lines, ...)
E_PRIMITIVE_TYPE PrimitiveType;
};

View file

@ -108,7 +108,7 @@ public:
if (!mesh)
return true;
bool result = true;
core::aabbox3df bufferbox;
core::aabbox3df bufferbox{{0, 0, 0}};
for (u32 i = 0; i < mesh->getMeshBufferCount(); ++i) {
result &= apply(func, mesh->getMeshBuffer(i), boundingBoxUpdate);
if (boundingBoxUpdate) {
@ -136,7 +136,7 @@ protected:
if (!buffer)
return true;
core::aabbox3df bufferbox;
core::aabbox3df bufferbox{{0, 0, 0}};
for (u32 i = 0; i < buffer->getVertexCount(); ++i) {
switch (buffer->getVertexType()) {
case video::EVT_STANDARD: {

View file

@ -154,7 +154,7 @@ struct SAnimatedMesh final : public IAnimatedMesh
std::vector<IMesh *> Meshes;
//! The bounding box of this mesh
core::aabbox3d<f32> Box;
core::aabbox3d<f32> Box{{0.0f, 0.0f, 0.0f}};
//! Default animation speed of this mesh.
f32 FramesPerSecond;

View file

@ -133,7 +133,7 @@ struct SMesh final : public IMesh
std::vector<u32> TextureSlots;
//! The bounding box of this mesh
core::aabbox3d<f32> BoundingBox;
core::aabbox3d<f32> BoundingBox{{0, 0, 0}};
};
} // end namespace scene

View file

@ -228,7 +228,7 @@ public:
video::SMaterial Material;
video::E_VERTEX_TYPE VertexType;
core::aabbox3d<f32> BoundingBox;
core::aabbox3d<f32> BoundingBox{{0, 0, 0}};
//! Primitive type used for rendering (triangles, lines, ...)
E_PRIMITIVE_TYPE PrimitiveType;

View file

@ -117,7 +117,7 @@ struct SViewFrustum
core::plane3d<f32> planes[VF_PLANE_COUNT];
//! bounding box around the view frustum
core::aabbox3d<f32> boundingBox;
core::aabbox3d<f32> boundingBox{{0, 0, 0}};
private:
//! Hold a copy of important transform matrices

View file

@ -137,7 +137,7 @@ public:
//! Moves the mesh into static position.
void resetAnimation();
virtual void updateBoundingBox();
void updateBoundingBox();
//! Recovers the joints from the mesh
void recoverJointsFromMesh(std::vector<IBoneSceneNode *> &jointChildSceneNodes);
@ -370,7 +370,7 @@ protected:
// doesn't allow taking a reference to individual elements.
std::vector<std::vector<char>> Vertices_Moved;
core::aabbox3d<f32> BoundingBox;
core::aabbox3d<f32> BoundingBox{{0, 0, 0}};
f32 EndFrame;
f32 FramesPerSecond;

View file

@ -20,9 +20,7 @@ template <class T>
class aabbox3d
{
public:
//! Default Constructor.
constexpr aabbox3d() :
MinEdge(-1, -1, -1), MaxEdge(1, 1, 1) {}
constexpr aabbox3d() = delete;
//! Constructor with min edge and max edge.
constexpr aabbox3d(const vector3d<T> &min, const vector3d<T> &max) :
MinEdge(min), MaxEdge(max) {}

View file

@ -145,7 +145,7 @@ private:
void beginTransition();
core::array<video::SMaterial> Materials;
core::aabbox3d<f32> Box;
core::aabbox3d<f32> Box{{0.0f, 0.0f, 0.0f}};
IAnimatedMesh *Mesh;
f32 StartFrame;

View file

@ -104,7 +104,7 @@ private:
/** Note that we can't use the real boundingbox for culling because at that point
the camera which is used to calculate the billboard is not yet updated. So we only
know the real boundingbox after rendering - which is too late for culling. */
core::aabbox3d<f32> BBoxSafe;
core::aabbox3d<f32> BBoxSafe{{0.0f, 0.0f, 0.0f}};
scene::SMeshBuffer *Buffer;
};

View file

@ -60,7 +60,7 @@ private:
u32 BoneIndex;
core::aabbox3d<f32> Box;
core::aabbox3d<f32> Box{-1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f};
E_BONE_ANIMATION_MODE AnimationMode;
E_BONE_SKINNING_SPACE SkinningSpace;

View file

@ -48,7 +48,7 @@ private:
void setPosition(const core::vector3df &newpos) override;
core::matrix4 RelativeTransformationMatrix;
core::aabbox3d<f32> Box;
core::aabbox3d<f32> Box{{0, 0, 0}};
};
} // end namespace scene

View file

@ -33,7 +33,7 @@ public:
ISceneNode *clone(ISceneNode *newParent = 0, ISceneManager *newManager = 0) override;
private:
core::aabbox3d<f32> Box;
core::aabbox3d<f32> Box{{0, 0, 0}};
};
} // end namespace scene

View file

@ -72,7 +72,7 @@ protected:
void copyMaterials();
core::array<video::SMaterial> Materials;
core::aabbox3d<f32> Box;
core::aabbox3d<f32> Box{{0, 0, 0}};
video::SMaterial ReadOnlyMaterial;
IMesh *Mesh;

View file

@ -307,7 +307,7 @@ const core::aabbox3d<f32> &CSceneManager::getBoundingBox() const
{
_IRR_DEBUG_BREAK_IF(true) // Bounding Box of Scene Manager should never be used.
static const core::aabbox3d<f32> dummy;
static const core::aabbox3d<f32> dummy{{0.0f, 0.0f, 0.0f}};
return dummy;
}

View file

@ -573,7 +573,7 @@ SkinnedMesh *SkinnedMeshBuilder::finalize()
return this;
}
void SkinnedMesh::updateBoundingBox(void)
void SkinnedMesh::updateBoundingBox()
{
if (!SkinningBuffers)
return;