Application prototype #14

Merged
glen merged 101 commits from app-proto into main 2024-10-21 23:38:28 +00:00
2 changed files with 16 additions and 4 deletions
Showing only changes of commit 6db9f5be6c - Show all commits

View File

@ -173,11 +173,17 @@ void main() {
if (debug_mode) { if (debug_mode) {
// at the bottom of the screen, show the color scale instead of the // at the bottom of the screen, show the color scale instead of the
// layer count // 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 // convert number to color
ivec3 bits = layer_cnt / ivec3(1, 2, 4); vec3 color;
outColor = vec4(mod(vec3(bits), 2.), 1.); 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; return;
} }

View File

@ -132,7 +132,10 @@ fn main() {
let color_vec = vec![ let color_vec = vec![
[1.00_f32, 0.25_f32, 0.00_f32], [1.00_f32, 0.25_f32, 0.00_f32],
[0.00_f32, 0.25_f32, 1.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 // 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_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, 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.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 // set the resolution
let width = canvas.width() as f32; let width = canvas.width() as f32;