aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/CollisionSystem.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/system/CollisionSystem.h')
-rw-r--r--src/crepe/system/CollisionSystem.h40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/crepe/system/CollisionSystem.h b/src/crepe/system/CollisionSystem.h
index 3fb9723..ff2d35f 100644
--- a/src/crepe/system/CollisionSystem.h
+++ b/src/crepe/system/CollisionSystem.h
@@ -60,8 +60,8 @@ public:
private:
//! A variant type that can hold either a BoxCollider or a CircleCollider.
- using collider_variant = std::variant<std::reference_wrapper<BoxCollider>,
- std::reference_wrapper<CircleCollider>>;
+ using collider_variant = std::variant<
+ std::reference_wrapper<BoxCollider>, std::reference_wrapper<CircleCollider>>;
//! Enum representing the types of collider pairs for collision detection.
enum class CollisionInternalType {
@@ -114,8 +114,9 @@ private:
* \param collider2 Second collider variant (BoxCollider or CircleCollider).
* \return The combined type of the two colliders.
*/
- CollisionInternalType get_collider_type(const collider_variant & collider1,
- const collider_variant & collider2) const;
+ CollisionInternalType get_collider_type(
+ const collider_variant & collider1, const collider_variant & collider2
+ ) const;
private:
/**
@@ -128,8 +129,8 @@ private:
* \param data1 Collision data for the first collider.
* \param data2 Collision data for the second collider.
*/
- CollisionInfo get_collision_info(const CollisionInternal & data1,
- const CollisionInternal & data2) const;
+ CollisionInfo
+ get_collision_info(const CollisionInternal & data1, const CollisionInternal & data2) const;
/**
* \brief Corrects the collision resolution vector and determines its direction.
@@ -221,8 +222,10 @@ private:
* \param other_metadata Rigidbody of second object
* \return Returns true if there is at least one comparison found.
*/
- bool should_collide(const CollisionInternal & self,
- const CollisionInternal & other) const; //done
+ bool should_collide(
+ const CollisionInternal & self,
+ const CollisionInternal & other
+ ) const; //done
/**
* \brief Checks for collision between two colliders.
@@ -236,8 +239,10 @@ private:
* \param type The type of collider pair.
* \return True if a collision is detected, otherwise false.
*/
- bool detect_collision(CollisionInternal & first_info, CollisionInternal & second_info,
- const CollisionInternalType & type);
+ bool detect_collision(
+ CollisionInternal & first_info, CollisionInternal & second_info,
+ const CollisionInternalType & type
+ );
/**
* \brief Detects collisions between two BoxColliders.
@@ -250,8 +255,9 @@ private:
* \param box2 Information about the second BoxCollider.
* \return If colliding, returns the resolution vector; otherwise, returns {NaN, NaN}.
*/
- vec2 get_box_box_detection(const BoxColliderInternal & box1,
- const BoxColliderInternal & box2) const;
+ vec2 get_box_box_detection(
+ const BoxColliderInternal & box1, const BoxColliderInternal & box2
+ ) const;
/**
* \brief Check collision for box on circle collider
@@ -264,8 +270,9 @@ private:
* \param circle2 Information about the circleCollider.
* \return If colliding, returns the resolution vector; otherwise, returns {NaN, NaN}.
*/
- vec2 get_box_circle_detection(const BoxColliderInternal & box1,
- const CircleColliderInternal & circle2) const;
+ vec2 get_box_circle_detection(
+ const BoxColliderInternal & box1, const CircleColliderInternal & circle2
+ ) const;
/**
* \brief Check collision for circle on circle collider
@@ -278,8 +285,9 @@ private:
* \param circle2 Information about the second circleCollider.
* \return If colliding, returns the resolution vector; otherwise, returns {NaN, NaN}.
*/
- vec2 get_circle_circle_detection(const CircleColliderInternal & circle1,
- const CircleColliderInternal & circle2) const;
+ vec2 get_circle_circle_detection(
+ const CircleColliderInternal & circle1, const CircleColliderInternal & circle2
+ ) const;
};
/**