Application prototype #14
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user