Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
/active_project
/test/assets/assets.db
/test/products/
_codeql_detected_source_root
16 changes: 16 additions & 0 deletions runtime/core/include/core/shapes/Shapes.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@ namespace sky {
bool Intersection(const AABB &aabb, const Frustum &frustum);
std::pair<bool, int> Intersection(const AABB &aabb, const Plane &plane);

/**
* @brief Ray-AABB intersection test
* @param ray Ray to test
* @param aabb Axis-aligned bounding box
* @return (hit, tMin, tMax) - whether hit occurred, and entry/exit distances
*/
std::tuple<bool, float, float> Intersection(const Ray &ray, const AABB &aabb);

/**
* @brief Ray-AABB intersection test (simple version)
* @param ray Ray to test
* @param aabb Axis-aligned bounding box
* @return true if ray intersects AABB
*/
bool IntersectionTest(const Ray &ray, const AABB &aabb);

// utils
Plane CreatePlaneByVertices(const Vector3 &v1, const Vector3 &v2, const Vector3 &v3);
Plane CreatePlaneByNormalAndVertex(const Vector3 &normal, const Vector3 &pt);
Expand Down
Loading