From 2209b5c5e036bf278805fb060ae29b548c827aaa Mon Sep 17 00:00:00 2001 From: TokyoSU <77746747+TokyoSU@users.noreply.github.com> Date: Tue, 5 Jul 2022 17:45:04 +0200 Subject: [PATCH] Added default constructor for BoundingBox - Also updated it to have set() with vector3. --- include/BoundingBox.hpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/include/BoundingBox.hpp b/include/BoundingBox.hpp index 52dc3ef..9759e71 100644 --- a/include/BoundingBox.hpp +++ b/include/BoundingBox.hpp @@ -9,7 +9,17 @@ namespace raylib { * Bounding box type */ class BoundingBox : public ::BoundingBox { - public: +public: + /* + * Set the bounding box to default: min (0, 0, 0) and max (0, 0, 0). + */ + BoundingBox() { + set(RVector3(0, 0, 0), RVector3(0, 0, 0)); + } + + /* + * Copy a bounding box from another bounding box. + */ BoundingBox(const ::BoundingBox& box) { set(box); } @@ -68,11 +78,15 @@ class BoundingBox : public ::BoundingBox { return GetRayCollisionBox(ray, *this); } - private: +private: void set(const ::BoundingBox& box) { min = box.min; max = box.max; } + void set(const Vector3& _min, const Vector3& _max) { + min = _min; + max = _max; + } }; } // namespace raylib using RBoundingBox = raylib::BoundingBox;