refactor projections into their own module

This commit is contained in:
Hartmut Seichter 2022-12-09 21:30:47 +01:00
parent 4e59d730fc
commit a7e92ba70a
6 changed files with 124 additions and 174 deletions

View file

@ -33,7 +33,6 @@ fn generalized_projection_stereo(eyePos : Vec3)
}
fn generalized_projection (
projectionScreen: ProjectionScreen,
eyePos: Vec3,
@ -100,77 +99,4 @@ pub fn build_scene(
..default()
});
// camera
// let mut cam = Camera3dBundle {
// transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
// ..default()
// };
// commands.spawn(cam);
// commands.spawn((Person, Position { x: 10.0, y: 10.0 }));
// commands.spawn()
// .insert(Person)
// .insert(Position { x: 10.0, y: 10.0 } );
// camera
// commands.spawn_bundle(OffAxisProjection {
// transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
// ..default()
// });
}
// pub fn modify_frustum(mut query: Query<&Frustum>)
// {
// let mut rng = rand::thread_rng();
// for mut q in query.iter() {
// for mut p in q.planes {
// println!("{:?}",p);
// let mut n = p.normal_d();
// n.w += rng.gen::<f32>();
// p = Plane::new(n);
// println!("{:?}",p);
// // p.normal_d() += rng.gen();
// }
// // println!("{:?}",q.frustum.planes.len());
// }
// }
// pub fn modify_projection(mut query: Query<&Projection>)
// {
// let mut rng = rand::thread_rng();
// for mut q in query.iter() {
// print!("{:?}",q);
// }
// }
// pub fn print_positions(query: Query<&Position>) {
// for _position in query.iter() {
// _ = 33;
// // println!("position {:?} {:?}", position.x, position.y)
// }
// }
// Problem with off-axis
// projection 2401, 240
}