update for Lab

This commit is contained in:
Hartmut Seichter 2022-12-22 13:11:52 +01:00
parent cf7d3a9846
commit 2a144f3420
3 changed files with 13 additions and 6 deletions

View file

@ -45,7 +45,7 @@ pub fn make_projection_rh_from_frustum_reversed(
) -> Mat4 {
assert!(z_near > 0.0 && z_far > 0.0);
info!("near {:?}", z_near);
// info!("near {:?}", z_near);
//
// reversed z 0..1 projection
@ -132,7 +132,7 @@ pub fn create_offaxis_matrices(
let bottom = vec_up_normalized.dot(frustum_left) * z_near / dist; // bottom screen edge
let top = vec_up_normalized.dot(frustum_up) * z_near / dist; // distance eye from screen
info!("l r b t {} {} {} {}", left, right, bottom, top);
// info!("l r b t {} {} {} {}", left, right, bottom, top);
// create a view frustum
let projection_matrix =

View file

@ -35,22 +35,29 @@ pub struct Tracker;
impl FromWorld for Tracker {
fn from_world(world: &mut World) -> Self {
info!("Test here!");
let (sender, receiver): (_, Receiver<PoseReport>) = channel();
std::thread::spawn(move || {
let addr: SocketAddr = "127.0.0.1:3883".parse().unwrap();
// 212.201.64.122 | 127.0.0.1
let addr: SocketAddr = "212.201.64.122:3883".parse().unwrap();
let mut stream = TcpStream::connect(addr).unwrap();
stream.set_nodelay(true).unwrap();
// We first write our cookie, then read and check the server's cookie, before the loop.
write_cookie(&mut stream, CookieData::from(MAGIC_DATA)).unwrap();
let cookie_buf = read_cookie(&mut stream).unwrap();
let mut cookie_buf = Bytes::from(&cookie_buf[..]);
CookieData::unbuffer_ref(&mut cookie_buf)
.and_then(|msg| check_ver_nonfile_compatible(msg.version))
.unwrap();
// Not actually doing anything with the messages here, just receiving them and printing them.
loop {
let mut buf = BytesMut::new();
@ -84,7 +91,7 @@ impl FromWorld for Tracker {
match result {
Ok(result) => { eprintln!("Ok! {:?}",result.body);},
Ok(result) => { eprintln!("Pose from tracker {:?}",result.body);},
Err(_) => {}
}

View file

@ -50,7 +50,7 @@ pub fn apply_viewer_to_projections(
*transform = Transform::from_matrix(view.inverse());
info!("Viewer {:?}", viewer.position);
// info!("Viewer {:?}", viewer.position);
// *transform = Transform::from_translation(eye).looking_at(Vec3::ZERO, Vec3::Y);
});