Application prototype #14

Merged
glen merged 101 commits from app-proto into main 2024-10-21 23:38:28 +00:00
Showing only changes of commit f274119da6 - Show all commits

View File

@ -150,6 +150,9 @@ fn main() {
let vertex_array = ctx.create_vertex_array().unwrap(); let vertex_array = ctx.create_vertex_array().unwrap();
ctx.bind_vertex_array(Some(&vertex_array)); ctx.bind_vertex_array(Some(&vertex_array));
// enable depth testing
ctx.enable(WebGl2RenderingContext::DEPTH_TEST);
// set the projection map // set the projection map
let focal_length = 3.0_f32; let focal_length = 3.0_f32;
let near_clip = 0.1_f32; let near_clip = 0.1_f32;
@ -158,8 +161,8 @@ fn main() {
let world_to_clip: [f32; 16] = [ let world_to_clip: [f32; 16] = [
focal_length, 0.0, 0.0, 0.0, focal_length, 0.0, 0.0, 0.0,
0.0, focal_length, 0.0, 0.0, 0.0, focal_length, 0.0, 0.0,
0.0, 0.0, (near_clip + far_clip) * depth_inv, -1., 0.0, 0.0, -(near_clip + far_clip) * depth_inv, -1.,
0.0, 0.0, 2. * near_clip * far_clip * depth_inv, 0.0 0.0, 0.0, -2. * near_clip * far_clip * depth_inv, 0.0
]; ];
ctx.uniform_matrix4fv_with_f32_array(world_to_clip_loc.as_ref(), false, &world_to_clip); ctx.uniform_matrix4fv_with_f32_array(world_to_clip_loc.as_ref(), false, &world_to_clip);