Merge branch 'master' into 'master'

Fixed aspect on scene start, added more information to post errors

See merge request veloren/veloren!24

Former-commit-id: d1008de1cccdc3d6748cbc2506e027f626cf6cba
This commit is contained in:
Joshua Barretto 2019-04-14 15:09:39 +00:00
commit 85735ef01c
4 changed files with 10 additions and 8 deletions

@ -1 +1 @@
Subproject commit 6b64a65356c1fb4c77ad0295908f4006f75a5448 Subproject commit e3083ec8e8e634af8c9daed00ea82435da195979

View File

@ -12,21 +12,21 @@ use serde::{Serialize, de::DeserializeOwned};
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum Error { pub enum Error {
Io, //Io(io::Error), Io(Arc<io::Error>),
Bincode, //Bincode(bincode::Error), Bincode(Arc<bincode::Error>),
ChannelFailure, ChannelFailure,
InvalidMessage, InvalidMessage,
} }
impl From<io::Error> for Error { impl From<io::Error> for Error {
fn from(err: io::Error) -> Self { fn from(err: io::Error) -> Self {
Error::Io //(err) Error::Io(Arc::new(err))
} }
} }
impl From<bincode::Error> for Error { impl From<bincode::Error> for Error {
fn from(err: bincode::Error) -> Self { fn from(err: bincode::Error) -> Self {
Error::Bincode //(err) Error::Bincode(Arc::new(err))
} }
} }

View File

@ -17,13 +17,13 @@ pub struct Camera {
impl Camera { impl Camera {
/// Create a new `Camera` with default parameters. /// Create a new `Camera` with default parameters.
pub fn new() -> Self { pub fn new(aspect: f32) -> Self {
Self { Self {
focus: Vec3::unit_z() * 10.0, focus: Vec3::unit_z() * 10.0,
ori: Vec3::zero(), ori: Vec3::zero(),
dist: 150.0, dist: 150.0,
fov: 1.3, fov: 1.3,
aspect: 1.618, aspect,
} }
} }

View File

@ -53,11 +53,13 @@ pub struct Scene {
impl Scene { impl Scene {
/// Create a new `Scene` with default parameters. /// Create a new `Scene` with default parameters.
pub fn new(renderer: &mut Renderer, client: &Client) -> Self { pub fn new(renderer: &mut Renderer, client: &Client) -> Self {
let resolution = renderer.get_resolution().map(|e| e as f32);
Self { Self {
globals: renderer globals: renderer
.create_consts(&[Globals::default()]) .create_consts(&[Globals::default()])
.unwrap(), .unwrap(),
camera: Camera::new(), camera: Camera::new(resolution.x / resolution.y),
skybox: Skybox { skybox: Skybox {
model: renderer model: renderer