Enlarge the test construction to six spheres

In debug mode, assign most of the color scale to even layer counts. Odd
layer counts are topologically prohibited, so we should rarely see bugs
severe enough to produce them.
This commit is contained in:
Aaron Fenyes 2024-08-28 17:14:55 -07:00
parent 3a721a4cc8
commit 6db9f5be6c
2 changed files with 16 additions and 4 deletions

View File

@ -173,11 +173,17 @@ void main() {
if (debug_mode) {
// at the bottom of the screen, show the color scale instead of the
// layer count
if (gl_FragCoord.y < 10.) layer_cnt = int(8. * gl_FragCoord.x / resolution.x);
if (gl_FragCoord.y < 10.) layer_cnt = 2 * int(8. * gl_FragCoord.x / resolution.x);
// convert number to color
ivec3 bits = layer_cnt / ivec3(1, 2, 4);
outColor = vec4(mod(vec3(bits), 2.), 1.);
vec3 color;
if (layer_cnt % 2 == 0) {
ivec3 bits = layer_cnt / ivec3(2, 4, 8);
color = mod(vec3(bits), 2.);
} else {
color = vec3(0.5);
}
outColor = vec4(color, 1.);
return;
}

View File

@ -132,7 +132,10 @@ fn main() {
let color_vec = vec![
[1.00_f32, 0.25_f32, 0.00_f32],
[0.00_f32, 0.25_f32, 1.00_f32],
[0.25_f32, 0.00_f32, 1.00_f32]
[0.25_f32, 0.00_f32, 1.00_f32],
[0.25_f32, 1.00_f32, 0.00_f32],
[0.75_f32, 0.75_f32, 0.00_f32],
[0.00_f32, 0.75_f32, 0.50_f32],
];
// timing
@ -292,6 +295,9 @@ fn main() {
sphere_vec.push(&construction_to_world * engine::sphere(0.5, 0.5, ctrl_x.get(), radius_x.get()));
sphere_vec.push(&construction_to_world * engine::sphere(-0.5, -0.5, ctrl_y.get(), radius_y.get()));
sphere_vec.push(&construction_to_world * engine::sphere(-0.5, 0.5, 0.0, 0.75));
sphere_vec.push(&construction_to_world * engine::sphere(0.5, -0.5, 0.0, 0.5));
sphere_vec.push(&construction_to_world * engine::sphere(0.0, 0.15, 1.0, 0.25));
sphere_vec.push(&construction_to_world * engine::sphere(0.0, -0.15, -1.0, 0.25));
// set the resolution
let width = canvas.width() as f32;