Please report any issues
fn position_in_camera_plane(p: vec3<f32>) -> vec2<f32> {
return vec2(dot(p, camera_right.xyz), dot(p, camera_up.xyz));
}
fn sphere_sdf(p: vec3<f32>, r: f32) -> f32 {
return length(p) - r;
}
fn max_vec3(p: vec3<f32>, value: f32) -> vec3<f32> {
return vec3(max(p.x, value), max(p.y, value), max(p.z, value));
}
fn min_vec3(p: vec3<f32>, value: f32) -> vec3<f32> {
return vec3(min(p.x, value), min(p.y, value), min(p.z, value));
}
fn box_sdf(p: vec3<f32>, b: vec3<f32>) -> f32 {
let q: vec3<f32> = abs(p) - b;
return length(max_vec3(q, 0.0)) + min(max(q.x,max(q.y, q.z)), 0.0);
}