mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 10:48:34 +02:00
+ | Backface culling choosing on quad so euclidian map + portal
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user