* | cleaning

This commit is contained in:
TheRedShip
2025-01-06 17:13:31 +01:00
parent 5a6fd1f9ef
commit a06e1f80a8
2 changed files with 7 additions and 4 deletions

View File

@ -33,9 +33,12 @@ bool intersectQuad(Ray ray, GPUObject obj, out hitInfo hit)
{
vec3 normal = normalize(cross(obj.vertex1, obj.vertex2));
float d = dot(normal, ray.direction);
if (d == 0.0) return (false);
float t = dot(obj.position - ray.origin, normal) / d;
if (t <= 0.0 || d == 0.0) return (false);
if (t <= 0.0) return (false);
vec3 p = ray.origin + ray.direction * t - obj.position;