+ | Compute bvhdata patch

This commit is contained in:
TheRedShip
2025-01-20 12:14:53 +01:00
parent fcf693329d
commit 73bb4462b5
2 changed files with 12 additions and 5 deletions

View File

@ -25,7 +25,12 @@ pl 0 -2 0 0 1 0 2 // floor
qu -1 1.999 -1 2 0 0 0 0 2 6
OBJ obj/Dragon_80K.obj
# OBJ obj/Dragon_80K.obj
# OBJ obj/teapot.obj
# OBJ obj/Model.obj
# OBJ obj/Lowpoly_tree_sample.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

@ -127,8 +127,10 @@ hitInfo traverseBVHs(Ray ray)
for (int i = 0; i < u_bvhNum; i++)
{
ray.origin = i == 0 ? ray.origin : ray.origin + vec3(2., 0., 0.);
hitInfo temp_hit = traceBVH(ray, BvhData[i]);
GPUBvhData bvh_data = BvhData[i];
ray.origin = ray.origin + vec3(float(i), 0., 0.);
hitInfo temp_hit = traceBVH(ray, bvh_data);
if (temp_hit.t < hit.t)
{
@ -156,7 +158,7 @@ hitInfo traceRay(Ray ray)
hitScene = traceScene(ray);
hit = hitBVH.t < hitScene.t ? hitBVH : hitScene;
#if 0
#if 1
if (hit.obj_index == -1 || objects[hit.obj_index].type != 5)
break ;
ray = portalRay(ray, hit);