mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 18:48:36 +02:00
~ | Glsl portal preprocessor
This commit is contained in:
@ -11,7 +11,7 @@ Pos=1648,207
|
||||
Size=266,285
|
||||
|
||||
[Window][Fog settings]
|
||||
Pos=1640,500
|
||||
Pos=1643,500
|
||||
Size=247,157
|
||||
|
||||
[Window][Debug]
|
||||
@ -19,6 +19,6 @@ Pos=1642,668
|
||||
Size=260,143
|
||||
|
||||
[Window][Debug BVH]
|
||||
Pos=1639,663
|
||||
Pos=1639,664
|
||||
Size=274,205
|
||||
|
||||
|
@ -26,5 +26,5 @@ qu -1 1.999 -1 2 0 0 0 0 2 6
|
||||
|
||||
OBJ obj/Dragon_80K.obj
|
||||
|
||||
po -1.99 -0.5 -0.5 0 1 0 0 0 1 1 4
|
||||
po -0.5 -0.5 -1.99 0 1 0 1 0 0 0 4
|
||||
# po -1.99 -0.5 -0.5 0 1 0 0 0 1 1 4
|
||||
# po -0.5 -0.5 -1.99 0 1 0 1 0 0 0 4
|
||||
|
@ -31,30 +31,24 @@ hitInfo traceScene(Ray ray)
|
||||
{
|
||||
hitInfo hit;
|
||||
|
||||
// for (int p = 0; p < 25; p++) //portals
|
||||
// {
|
||||
hit.t = 1e30;
|
||||
hit.obj_index = -1;
|
||||
hit.t = 1e30;
|
||||
hit.obj_index = -1;
|
||||
|
||||
for (int i = 0; i < u_objectsNum; i++)
|
||||
for (int i = 0; i < u_objectsNum; i++)
|
||||
{
|
||||
GPUObject obj = objects[i];
|
||||
|
||||
hitInfo temp_hit;
|
||||
if (intersect(ray, obj, temp_hit) && temp_hit.t < hit.t)
|
||||
{
|
||||
GPUObject obj = objects[i];
|
||||
|
||||
hitInfo temp_hit;
|
||||
if (intersect(ray, obj, temp_hit) && temp_hit.t > 0.0f && temp_hit.t < hit.t + 0.0001)
|
||||
{
|
||||
hit.t = temp_hit.t;
|
||||
hit.last_t = temp_hit.last_t;
|
||||
hit.obj_index = i;
|
||||
hit.mat_index = obj.mat_index;
|
||||
hit.position = temp_hit.position;
|
||||
hit.normal = temp_hit.normal;
|
||||
}
|
||||
hit.t = temp_hit.t;
|
||||
hit.last_t = temp_hit.last_t;
|
||||
hit.obj_index = i;
|
||||
hit.mat_index = obj.mat_index;
|
||||
hit.position = temp_hit.position;
|
||||
hit.normal = temp_hit.normal;
|
||||
}
|
||||
// if (hit.obj_index == -1 || objects[hit.obj_index].type != 5)
|
||||
// break ;
|
||||
// ray = portalRay(ray, hit);
|
||||
// }
|
||||
}
|
||||
|
||||
return (hit);
|
||||
}
|
||||
@ -136,9 +130,13 @@ hitInfo traceRay(Ray ray)
|
||||
hitScene = traceScene(ray);
|
||||
|
||||
hit = hitBVH.t < hitScene.t ? hitBVH : hitScene;
|
||||
if (hit.obj_index == -1 || objects[hit.obj_index].type != 5)
|
||||
break ;
|
||||
ray = portalRay(ray, hit);
|
||||
#if 0
|
||||
if (hit.obj_index == -1 || objects[hit.obj_index].type != 5)
|
||||
break ;
|
||||
ray = portalRay(ray, hit);
|
||||
#else
|
||||
return (hit);
|
||||
#endif
|
||||
}
|
||||
|
||||
return (hit);
|
||||
|
Reference in New Issue
Block a user