fix toroid shape

This commit is contained in:
2016-09-30 23:46:52 -07:00
parent 8211912b44
commit 708af6720c
2 changed files with 7 additions and 7 deletions

View File

@@ -180,10 +180,10 @@ impl<D: gfx::Device,
self.camera = na::Similarity3::new(na::Vector3::new( 0.5, 0.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;
} 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);

View File

@@ -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<gfx_device_gl::Device, ColorFormat, DepthFormat> {
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() };