Starting nice shader arch

This commit is contained in:
2026-11-04 19:47:47 +01:00
parent 11d26ad16b
commit f8671bd35f
7 changed files with 55 additions and 1 deletions
+54
View File
@@ -0,0 +1,54 @@
struct Ray
{
float3 origin;
float3 direction;
float3 invDirection;
}
struct Span
{
float t0;
float t1;
}
struct Cell
{
/// Entry pointer into the cache
uint32_t cache_pointer; // entry into the cache
/// Ray to be traced inside the cache
Ray local_ray;
}
interface IStructure
{
/// A cursor structure to keep ray state
associatedtype Cursor;
/// Begins tracing a certain ray, with a span
Cursor begin(Ray worldRay, Span s);
/// Returns whether it hits, updating the state, and returning a cell structure if hit.
bool next(inout Cursor c, out Cell cell); // next populated cell along the ray
}
interface ILodPolicy
{
/// cone / pixel-footprint termination
bool shouldStop(float t, float nodeSize);
}
interface IVoxelCache
{
associatedtype Voxel;
bool trace<L : ILodPolicy>(uint32_t root, Ray r, L lod, out float t, out Voxel v);
}
struct Tracer<S : IStructure, C : IVoxelCache>
{
S structure;
C cache;
Hit<C.Voxel> trace(Ray r, Span s) { /* loop: next cell -> cache.trace -> early out */ }
}