add cube. I think it's inside-out

main
_ 2021-12-18 21:58:21 +00:00
parent 116fd3bc45
commit ac85cf2bd1
1 changed files with 19 additions and 1 deletions

View File

@ -64,7 +64,10 @@ impl GameGraphics {
let proj_mat = Mat4::perspective_rh_gl (30.0f32.to_radians (), screen_size.0 / screen_size.1, 0.125, 200.0); let proj_mat = Mat4::perspective_rh_gl (30.0f32.to_radians (), screen_size.0 / screen_size.1, 0.125, 200.0);
let view_mat = proj_mat * Mat4::from_rotation_x (-90.0f32.to_radians ()); let view_mat = proj_mat *
Mat4::from_translation ((0.0, 0.0, -20.0).into ()) *
Mat4::from_rotation_x ((45.0 - 90.0f32).to_radians ())
;
let world_model_mat = Mat4::IDENTITY; let world_model_mat = Mat4::IDENTITY;
self.passes [0].with (gl_state, || { self.passes [0].with (gl_state, || {
@ -76,6 +79,21 @@ impl GameGraphics {
let attrs = shader_vars.attrs; let attrs = shader_vars.attrs;
let unis = shader_vars.unis; let unis = shader_vars.unis;
{
let mvp = view_mat * Mat4::IDENTITY;
glezz::uniform_matrix_4fv (unis [&u::MVP], &mvp);
//let object_space_light = make_object_space_vec (&inverse_truck, &light);
//let object_space_sky = make_object_space_vec (&inverse_truck, &Vec3::from ((0.0, 0.0, 1.0)));
//glezz::uniform_3fv (unis [&OBJECT_SPACE_LIGHT], &object_space_light);
//glezz::uniform_3fv (unis [&OBJECT_SPACE_SKY], &object_space_sky);
self.mesh_cube.draw_all (attrs, |_| {
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 ());