Add default constructor for SC_SACD_Generic_Box

This commit is contained in:
Stephen Seo 2024-05-01 13:34:40 +09:00
parent ff43e7c4d6
commit 2dcb33f39f
2 changed files with 10 additions and 0 deletions

View file

@ -191,6 +191,12 @@ std::vector<SC_SACD_MinMax> SC_SACD_Get_Box_MinMax(
// Private Helpers END // Private Helpers END
// ============================================================================= // =============================================================================
SC_SACD_Generic_Box SC_SACD_Generic_Box_Default() {
return {
0.0F, 0.0F, 0.0F, 2.0F, 2.0F, 2.0F, SC_SACD_Mat4_Identity(),
};
}
int SC_SACD_AABB_Box_Collision(const SC_SACD_AABB_Box *a, int SC_SACD_AABB_Box_Collision(const SC_SACD_AABB_Box *a,
const SC_SACD_AABB_Box *b) { const SC_SACD_AABB_Box *b) {
float ax_min = a->x - a->width / 2.0F; float ax_min = a->x - a->width / 2.0F;

View file

@ -44,6 +44,7 @@ typedef struct SC_SACD_EXPORT SC_SACD_AABB_Box {
float depth; float depth;
} SC_SACD_AABB_Box; } SC_SACD_AABB_Box;
/// Must not be zero initialized. Use SC_SACD_Generix_Box_Default() instead.
typedef struct SC_SACD_EXPORT SC_SACD_Generic_Box { typedef struct SC_SACD_EXPORT SC_SACD_Generic_Box {
/// Coordinates are to center of box. /// Coordinates are to center of box.
float x; float x;
@ -66,6 +67,9 @@ typedef struct SC_SACD_EXPORT SC_SACD_Sphere {
float radius; float radius;
} SC_SACD_Sphere; } SC_SACD_Sphere;
/// Returns a box at origin with width/height/depth of 2 each.
SC_SACD_EXPORT SC_SACD_Generic_Box SC_SACD_Generic_Box_Default(void);
/// Returns non-zero if there is collision. /// Returns non-zero if there is collision.
SC_SACD_EXPORT int SC_SACD_AABB_Box_Collision(const SC_SACD_AABB_Box *a, SC_SACD_EXPORT int SC_SACD_AABB_Box_Collision(const SC_SACD_AABB_Box *a,
const SC_SACD_AABB_Box *b); const SC_SACD_AABB_Box *b);