~ | Glsl portal preprocessor

This commit is contained in:
TheRedShip
2025-01-19 14:29:57 +01:00
parent c5783a15f0
commit 8f70e282b3
4 changed files with 2441 additions and 30 deletions

2413
fps.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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

View File

@ -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);