properly parameterize world torus radii
This commit is contained in:
12
src/view.rs
12
src/view.rs
@@ -10,14 +10,13 @@ use gfx;
|
||||
use gfx::Device;
|
||||
use gfx::traits::FactoryExt;
|
||||
use self::na::Inverse;
|
||||
use self::num_traits::identities::One;
|
||||
use self::piston_window::{PistonWindow, Window};
|
||||
|
||||
pub type ColorFormat = gfx::format::Srgba8;
|
||||
pub type DepthFormat = gfx::format::DepthStencil;
|
||||
|
||||
const NEAR: f32 = 0.01;
|
||||
const FAR: f32 = 4000.0;
|
||||
const FAR: f32 = 10000.0;
|
||||
|
||||
gfx_constant_struct! {
|
||||
Trans {
|
||||
@@ -75,15 +74,10 @@ impl ViewRoot<gfx_device_gl::Device, ColorFormat, DepthFormat> {
|
||||
|
||||
window.encoder.clear_depth(&buffers.depth, 1.0);
|
||||
|
||||
// Submit eye textures
|
||||
let proj_mat = vr.projection_matrix(eye, NEAR, FAR);
|
||||
let eye_mat = vr.head_to_eye_transform(eye);
|
||||
|
||||
use self::na::ToHomogeneous;
|
||||
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() };
|
||||
let scene_mat = scene.origin();
|
||||
let trans = Trans { matrix: *(proj_mat * eye_mat * hmd_mat * scene_mat).as_ref() };
|
||||
window.encoder.update_constant_buffer(&self.trans, &trans);
|
||||
|
||||
scene.render(&mut window.factory,
|
||||
|
||||
Reference in New Issue
Block a user