first step done: we have a custom and updatable matrix

This commit is contained in:
Hartmut Seichter 2022-12-05 23:01:16 +01:00
parent 8234a61364
commit 4a8c9a298a
7 changed files with 360 additions and 180 deletions

View file

@ -1,8 +1,10 @@
use crate::scene::*;
use bevy::{prelude::*, window::PresentMode};
use bevy::{prelude::*, window::PresentMode, render::camera::CameraProjectionPlugin};
use offaxis::{offaxis_camera_setup, OffAxisProjection};
mod offaxis;
mod scene;
mod screeninfo;
fn main() {
App::new()
@ -35,7 +37,14 @@ fn main() {
// )
// .add_system(hello_world)
.add_startup_system(build_scene)
.add_system(print_positions)
.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();
}
@ -50,3 +59,14 @@ fn cycle_msaa(input: Res<Input<KeyCode>>, mut msaa: ResMut<Msaa>) {
}
}
}
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);
}
}