feat: Good bvh traversal

This commit is contained in:
2026-11-15 12:00:08 +01:00
parent 4581538c66
commit dd32c772e5
8 changed files with 552 additions and 247 deletions
+3
View File
@@ -142,6 +142,8 @@ public struct VoxelCacheTracer<let N : int, H : IVoxelHit<N>> : IVoxelCache
public bool trace<L : ILodPolicy>(uint32_t root, uint32_t thread_id, Ray r, L lod, float offset_t, out Hit v)
{
v.t = 0.;
// Ray mirroring
r.origin += float3(1.);
r.origin = clamp(r.origin, float(1.), asfloat(0x3fffffff));
@@ -216,6 +218,7 @@ public struct VoxelCacheTracer<let N : int, H : IVoxelHit<N>> : IVoxelCache
asfloat(asuint(pos) ^ 0x007fffff),
pos) -
float3(1.);
v.t = offset_t + t;
return true;
}