From 708af6720cbfc73b24fa0e706caa42e43f6d99c2 Mon Sep 17 00:00:00 2001 From: Jared Roberts Date: Fri, 30 Sep 2016 23:46:52 -0700 Subject: [PATCH] fix toroid shape --- src/scenes/world.rs | 10 +++++----- src/view.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/scenes/world.rs b/src/scenes/world.rs index 372d2b6..37c5898 100644 --- a/src/scenes/world.rs +++ b/src/scenes/world.rs @@ -180,10 +180,10 @@ impl 0.5 { - self.camera = na::Similarity3::new(na::Vector3::new( 0.0, -0.5, 0.0), + self.camera = na::Similarity3::new(na::Vector3::new( 0.0, -5.0, 0.0), rot, 1.0).to_homogeneous() * self.camera; } if state.rAxis[0].y < -0.5 { - self.camera = na::Similarity3::new(na::Vector3::new( 0.0, 0.5, 0.0), + self.camera = na::Similarity3::new(na::Vector3::new( 0.0, 5.0, 0.0), rot, 1.0).to_homogeneous() * self.camera; } }, @@ -264,10 +264,10 @@ const VERTEX_SHADER_SRC: &'static [u8] = br#" v_uv = a_uv; v_tileidx = a_tileidx; float TWO_PI_CIRC = 2 * PI / 256.0; - float R = 128.0; - float R2 = 16.0; + float R = 1024.0; + float R2 = 128.0; - gl_Position = u_matrix * camera * vec4(R * -1.0 * sin(TWO_PI_CIRC * (a_pos.x + treadmill_x)), + gl_Position = u_matrix * camera * vec4(R2 * -1.0 * sin(TWO_PI_CIRC * (a_pos.x + treadmill_x)), (R + R2 * cos(TWO_PI_CIRC * (a_pos.x + treadmill_x))) * cos(TWO_PI_CIRC * (a_pos.z + treadmill_y)), (R + R2 * cos(TWO_PI_CIRC * (a_pos.x + treadmill_x))) * sin(TWO_PI_CIRC * (a_pos.z + treadmill_y)), 1.0); diff --git a/src/view.rs b/src/view.rs index 5996743..4a48724 100644 --- a/src/view.rs +++ b/src/view.rs @@ -17,7 +17,7 @@ pub type ColorFormat = gfx::format::Srgba8; pub type DepthFormat = gfx::format::DepthStencil; const NEAR: f32 = 0.01; -const FAR: f32 = 1000.0; +const FAR: f32 = 4000.0; gfx_constant_struct! { Trans { @@ -80,7 +80,7 @@ impl ViewRoot { let eye_mat = vr.head_to_eye_transform(eye); use self::na::ToHomogeneous; - let view_mat = na::Similarity3::new(na::Vector3::new(0.0, 128.0 - 16.0, 0.0), + let view_mat = na::Similarity3::new(na::Vector3::new(0.0, 1024.0 - 128.0, 0.0), na::Vector3::new(0.0, 0.0, 0.0), 1.0).to_homogeneous(); let trans = Trans { matrix: *(proj_mat * eye_mat * hmd_mat * view_mat).as_ref() };