yay cubes

This commit is contained in:
2019-07-29 02:31:46 +02:00
parent ef1dab0115
commit 49285a71ce
3 changed files with 50 additions and 23 deletions

View File

@@ -1,8 +1,8 @@
use winit::{Event};
use cgmath::{Matrix4, Rad, Vector3, Deg, Quaternion, Rotation3, One, Rotation};
use cgmath::{Matrix4, Rad, Vector3, Deg, Quaternion, Rotation3, One, Rotation, SquareMatrix};
mod vulkan;
use crate::vulkan::{GameData, Game, LinePoint};
use crate::vulkan::{GameData, Game, LinePoint, GameObject};
mod input;
use crate::input::{InputState};
@@ -40,6 +40,11 @@ impl Game for TestGame<'_> {
println!("{:.0} ms / {:.0} FPS", frame_time * 1000.0, 1.0 / frame_time);
}
if self.input.button_just_pressed("test") {
println!("test");
game_data.game_objects.push(GameObject { mesh_index: 0, model_matrix: Matrix4::identity() });
}
self.cam_rotation = self.cam_rotation * Quaternion::from_angle_z(Deg(self.input.get_axis("look_horizontal") * 0.05));
self.cam_rotation = Quaternion::from_angle_x(Deg(self.input.get_axis("look_vertical") * 0.05)) * self.cam_rotation;
self.cam_position += self.cam_rotation.invert().rotate_vector(Vector3::new(
@@ -87,7 +92,7 @@ fn main() {
let line_count = 30;
vulkan::init(
"models/iski51.obj",
vec!["models/box.obj", "models/iski51.obj"],
(-line_count..=line_count)
.flat_map(|it| vec![
LinePoint { position: [it as f32, -line_count as f32, 0.] },