1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Implement [gs]etBoundingBox via the static pose

This commit is contained in:
Lars Mueller 2025-01-27 16:58:35 +01:00
parent de726bd41e
commit 66e779b87f
2 changed files with 14 additions and 9 deletions

View file

@ -96,15 +96,15 @@ public:
void setTextureSlot(u32 meshbufNr, u32 textureSlot);
//! returns an axis aligned bounding box
//! Returns bounding box of the mesh *in static pose*.
const core::aabbox3d<f32> &getBoundingBox() const override {
// assert(false); // TODO refactor IMesh so that we don't have to implement this
return StaticPartsBoundingBox;
// TODO ideally we shouldn't be forced to implement this
return StaticPoseBox;
}
//! set user axis aligned bounding box
//! Set bounding box of the mesh *in static pose*.
void setBoundingBox(const core::aabbox3df &box) override {
// assert(false); // TODO refactor
StaticPoseBox = box;
}
//! set the hardware mapping hint, for driver
@ -357,6 +357,7 @@ public:
//! Animates joints based on frame input
std::vector<SJoint::VariantTransform> animateMesh(f32 frame);
//! Calculates a bounding box given an animation in the form of global joint transforms.
core::aabbox3df calculateBoundingBox(
const std::vector<core::matrix4> &global_transforms);
@ -398,7 +399,10 @@ protected:
std::vector<std::vector<char>> Vertices_Moved;
//! Bounding box of just the static parts of the mesh
core::aabbox3d<f32> StaticPartsBoundingBox{{0, 0, 0}};
core::aabbox3df StaticPartsBox{{0, 0, 0}};
//! Bounding box of the mesh in static pose
core::aabbox3df StaticPoseBox{{0, 0, 0}};
f32 EndFrame;
f32 FramesPerSecond;