Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions assets/skybox/Maskonaive/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Author
======

This is the work of Emil Persson, aka Humus.
http://www.humus.name



License
=======

This work is licensed under a Creative Commons Attribution 3.0 Unported License.
http://creativecommons.org/licenses/by/3.0/
Binary file added assets/skybox/water_scene/back.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/skybox/water_scene/bottom.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/skybox/water_scene/front.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/skybox/water_scene/left.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/skybox/water_scene/right.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/skybox/water_scene/top.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 19 additions & 6 deletions src/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,45 @@ use glam::{Mat4, Vec3};

pub struct Camera {
pub position: Vec3,
pub target: Vec3,
pub direction: Vec3,
pub front: Vec3,
pub up: Vec3,
pub yaw: f32,
pub pitch: f32,
pub fov: f32,
pub aspect: f32,
pub near: f32,
pub far: f32,
}

impl Camera {
pub fn new(
position: Vec3,
target: Vec3,
direction: Vec3,
front: Vec3,
up: Vec3,
yaw: f32,
pitch: f32,
fov: f32,
aspect: f32,
near: f32,
far: f32,
) -> Self {
Self {
position,
target,
direction,
front,
up,
yaw,
pitch,
fov,
aspect,
near,
far,
}
}

pub fn view_proj(&self) -> Mat4 {
let view = Mat4::look_at_rh(self.position, self.position + self.front, self.up);
let projection =
Mat4::perspective_rh(self.fov.to_radians(), self.aspect, self.near, self.far);
projection * view
}
}
4 changes: 4 additions & 0 deletions src/global.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pub const WINDOW_W: f64 = 800.0;
pub const WINDOW_H: f64 = 600.0;

pub const GLTF_NAME: &str = "DamagedHelmet";
1 change: 1 addition & 0 deletions src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub enum Key {
C = 8,
R = 15,
F = 3,
ESC = 53,
}

impl Key {
Expand Down
Loading