minor update
This commit is contained in:
parent
4a8c9a298a
commit
3b18d1e032
7 changed files with 154 additions and 133 deletions
54
src/main.rs
54
src/main.rs
|
@ -1,21 +1,24 @@
|
|||
/**
|
||||
* PixSpace is a Virtual Reality Toolkit to run projective VR setups
|
||||
*
|
||||
* © Copyright 2022 Hartmut Seichter
|
||||
*
|
||||
*/
|
||||
|
||||
use crate::scene::*;
|
||||
use crate::utils::*;
|
||||
|
||||
use bevy::{prelude::*, window::PresentMode, render::camera::CameraProjectionPlugin};
|
||||
use offaxis::{offaxis_camera_setup, OffAxisProjection};
|
||||
|
||||
mod offaxis;
|
||||
mod scene;
|
||||
mod screeninfo;
|
||||
mod utils;
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.insert_resource(ClearColor(Color::rgb(0.0, 0.1, 0.9)))
|
||||
// .insert_resource(WindowDescriptor{
|
||||
// title: "PixSpace".to_string(),
|
||||
// width: 1280.0,
|
||||
// height: 800.0,
|
||||
// present_mode: PresentMode::AutoVsync,
|
||||
// ..Default::default()
|
||||
// })
|
||||
.add_plugins(DefaultPlugins.set(WindowPlugin {
|
||||
window: WindowDescriptor {
|
||||
title: "PixSpace".to_string(),
|
||||
|
@ -26,47 +29,16 @@ fn main() {
|
|||
},
|
||||
..default()
|
||||
}))
|
||||
// .add_plugins(DefaultPlugins)
|
||||
.add_plugin(scene::BuildScenePlugin)
|
||||
// .add_startup_system(offaxis::camera_setup)
|
||||
// .add_plugin(scene::BuildScenePlugin)
|
||||
.add_system(bevy::window::close_on_esc)
|
||||
.add_system(cycle_msaa)
|
||||
// .add_system_to_stage(
|
||||
// CoreStage::PostUpdate,
|
||||
// camera_system::<offaxis::OffAxisProjection>,
|
||||
// )
|
||||
// .add_system(hello_world)
|
||||
.add_startup_system(build_scene)
|
||||
.add_system(modify_projection)
|
||||
// .add_system(modify_projection)
|
||||
|
||||
.add_startup_system(offaxis_camera_setup)
|
||||
// .add_system(print_positions)
|
||||
// .add_system(modify_frustum)
|
||||
|
||||
.add_plugin(CameraProjectionPlugin::<OffAxisProjection>::default())
|
||||
|
||||
.add_system(update_offaxis)
|
||||
.run();
|
||||
}
|
||||
|
||||
fn cycle_msaa(input: Res<Input<KeyCode>>, mut msaa: ResMut<Msaa>) {
|
||||
if input.just_pressed(KeyCode::M) {
|
||||
if msaa.samples == 4 {
|
||||
info!("Not using MSAA");
|
||||
msaa.samples = 1;
|
||||
} else {
|
||||
info!("Using 4x MSAA");
|
||||
msaa.samples = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn update_offaxis(mut query : Query<&mut OffAxisProjection>)
|
||||
{
|
||||
for mut q in query.iter_mut() {
|
||||
|
||||
// we fake access to far for updating the matrix
|
||||
(*q).far *= 1.0;
|
||||
|
||||
println!("Update {:?}",q);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue