Work on back projection, f32 -> f64
This commit is contained in:
+8
-28
@@ -3,7 +3,6 @@ extern crate glium;
|
||||
#[macro_use]
|
||||
extern crate verbose_log;
|
||||
extern crate model_converter;
|
||||
extern crate nalgebra as na;
|
||||
|
||||
use std::process::exit;
|
||||
use std::time::{Instant, Duration};
|
||||
@@ -82,10 +81,6 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
let center = (bbox.min() + bbox.max()) / 2.0;
|
||||
let center = Vector3::new(center.x() as f32, center.y() as f32, center.z() as f32);
|
||||
let size = (bbox.max() - bbox.min()).norm() as f32;
|
||||
|
||||
let mut events_loop = EventsLoop::new();
|
||||
let window = WindowBuilder::new().with_visibility(false);
|
||||
let context = glutin::ContextBuilder::new().with_depth_buffer(24);
|
||||
@@ -98,7 +93,7 @@ fn main() {
|
||||
|
||||
for (name, mut model) in models {
|
||||
log!("Scaling model {}...", name);
|
||||
// model.center_and_scale_from_box(&bbox);
|
||||
model.center_and_scale_from_box(&bbox);
|
||||
|
||||
log!("\nBuilding textures for model {}...", name);
|
||||
|
||||
@@ -120,21 +115,19 @@ fn main() {
|
||||
let mut closed = false;
|
||||
|
||||
let mut camera = Camera::new(
|
||||
Vector3::new(1.0, 0.0, 0.0),
|
||||
Vector3::new(0.0, 0.0, 0.0),
|
||||
Vector3::new(0.0, 1.0, 0.0),
|
||||
Vector3::new( 0.0, 0.0, 0.0),
|
||||
Vector3::new( 0.0, 0.0, 0.0),
|
||||
Vector3::new( 0.0, 1.0, 0.0),
|
||||
);
|
||||
|
||||
camera.z_near = 0.0001;
|
||||
|
||||
use model_converter::camera::RenderCamera;
|
||||
|
||||
let mut controls: Box<Controls> = if matches.is_present("first person") {
|
||||
Box::new(FirstPersonControls::new())
|
||||
} else {
|
||||
Box::new(OrbitControls::new(
|
||||
Vector3::new(0.0, 0.0, 0.0),
|
||||
2.0,
|
||||
1.0,
|
||||
&mut camera
|
||||
))
|
||||
};
|
||||
@@ -176,33 +169,20 @@ fn main() {
|
||||
}, ..
|
||||
}, ..
|
||||
} => {
|
||||
|
||||
// Go back in world coordinates
|
||||
let position = camera.position;
|
||||
// let position = position + center;
|
||||
|
||||
let target = camera.target;
|
||||
// let target = target + center;
|
||||
|
||||
let up = camera.up;
|
||||
|
||||
println!("Camera:");
|
||||
|
||||
println!("\tPosition: ({}, {}, {})",
|
||||
position.x(), position.y(), position.z());
|
||||
camera.position.x(), camera.position.y(), camera.position.z());
|
||||
println!("\tTarget: ({}, {}, {})",
|
||||
target.x(), target.y(), target.z());
|
||||
camera.target.x(), camera.target.y(), camera.target.z());
|
||||
println!("\tUp: ({}, {}, {})",
|
||||
up.x(), up.y(), up.z());
|
||||
|
||||
camera.up.x(), camera.up.y(), camera.up.z());
|
||||
}
|
||||
|
||||
_ => (),
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
controls.update(&mut camera, &renderer);
|
||||
renderer.render(&scene, &camera);
|
||||
let elapsed = as_millis(Instant::now().duration_since(before));
|
||||
|
||||
Reference in New Issue
Block a user