summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/ray/ray_object_sphere.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/modules/ray/ray_object_sphere.h b/src/modules/ray/ray_object_sphere.h
index 85b3d93..5df4b2e 100644
--- a/src/modules/ray/ray_object_sphere.h
+++ b/src/modules/ray/ray_object_sphere.h
@@ -23,7 +23,7 @@ static inline int ray_object_sphere_intersects_ray(ray_object_sphere_t *sphere,
{
ray_3f_t v = ray_3f_sub(&ray->origin, &sphere->center);
float b = ray_3f_dot(&v, &ray->direction);
- float disc = (sphere->radius * sphere->radius) - ray_3f_dot(&v, &v) + (b * b);
+ float disc = (sphere->radius * sphere->radius) - (ray_3f_dot(&v, &v) - (b * b));
if (disc > 0) {
float i1, i2;
© All Rights Reserved