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
|
Size=266,285
|
||||||
|
|
||||||
[Window][Fog settings]
|
[Window][Fog settings]
|
||||||
Pos=1640,500
|
Pos=1643,500
|
||||||
Size=247,157
|
Size=247,157
|
||||||
|
|
||||||
[Window][Debug]
|
[Window][Debug]
|
||||||
@ -19,6 +19,6 @@ Pos=1642,668
|
|||||||
Size=260,143
|
Size=260,143
|
||||||
|
|
||||||
[Window][Debug BVH]
|
[Window][Debug BVH]
|
||||||
Pos=1639,663
|
Pos=1639,664
|
||||||
Size=274,205
|
Size=274,205
|
||||||
|
|
||||||
|
@ -26,5 +26,5 @@ qu -1 1.999 -1 2 0 0 0 0 2 6
|
|||||||
|
|
||||||
OBJ obj/Dragon_80K.obj
|
OBJ obj/Dragon_80K.obj
|
||||||
|
|
||||||
po -1.99 -0.5 -0.5 0 1 0 0 0 1 1 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
|
# 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;
|
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];
|
||||||
{
|
|
||||||
GPUObject obj = objects[i];
|
|
||||||
|
|
||||||
hitInfo temp_hit;
|
hitInfo temp_hit;
|
||||||
if (intersect(ray, obj, temp_hit) && temp_hit.t > 0.0f && temp_hit.t < hit.t + 0.0001)
|
if (intersect(ray, obj, temp_hit) && temp_hit.t < hit.t)
|
||||||
{
|
{
|
||||||
hit.t = temp_hit.t;
|
hit.t = temp_hit.t;
|
||||||
hit.last_t = temp_hit.last_t;
|
hit.last_t = temp_hit.last_t;
|
||||||
hit.obj_index = i;
|
hit.obj_index = i;
|
||||||
hit.mat_index = obj.mat_index;
|
hit.mat_index = obj.mat_index;
|
||||||
hit.position = temp_hit.position;
|
hit.position = temp_hit.position;
|
||||||
hit.normal = temp_hit.normal;
|
hit.normal = temp_hit.normal;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// if (hit.obj_index == -1 || objects[hit.obj_index].type != 5)
|
}
|
||||||
// break ;
|
|
||||||
// ray = portalRay(ray, hit);
|
|
||||||
// }
|
|
||||||
|
|
||||||
return (hit);
|
return (hit);
|
||||||
}
|
}
|
||||||
@ -134,11 +128,15 @@ hitInfo traceRay(Ray ray)
|
|||||||
{
|
{
|
||||||
hitBVH = traceBVH(ray);
|
hitBVH = traceBVH(ray);
|
||||||
hitScene = traceScene(ray);
|
hitScene = traceScene(ray);
|
||||||
|
|
||||||
hit = hitBVH.t < hitScene.t ? hitBVH : hitScene;
|
hit = hitBVH.t < hitScene.t ? hitBVH : hitScene;
|
||||||
if (hit.obj_index == -1 || objects[hit.obj_index].type != 5)
|
#if 0
|
||||||
break ;
|
if (hit.obj_index == -1 || objects[hit.obj_index].type != 5)
|
||||||
ray = portalRay(ray, hit);
|
break ;
|
||||||
|
ray = portalRay(ray, hit);
|
||||||
|
#else
|
||||||
|
return (hit);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return (hit);
|
return (hit);
|
||||||
|
Reference in New Issue
Block a user