[x] glm_ray_at(orig, dir, t, &point) point by parameter
[x] glm_vec3_faceforward(N, I, Nref, dest)
[x] glm_vec[2|3|4]_reflect(I, N, &dest) reflect
[x] glm_vec[2|3|4]_refract(I, N, eta, &dest) refract
[x] tests
[x] docs
glm_ray_sphere():
t1 > 0, t2 > 0: ray intersects the sphere at t1 and t2 both ahead of the origin
t1 < 0, t2 > 0: ray starts inside the sphere, exits at t2
t1 < 0, t2 < 0: no intersection ahead of the ray
the caller can check if the intersection points (t1 and t2) fall within a specific range (for example, tmin < t1, t2 < tmax) to determine if the intersections are within a desired segment of the ray
PS: Since there are multiple FPUs on modern CPUs, I see no benefit to use SIMD for reflect() and refract() for now but it is in TODOs for future, not tested but may bring extra overhead, maybe!.
Some missing ray functions:
glm_ray_sphere(origin, dir, s, &t1, &t2)) -> bool
ray sphere intersectionglm_ray_at(orig, dir, t, &point)
point by parameterglm_vec3_faceforward(N, I, Nref, dest)
glm_vec[2|3|4]_reflect(I, N, &dest)
reflectglm_vec[2|3|4]_refract(I, N, eta, &dest)
refractglm_ray_sphere()
:PS: Since there are multiple FPUs on modern CPUs, I see no benefit to use SIMD for
reflect()
andrefract()
for now but it is in TODOs for future, not tested but may bring extra overhead, maybe!.