From f69ad40bd515c894a89557483132eec3822deed7 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Sun, 14 Apr 2019 16:05:51 +0100 Subject: [PATCH] Fixed aspect on scene start, added more information to post errors Former-commit-id: 0daff37cbcad6f906962216ce923a005da6861c1 --- assets/voxygen | 2 +- common/src/net/post2.rs | 8 ++++---- voxygen/src/scene/camera.rs | 4 ++-- voxygen/src/scene/mod.rs | 4 +++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/assets/voxygen b/assets/voxygen index 6b64a65356..e3083ec8e8 160000 --- a/assets/voxygen +++ b/assets/voxygen @@ -1 +1 @@ -Subproject commit 6b64a65356c1fb4c77ad0295908f4006f75a5448 +Subproject commit e3083ec8e8e634af8c9daed00ea82435da195979 diff --git a/common/src/net/post2.rs b/common/src/net/post2.rs index 25db57288b..9617237c8e 100644 --- a/common/src/net/post2.rs +++ b/common/src/net/post2.rs @@ -12,21 +12,21 @@ use serde::{Serialize, de::DeserializeOwned}; #[derive(Clone, Debug)] pub enum Error { - Io, //Io(io::Error), - Bincode, //Bincode(bincode::Error), + Io(Arc), + Bincode(Arc), ChannelFailure, InvalidMessage, } impl From for Error { fn from(err: io::Error) -> Self { - Error::Io //(err) + Error::Io(Arc::new(err)) } } impl From for Error { fn from(err: bincode::Error) -> Self { - Error::Bincode //(err) + Error::Bincode(Arc::new(err)) } } diff --git a/voxygen/src/scene/camera.rs b/voxygen/src/scene/camera.rs index 4a7953fb1f..750bd1e359 100644 --- a/voxygen/src/scene/camera.rs +++ b/voxygen/src/scene/camera.rs @@ -17,13 +17,13 @@ pub struct Camera { impl Camera { /// Create a new `Camera` with default parameters. - pub fn new() -> Self { + pub fn new(aspect: f32) -> Self { Self { focus: Vec3::unit_z() * 10.0, ori: Vec3::zero(), dist: 150.0, fov: 1.3, - aspect: 1.618, + aspect, } } diff --git a/voxygen/src/scene/mod.rs b/voxygen/src/scene/mod.rs index d2324d6758..55a08d6a79 100644 --- a/voxygen/src/scene/mod.rs +++ b/voxygen/src/scene/mod.rs @@ -53,11 +53,13 @@ pub struct Scene { impl Scene { /// Create a new `Scene` with default parameters. pub fn new(renderer: &mut Renderer, client: &Client) -> Self { + let resolution = renderer.get_resolution().map(|e| e as f32); + Self { globals: renderer .create_consts(&[Globals::default()]) .unwrap(), - camera: Camera::new(), + camera: Camera::new(resolution.x / resolution.y), skybox: Skybox { model: renderer