1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
pub mod sphere_trace_lipschitz;
pub mod sphere_trace_naive;

use rust_gpu_bridge::prelude::Vec3;

use crate::prelude::{Distance, SignedDistanceField};

#[derive(Debug, Default, Copy, Clone, PartialEq, PartialOrd)]
pub struct RaymarchOutput {
    pub hit: bool,
    pub dist: f32,
    pub steps: u32,
}

pub trait Raymarch {
    type Output;

    fn raymarch<Sdf, const MAX_STEPS: u32>(
        &self,
        sdf: &Sdf,
        start: f32,
        end: f32,
        eye: Vec3,
        dir: Vec3,
        epsilon: f32,
    ) -> Self::Output
    where
        Sdf: SignedDistanceField<Vec3, Distance>;
}