pull/211/head
Ben Hansen 3 years ago
parent 87c6fa9971
commit f46b2f6d74

173
Cargo.lock generated

@ -313,10 +313,10 @@ dependencies = [
"cgmath",
"env_logger",
"fs_extra",
"futures",
"glob",
"image",
"log",
"pollster",
"rayon",
"shaderc",
"tobj 2.0.2",
@ -658,10 +658,10 @@ dependencies = [
"cgmath",
"env_logger",
"fs_extra",
"futures",
"glob",
"image",
"log",
"pollster",
"rayon",
"shaderc",
"thiserror",
@ -693,101 +693,6 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
[[package]]
name = "futures"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613"
dependencies = [
"futures-channel",
"futures-core",
"futures-executor",
"futures-io",
"futures-sink",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-channel"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5"
dependencies = [
"futures-core",
"futures-sink",
]
[[package]]
name = "futures-core"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399"
[[package]]
name = "futures-executor"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314"
dependencies = [
"futures-core",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-io"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789"
[[package]]
name = "futures-macro"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39"
dependencies = [
"proc-macro-hack",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "futures-sink"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc"
[[package]]
name = "futures-task"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626"
dependencies = [
"once_cell",
]
[[package]]
name = "futures-util"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6"
dependencies = [
"futures-channel",
"futures-core",
"futures-io",
"futures-macro",
"futures-sink",
"futures-task",
"memchr",
"pin-project",
"pin-utils",
"proc-macro-hack",
"proc-macro-nested",
"slab",
]
[[package]]
name = "fxhash"
version = "0.2.1"
@ -1153,11 +1058,11 @@ dependencies = [
"env_logger",
"framework",
"fs_extra",
"futures",
"gif",
"glob",
"image",
"log",
"pollster",
"shaderc",
"tobj 2.0.2",
"wgpu 0.9.0",
@ -1915,32 +1820,6 @@ dependencies = [
"indexmap",
]
[[package]]
name = "pin-project"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "pin-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
version = "0.3.18"
@ -1959,6 +1838,12 @@ dependencies = [
"miniz_oxide",
]
[[package]]
name = "pollster"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb20dcc30536a1508e75d47dd0e399bb2fe7354dcf35cda9127f2bf1ed92e30e"
[[package]]
name = "proc-macro-crate"
version = "0.1.5"
@ -1968,18 +1853,6 @@ dependencies = [
"toml",
]
[[package]]
name = "proc-macro-hack"
version = "0.5.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4"
[[package]]
name = "proc-macro-nested"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a"
[[package]]
name = "proc-macro2"
version = "1.0.27"
@ -2503,9 +2376,9 @@ version = "0.1.0"
dependencies = [
"cgmath",
"env_logger",
"futures",
"image",
"log",
"pollster",
"wgpu 0.9.0",
"winit 0.25.0",
]
@ -2519,10 +2392,10 @@ dependencies = [
"cgmath",
"env_logger",
"fs_extra",
"futures",
"glob",
"image",
"log",
"pollster",
"tobj 3.0.1",
"wgpu 0.8.1",
"winit 0.25.0",
@ -2537,10 +2410,10 @@ dependencies = [
"cgmath",
"env_logger",
"fs_extra",
"futures",
"glob",
"image",
"log",
"pollster",
"tobj 3.0.1",
"wgpu 0.9.0",
"winit 0.25.0",
@ -2555,10 +2428,10 @@ dependencies = [
"cgmath",
"env_logger",
"fs_extra",
"futures",
"glob",
"image",
"log",
"pollster",
"tobj 3.0.1",
"wgpu 0.9.0",
"winit 0.25.0",
@ -2573,10 +2446,10 @@ dependencies = [
"cgmath",
"env_logger",
"fs_extra",
"futures",
"glob",
"image",
"log",
"pollster",
"rayon",
"tobj 3.0.1",
"wgpu 0.9.0",
@ -2589,9 +2462,9 @@ version = "0.1.0"
dependencies = [
"cgmath",
"env_logger",
"futures",
"image",
"log",
"pollster",
"wgpu 0.9.0",
"winit 0.25.0",
]
@ -2604,10 +2477,10 @@ dependencies = [
"cgmath",
"env_logger",
"fs_extra",
"futures",
"glob",
"image",
"log",
"pollster",
"wgpu 0.9.0",
"winit 0.25.0",
]
@ -2621,10 +2494,10 @@ dependencies = [
"cgmath",
"env_logger",
"fs_extra",
"futures",
"glob",
"image",
"log",
"pollster",
"wgpu 0.9.0",
"winit 0.25.0",
]
@ -2638,10 +2511,10 @@ dependencies = [
"cgmath",
"env_logger",
"fs_extra",
"futures",
"glob",
"image",
"log",
"pollster",
"wgpu 0.9.0",
"winit 0.25.0",
]
@ -2655,10 +2528,10 @@ dependencies = [
"cgmath",
"env_logger",
"fs_extra",
"futures",
"glob",
"image",
"log",
"pollster",
"wgpu 0.9.0",
"winit 0.25.0",
]
@ -2672,10 +2545,10 @@ dependencies = [
"cgmath",
"env_logger",
"fs_extra",
"futures",
"glob",
"image",
"log",
"pollster",
"wgpu 0.9.0",
"winit 0.25.0",
]
@ -2689,10 +2562,10 @@ dependencies = [
"cgmath",
"env_logger",
"fs_extra",
"futures",
"glob",
"image",
"log",
"pollster",
"wgpu 0.9.0",
"winit 0.25.0",
]
@ -2706,10 +2579,10 @@ dependencies = [
"cgmath",
"env_logger",
"fs_extra",
"futures",
"glob",
"image",
"log",
"pollster",
"tobj 3.0.1",
"wgpu 0.8.1",
"winit 0.25.0",
@ -3082,8 +2955,8 @@ name = "windowless"
version = "0.1.0"
dependencies = [
"cgmath",
"futures",
"image",
"pollster",
"raw-window-handle",
"shaderc",
"wgpu 0.9.0",

@ -12,6 +12,8 @@ pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4<f32> = cgmath::Matrix4::new(
0.0, 0.0, 0.5, 1.0,
);
const SAFE_FRAC_PI_2: f32 = FRAC_PI_2 - 0.0001;
#[derive(Debug)]
pub struct Camera {
pub position: Point3<f32>,
@ -33,9 +35,16 @@ impl Camera {
}
pub fn calc_matrix(&self) -> Matrix4<f32> {
let (sin_pitch, cos_pitch) = self.pitch.0.sin_cos();
let (sin_yaw, cos_yaw) = self.yaw.0.sin_cos();
Matrix4::look_to_rh(
self.position,
Vector3::new(self.yaw.0.cos(), self.pitch.0.sin(), self.yaw.0.sin()).normalize(),
Vector3::new(
cos_pitch * cos_yaw,
sin_pitch,
cos_pitch * sin_yaw
).normalize(),
Vector3::unit_y(),
)
}
@ -182,10 +191,10 @@ impl CameraController {
self.rotate_vertical = 0.0;
// Keep the camera's angle from going too high/low.
if camera.pitch < -Rad(FRAC_PI_2) {
camera.pitch = -Rad(FRAC_PI_2);
} else if camera.pitch > Rad(FRAC_PI_2) {
camera.pitch = Rad(FRAC_PI_2);
if camera.pitch < -Rad(SAFE_FRAC_PI_2) {
camera.pitch = -Rad(SAFE_FRAC_PI_2);
} else if camera.pitch > Rad(SAFE_FRAC_PI_2) {
camera.pitch = Rad(SAFE_FRAC_PI_2);
}
}
}

@ -12,6 +12,8 @@ pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4<f32> = cgmath::Matrix4::new(
0.0, 0.0, 0.5, 1.0,
);
const SAFE_FRAC_PI_2: f32 = FRAC_PI_2 - 0.0001;
#[derive(Debug)]
pub struct Camera {
pub position: Point3<f32>,
@ -33,9 +35,16 @@ impl Camera {
}
pub fn calc_matrix(&self) -> Matrix4<f32> {
let (sin_pitch, cos_pitch) = self.pitch.0.sin_cos();
let (sin_yaw, cos_yaw) = self.yaw.0.sin_cos();
Matrix4::look_to_rh(
self.position,
Vector3::new(self.yaw.0.cos(), self.pitch.0.sin(), self.yaw.0.sin()).normalize(),
Vector3::new(
cos_pitch * cos_yaw,
sin_pitch,
cos_pitch * sin_yaw
).normalize(),
Vector3::unit_y(),
)
}
@ -182,10 +191,10 @@ impl CameraController {
self.rotate_vertical = 0.0;
// Keep the camera's angle from going too high/low.
if camera.pitch < -Rad(FRAC_PI_2) {
camera.pitch = -Rad(FRAC_PI_2);
} else if camera.pitch > Rad(FRAC_PI_2) {
camera.pitch = Rad(FRAC_PI_2);
if camera.pitch < -Rad(SAFE_FRAC_PI_2) {
camera.pitch = -Rad(SAFE_FRAC_PI_2);
} else if camera.pitch > Rad(SAFE_FRAC_PI_2) {
camera.pitch = Rad(SAFE_FRAC_PI_2);
}
}
}

@ -12,6 +12,8 @@ pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4<f32> = cgmath::Matrix4::new(
0.0, 0.0, 0.5, 1.0,
);
const SAFE_FRAC_PI_2: f32 = FRAC_PI_2 - 0.0001;
#[derive(Debug)]
pub struct Camera {
pub position: Point3<f32>,
@ -33,9 +35,16 @@ impl Camera {
}
pub fn calc_matrix(&self) -> Matrix4<f32> {
let (sin_pitch, cos_pitch) = self.pitch.0.sin_cos();
let (sin_yaw, cos_yaw) = self.yaw.0.sin_cos();
Matrix4::look_to_rh(
self.position,
Vector3::new(self.yaw.0.cos(), self.pitch.0.sin(), self.yaw.0.sin()).normalize(),
Vector3::new(
cos_pitch * cos_yaw,
sin_pitch,
cos_pitch * sin_yaw
).normalize(),
Vector3::unit_y(),
)
}
@ -182,10 +191,10 @@ impl CameraController {
self.rotate_vertical = 0.0;
// Keep the camera's angle from going too high/low.
if camera.pitch < -Rad(FRAC_PI_2) {
camera.pitch = -Rad(FRAC_PI_2);
} else if camera.pitch > Rad(FRAC_PI_2) {
camera.pitch = Rad(FRAC_PI_2);
if camera.pitch < -Rad(SAFE_FRAC_PI_2) {
camera.pitch = -Rad(SAFE_FRAC_PI_2);
} else if camera.pitch > Rad(SAFE_FRAC_PI_2) {
camera.pitch = Rad(SAFE_FRAC_PI_2);
}
}
}

@ -12,6 +12,8 @@ pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4<f32> = cgmath::Matrix4::new(
0.0, 0.0, 0.5, 1.0,
);
const SAFE_FRAC_PI_2: f32 = FRAC_PI_2 - 0.0001;
#[derive(Debug)]
pub struct Camera {
pub position: Point3<f32>,
@ -33,9 +35,16 @@ impl Camera {
}
pub fn calc_matrix(&self) -> Matrix4<f32> {
let (sin_pitch, cos_pitch) = self.pitch.0.sin_cos();
let (sin_yaw, cos_yaw) = self.yaw.0.sin_cos();
Matrix4::look_to_rh(
self.position,
Vector3::new(self.yaw.0.cos(), self.pitch.0.sin(), self.yaw.0.sin()).normalize(),
Vector3::new(
cos_pitch * cos_yaw,
sin_pitch,
cos_pitch * sin_yaw
).normalize(),
Vector3::unit_y(),
)
}
@ -182,10 +191,10 @@ impl CameraController {
self.rotate_vertical = 0.0;
// Keep the camera's angle from going too high/low.
if camera.pitch < -Rad(FRAC_PI_2) {
camera.pitch = -Rad(FRAC_PI_2);
} else if camera.pitch > Rad(FRAC_PI_2) {
camera.pitch = Rad(FRAC_PI_2);
if camera.pitch < -Rad(SAFE_FRAC_PI_2) {
camera.pitch = -Rad(SAFE_FRAC_PI_2);
} else if camera.pitch > Rad(SAFE_FRAC_PI_2) {
camera.pitch = Rad(SAFE_FRAC_PI_2);
}
}
}

@ -225,10 +225,10 @@ impl CameraController {
self.rotate_vertical = 0.0;
// Keep the camera's angle from going too high/low.
if camera.pitch < -Rad(FRAC_PI_2) {
camera.pitch = -Rad(FRAC_PI_2);
} else if camera.pitch > Rad(FRAC_PI_2) {
camera.pitch = Rad(FRAC_PI_2);
if camera.pitch < -Rad(SAFE_FRAC_PI_2) {
camera.pitch = -Rad(SAFE_FRAC_PI_2);
} else if camera.pitch > Rad(SAFE_FRAC_PI_2) {
camera.pitch = Rad(SAFE_FRAC_PI_2);
}
}
}

Loading…
Cancel
Save