Commit 80e17cc
Add optimized is_in_half_space_identity, contains_aabb_identity, and intersects_obb_identity (#21249)
# Objective
This adds an optimized version of is_in_half_space,
`Frustum::contains_aabb_identity`, `Aabb::is_in_half_space_identity`,
and `Frustum::intersects_obb_identity` that takes advantage of how
calling with IDENTITY (common) reduces the amount of matrix
multiplications.
## Solution
Add a specialized function without touching the original that assumes
Identity was passed to simplify math.
## Testing
I use this function extensively in my own project. I asserted the old
function called with identity always returns the same as my new
function.
I bench marked and profiled the usage in my real application and noticed
a 16% speed up on Linux and 20% on windows for contains_aabb.
I bench marked intersects_obb_identity and noticed a 39% increase on
linux and 38% on windows.
Both functions have unit tests that assert calling with identity yields
the same result in both versions.
---------
Co-authored-by: François Mockers <[email protected]>
Co-authored-by: IQuick 143 <[email protected]>1 parent 41bf46d commit 80e17cc
1 file changed
+96
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
136 | 146 | | |
137 | 147 | | |
138 | 148 | | |
| |||
369 | 379 | | |
370 | 380 | | |
371 | 381 | | |
372 | | - | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
373 | 398 | | |
374 | 399 | | |
375 | 400 | | |
| |||
380 | 405 | | |
381 | 406 | | |
382 | 407 | | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
383 | 420 | | |
384 | 421 | | |
385 | 422 | | |
| |||
772 | 809 | | |
773 | 810 | | |
774 | 811 | | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
775 | 870 | | |
0 commit comments