update with WiP
This commit is contained in:
parent
13349c9920
commit
c73726ddc0
3 changed files with 10 additions and 9 deletions
|
@ -28,15 +28,15 @@ pub fn make_projection_rh_from_frustum_reversed(left: f32, right: f32, bottom: f
|
|||
// reversed z 0..1 projection based on https://thxforthefish.com/posts/reverse_z/
|
||||
//
|
||||
let a = (right + left) / (right - left);
|
||||
let b: f32 = (top + bottom) / (top - bottom);
|
||||
let b = (top + bottom) / (top - bottom);
|
||||
|
||||
let c = z_near / (z_far - z_near);
|
||||
let d = z_far * z_near / (z_far - z_near);
|
||||
|
||||
|
||||
Mat4::from_cols(
|
||||
Vec4::new(2.0 * z_near / (right-left),0.0,0.0,0.0),
|
||||
Vec4::new(0.0, 2.0 * z_near / (top-bottom), 0.0,0.0),
|
||||
Vec4::new(2.0 * z_near / (right-left), 0.0,0.0,0.0),
|
||||
Vec4::new(0.0, 2.0 * z_near / (top-bottom), 0.0,0.0),
|
||||
Vec4::new(a, b, c, -1.0),
|
||||
Vec4::new(0.0, 0.0, d, 0.0))
|
||||
}
|
||||
|
@ -101,7 +101,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 = make_projection_rh_from_frustum_reversed(left,right,bottom,top,z_near,z_far);
|
||||
|
@ -113,10 +113,10 @@ pub fn create_offaxis_matrices(
|
|||
Vec4::W
|
||||
);
|
||||
|
||||
let rotation_quat = Quat::from_mat4(&view_matrix_rotation); /// Quat::from_mat4(view_matrix_rotation);
|
||||
let rotation_quat = Quat::from_mat4(&view_matrix_rotation); // Quat::from_mat4(view_matrix_rotation);
|
||||
|
||||
info!("Rotation Mat {:?}",view_matrix_rotation);
|
||||
info!("Viewer Rotation {:?}",rotation_quat);
|
||||
// info!("Rotation Mat {:?}",view_matrix_rotation);
|
||||
// info!("Viewer Rotation {:?}",rotation_quat);
|
||||
|
||||
let view_matrix_eye = Mat4::from_cols(
|
||||
Vec4::X,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue