refactor view/scene to separate modules

This commit is contained in:
2016-09-21 19:38:27 -07:00
parent b8b5bf8ab7
commit 7a9f65115c
10 changed files with 311 additions and 224 deletions

40
src/bin/vrtue.rs Normal file
View File

@@ -0,0 +1,40 @@
extern crate vrtue;
use vrtue::{view, vr};
extern crate env_logger;
extern crate gfx_device_gl;
#[macro_use] extern crate log;
extern crate piston_window;
use self::piston_window::{PistonWindow, Window, WindowSettings};
pub fn main() {
env_logger::init().expect("env logger");
let mut vr = vr::VR::new().expect("VR init");
let mut window: PistonWindow =
WindowSettings::new("Hello Virtual World!", [512; 2])
.exit_on_esc(true)
.vsync(false)
.build().expect("Building Window");
let view = view::ViewRoot::<gfx_device_gl::Device,
view::ColorFormat,
view::DepthFormat>::create_view(&mut window, &mut vr);
'main:
//while let Some(_) = window.next() {
loop {
view.draw(&mut window, &mut vr);
// handle window events
while let Some(ev) = window.poll_event() {
match ev {
piston_window::Input::Text(_) => break 'main,
_ => debug!("\t{:?}", ev)
}
}
}
debug!("shutting down");
}