+ | Backface culling choosing on quad so euclidian map + portal

This commit is contained in:
TheRedShip
2025-02-04 00:07:32 +01:00
parent 9ddce8b6d0
commit df9ab16b76
14 changed files with 86 additions and 33 deletions

View File

@ -42,10 +42,10 @@ bool intersectPlane(Ray ray, GPUObject obj, out hitInfo hit)
bool intersectQuad(Ray ray, GPUObject obj, out hitInfo hit)
{
vec3 normal = normalize(cross(obj.vertex1, obj.vertex2));
vec3 normal = obj.normal;
float d = dot(normal, ray.direction);
if (d == 0.0) return (false);
if (d == 0.0 || (obj.radius != 0.0 && d <= 0)) return (false); // double sided or not
float t = dot(obj.position - ray.origin, normal) / d;
@ -64,6 +64,7 @@ bool intersectQuad(Ray ray, GPUObject obj, out hitInfo hit)
hit.t = t;
hit.position = p + obj.position;
hit.normal = normal * -sign(d);
// hit.normal = normal;
return (inside);
}

View File

@ -171,7 +171,7 @@ hitInfo traceRay(Ray ray)
hitInfo hitScene;
hitInfo hit;
#if 0
#if 1
for (int i = 0; i < 10; i++) // portal ray
{
hitBVH = traverseBVHs(ray);