Updated raylib-cpp header files
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
#ifndef RAYLIB_CPP_INCLUDE_BOUNDINGBOX_HPP_
|
||||
#define RAYLIB_CPP_INCLUDE_BOUNDINGBOX_HPP_
|
||||
|
||||
#include "./raylib.hpp"
|
||||
#include "./raylib-cpp-utils.hpp"
|
||||
#include "./raylib.hpp"
|
||||
|
||||
namespace raylib {
|
||||
/**
|
||||
* Bounding box type
|
||||
*/
|
||||
class BoundingBox : public ::BoundingBox {
|
||||
public:
|
||||
public:
|
||||
/*
|
||||
* Copy a bounding box from another bounding box.
|
||||
*/
|
||||
@@ -20,9 +20,7 @@ class BoundingBox : public ::BoundingBox {
|
||||
/**
|
||||
* Compute mesh bounding box limits
|
||||
*/
|
||||
BoundingBox(const ::Mesh& mesh) {
|
||||
set(::GetMeshBoundingBox(mesh));
|
||||
}
|
||||
BoundingBox(const ::Mesh& mesh) { set(::GetMeshBoundingBox(mesh)); }
|
||||
|
||||
BoundingBox(::Vector3 minMax = ::Vector3{0.0f, 0.0f, 0.0f}) : ::BoundingBox{minMax, minMax} {}
|
||||
BoundingBox(::Vector3 min, ::Vector3 max) : ::BoundingBox{min, max} {}
|
||||
@@ -38,39 +36,28 @@ class BoundingBox : public ::BoundingBox {
|
||||
/**
|
||||
* Draw a bounding box with wires
|
||||
*/
|
||||
inline void Draw(::Color color = {255, 255, 255, 255}) const {
|
||||
::DrawBoundingBox(*this, color);
|
||||
}
|
||||
void Draw(::Color color = {255, 255, 255, 255}) const { ::DrawBoundingBox(*this, color); }
|
||||
|
||||
/**
|
||||
* Detect collision between two boxes
|
||||
*/
|
||||
inline bool CheckCollision(const ::BoundingBox& box2) const {
|
||||
return CheckCollisionBoxes(*this, box2);
|
||||
}
|
||||
[[nodiscard]] bool CheckCollision(const ::BoundingBox& box2) const { return CheckCollisionBoxes(*this, box2); }
|
||||
|
||||
/**
|
||||
* Detect collision between box and sphere
|
||||
*/
|
||||
inline bool CheckCollision(::Vector3 center, float radius) const {
|
||||
return CheckCollisionBoxSphere(*this, center, radius);
|
||||
}
|
||||
[[nodiscard]] bool CheckCollision(::Vector3 center, float radius) const { return CheckCollisionBoxSphere(*this, center, radius); }
|
||||
|
||||
/**
|
||||
* Detect collision between ray and bounding box
|
||||
*/
|
||||
inline bool CheckCollision(const ::Ray& ray) const {
|
||||
return GetRayCollisionBox(ray, *this).hit;
|
||||
}
|
||||
[[nodiscard]] bool CheckCollision(const ::Ray& ray) const { return GetRayCollisionBox(ray, *this).hit; }
|
||||
|
||||
/**
|
||||
* Get collision information between ray and bounding box
|
||||
*/
|
||||
inline RayCollision GetCollision(const ::Ray& ray) const {
|
||||
return GetRayCollisionBox(ray, *this);
|
||||
}
|
||||
|
||||
protected:
|
||||
RayCollision GetCollision(const ::Ray& ray) const { return GetRayCollisionBox(ray, *this); }
|
||||
protected:
|
||||
void set(const ::BoundingBox& box) {
|
||||
min = box.min;
|
||||
max = box.max;
|
||||
@@ -80,8 +67,8 @@ class BoundingBox : public ::BoundingBox {
|
||||
max = _max;
|
||||
}
|
||||
};
|
||||
} // namespace raylib
|
||||
} // namespace raylib
|
||||
|
||||
using RBoundingBox = raylib::BoundingBox;
|
||||
|
||||
#endif // RAYLIB_CPP_INCLUDE_BOUNDINGBOX_HPP_
|
||||
#endif // RAYLIB_CPP_INCLUDE_BOUNDINGBOX_HPP_
|
||||
|
Reference in New Issue
Block a user