move the camera and stuff to try to match the Blender scene

main
_ 2021-12-19 19:50:55 +00:00
parent 91b3f26e0d
commit 0ace7a7dfa
1 changed files with 6 additions and 7 deletions

View File

@ -174,14 +174,13 @@ impl Graphics {
let screen_size = (320.0, 240.0); let screen_size = (320.0, 240.0);
let fov = 30.0f32; let fov = 40.0f32;
let proj_mat = Mat4::perspective_rh_gl (fov.to_radians (), screen_size.0 / screen_size.1, 0.125, 200.0); let proj_mat = Mat4::perspective_rh_gl (fov.to_radians (), screen_size.0 / screen_size.1, 0.125, 200.0);
let view_mat = proj_mat * let view_mat = proj_mat *
Mat4::from_translation ((0.0, 0.0, -20.0).into ()) * Mat4::from_rotation_x (-63.6f32.to_radians ()) *
Mat4::from_rotation_x ((45.0 - 90.0f32).to_radians ()) Mat4::from_translation ((0.0, 23.3, -12.2).into ());
;
let world_model_mat = Mat4::IDENTITY; let world_model_mat = Mat4::IDENTITY;
self.passes [0].with (gl_state, || { self.passes [0].with (gl_state, || {
@ -193,7 +192,7 @@ impl Graphics {
let attrs = shader_vars.attrs; let attrs = shader_vars.attrs;
let unis = shader_vars.unis; let unis = shader_vars.unis;
if false { if true {
self.texture_earth.bind (); self.texture_earth.bind ();
let mvp = view_mat * let mvp = view_mat *
@ -281,7 +280,7 @@ impl Graphics {
); );
gl::DrawElements ( gl::DrawElements (
gl::TRIANGLES, gl::TRIANGLES,
3 * 12, indices.count ().try_into ().unwrap (),
gl::UNSIGNED_SHORT, gl::UNSIGNED_SHORT,
&level.buffer [indices.offset () + indices_view.offset ()] as *const u8 as *const c_void, &level.buffer [indices.offset () + indices_view.offset ()] as *const u8 as *const c_void,
); );
@ -339,7 +338,7 @@ impl Graphics {
} }
} }
if false { if true {
let sky_mvp_mat = view_mat * Mat4::from_scale ((64.0, 64.0, 64.0).into ()); let sky_mvp_mat = view_mat * Mat4::from_scale ((64.0, 64.0, 64.0).into ());
self.texture_sky.bind (); self.texture_sky.bind ();