fix toroid shape
This commit is contained in:
@@ -180,10 +180,10 @@ impl<D: gfx::Device,
|
|||||||
self.camera = na::Similarity3::new(na::Vector3::new( 0.5, 0.0, 0.0),
|
self.camera = na::Similarity3::new(na::Vector3::new( 0.5, 0.0, 0.0),
|
||||||
rot, 1.0).to_homogeneous() * self.camera;
|
rot, 1.0).to_homogeneous() * self.camera;
|
||||||
} if state.rAxis[0].y > 0.5 {
|
} 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;
|
rot, 1.0).to_homogeneous() * self.camera;
|
||||||
} if state.rAxis[0].y < -0.5 {
|
} 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;
|
rot, 1.0).to_homogeneous() * self.camera;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -264,10 +264,10 @@ const VERTEX_SHADER_SRC: &'static [u8] = br#"
|
|||||||
v_uv = a_uv;
|
v_uv = a_uv;
|
||||||
v_tileidx = a_tileidx;
|
v_tileidx = a_tileidx;
|
||||||
float TWO_PI_CIRC = 2 * PI / 256.0;
|
float TWO_PI_CIRC = 2 * PI / 256.0;
|
||||||
float R = 128.0;
|
float R = 1024.0;
|
||||||
float R2 = 16.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))) * 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)),
|
(R + R2 * cos(TWO_PI_CIRC * (a_pos.x + treadmill_x))) * sin(TWO_PI_CIRC * (a_pos.z + treadmill_y)),
|
||||||
1.0);
|
1.0);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ pub type ColorFormat = gfx::format::Srgba8;
|
|||||||
pub type DepthFormat = gfx::format::DepthStencil;
|
pub type DepthFormat = gfx::format::DepthStencil;
|
||||||
|
|
||||||
const NEAR: f32 = 0.01;
|
const NEAR: f32 = 0.01;
|
||||||
const FAR: f32 = 1000.0;
|
const FAR: f32 = 4000.0;
|
||||||
|
|
||||||
gfx_constant_struct! {
|
gfx_constant_struct! {
|
||||||
Trans {
|
Trans {
|
||||||
@@ -80,7 +80,7 @@ impl ViewRoot<gfx_device_gl::Device, ColorFormat, DepthFormat> {
|
|||||||
let eye_mat = vr.head_to_eye_transform(eye);
|
let eye_mat = vr.head_to_eye_transform(eye);
|
||||||
|
|
||||||
use self::na::ToHomogeneous;
|
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();
|
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() };
|
let trans = Trans { matrix: *(proj_mat * eye_mat * hmd_mat * view_mat).as_ref() };
|
||||||
|
|||||||
Reference in New Issue
Block a user