Created
June 23, 2016 17:56
-
-
Save pushrax/78624d7016fc5c55868e33387799c868 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
void aabbIntersectFast(vec3 P, vec3 R, vec3 invR, vec3 aabb[2], out float tmin, out float tmax) | |
{ | |
vec3 t1 = (aabb[0] - P) * invR; | |
vec3 t2 = (aabb[1] - P) * invR; | |
vec3 tmins = min(t1, t2); | |
vec3 tmaxs = max(t1, t2); | |
tmin = max(max(tmins.x, tmins.y), tmins.z); | |
tmax = min(min(tmaxs.x, tmaxs.y), tmaxs.z); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment