From 206a2df480db850df30201382fa9f9ea14d80755 Mon Sep 17 00:00:00 2001 From: Aaron Fenyes Date: Sun, 25 Aug 2024 16:41:31 -0700 Subject: [PATCH] Ray-caster: add a third test sphere This helps confirm that the generalized depth-sorting is working. --- app-proto/inversive-display/src/inversive.frag | 8 +++++--- app-proto/inversive-display/src/main.rs | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app-proto/inversive-display/src/inversive.frag b/app-proto/inversive-display/src/inversive.frag index 93bdde4..dcc8610 100644 --- a/app-proto/inversive-display/src/inversive.frag +++ b/app-proto/inversive-display/src/inversive.frag @@ -121,7 +121,7 @@ vec2 sphere_cast(vecInv v, vec3 dir) { } void main() { - const int sphere_cnt = 2; + const int sphere_cnt = 3; vec2 scr = (2.*gl_FragCoord.xy - resolution) / shortdim; vec3 dir = vec3(focal_slope * scr, -1.); @@ -130,9 +130,11 @@ void main() { vecInv sphere_list [sphere_cnt]; sphere_list[0] = sphere(vec3(0.5, 0.5, -5. + ctrl.x), radius.x); sphere_list[1] = sphere(vec3(-0.5, -0.5, -5. + ctrl.y), radius.y); + sphere_list[2] = sphere(vec3(-0.5, 0.5, -5.), 0.75); vec3 color_list [sphere_cnt]; - color_list[0] = vec3(1., 0.214, 0.); - color_list[1] = vec3(0., 0.214, 1.); + color_list[0] = vec3(1., 0.25, 0.); + color_list[1] = vec3(0., 0.25, 1.); + color_list[2] = vec3(0.25, 0., 1.0); // cast rays through the spheres vec2 depth_pairs [sphere_cnt]; diff --git a/app-proto/inversive-display/src/main.rs b/app-proto/inversive-display/src/main.rs index 186facf..7bd2639 100644 --- a/app-proto/inversive-display/src/main.rs +++ b/app-proto/inversive-display/src/main.rs @@ -211,7 +211,7 @@ fn main() { ) input( type="range", - max=3.0, + max=5.0, step=1.0, bind:valueAsNumber=layer_threshold )