forked from StrafesNET/strafe-client
lol idk #1
@ -58,12 +58,12 @@ struct GraphicsCamera{
|
||||
#[inline]
|
||||
fn perspective_rh(fov_x_slope:f32,fov_y_slope:f32,z_near:f32,z_far:f32)->glam::Mat4{
|
||||
//glam_assert!(z_near > 0.0 && z_far > 0.0);
|
||||
let r=z_far / (z_near-z_far);
|
||||
let r=z_far/(z_near-z_far);
|
||||
glam::Mat4::from_cols(
|
||||
glam::Vec4::new(1.0/fov_x_slope,0.0,0.0,0.0),
|
||||
glam::Vec4::new(0.0,1.0/fov_y_slope,0.0,0.0),
|
||||
glam::Vec4::new(0.0,0.0,r,-1.0),
|
||||
glam::Vec4::new(0.0,0.0,r * z_near,0.0),
|
||||
glam::Vec4::new(0.0,0.0,r*z_near,0.0),
|
||||
)
|
||||
}
|
||||
impl GraphicsCamera{
|
||||
@ -72,7 +72,7 @@ impl GraphicsCamera{
|
||||
}
|
||||
pub fn world(&self,pos:glam::Vec3,angles:glam::Vec2)->glam::Mat4{
|
||||
//f32 good enough for view matrix
|
||||
glam::Mat4::from_translation(pos) * glam::Mat4::from_euler(glam::EulerRot::YXZ,angles.x,angles.y,0f32)
|
||||
glam::Mat4::from_translation(pos)*glam::Mat4::from_euler(glam::EulerRot::YXZ,angles.x,angles.y,0f32)
|
||||
}
|
||||
|
||||
pub fn to_uniform_data(&self,(pos,angles):(glam::Vec3,glam::Vec2))->[f32; 16 * 4]{
|
||||
|
Loading…
Reference in New Issue
Block a user