forked from bevyengine/bevy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add .contains_aabb for Frustum (bevyengine#16022)
# Objective - Fixes: bevyengine#15663 ## Solution - Add an `is_forward_plane` method to `Aabb`, and a `contains_aabb` method to `Frustum`. ## Test - I have created a frustum with an offset along with three unit tests to evaluate the `contains_aabb` algorithm. ## Explanation for the Test Cases - To facilitate the code review, I will explain how the frustum is created. Initially, we create a frustum without any offset and then create a cuboid that is just contained within it. <img width="714" alt="image" src="https://github.com/user-attachments/assets/a9ac53a2-f8a3-4e09-b20b-4ee71b27a099"> - Secondly, we move the cuboid by 2 units along both the x-axis and the y-axis to make it more general. ## Reference - [Frustum Culling](https://learnopengl.com/Guest-Articles/2021/Scene/Frustum-Culling#) - [AABB Plane intersection](https://gdbooks.gitbooks.io/3dcollisions/content/Chapter2/static_aabb_plane.html) --------- Co-authored-by: IQuick 143 <IQuick143cz@gmail.com>
- Loading branch information
Showing
1 changed file
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters