initial setup for rendering into a viewport

This commit is contained in:
Hartmut Seichter 2022-12-06 16:29:41 +01:00
parent 3b18d1e032
commit c793c81ee8
3 changed files with 8 additions and 5 deletions

View file

@ -68,6 +68,6 @@ pub fn offaxis_camera_setup(mut commands: Commands) {
VisibleEntities::default(), VisibleEntities::default(),
Camera::default(), Camera::default(),
Camera3d::default(), Camera3d::default(),
ScreenInfo::default() ScreenInfo::new("Test")
)); ));
} }

View file

@ -28,9 +28,9 @@ pub struct ScreenInfo {
impl ScreenInfo { impl ScreenInfo {
fn default() -> Self { pub fn new(name: &str) -> Self {
Self { Self {
name: String::from("main"), name: name.to_string(),
width: 3.08, width: 3.08,
height: 2.33, height: 2.33,
center: Vec3 { x: 0.0, y: -1.15, z: -3.08 }, center: Vec3 { x: 0.0, y: -1.15, z: -3.08 },
@ -45,7 +45,7 @@ impl ScreenInfo {
} }
fn update(&mut self) { pub fn update(&mut self) -> &mut Self {
// compute right as up ^ forward // compute right as up ^ forward
self.horizontal = self.up.cross(self.normal); self.horizontal = self.up.cross(self.normal);
@ -55,6 +55,8 @@ impl ScreenInfo {
self.bottom = self.center - self.up * (self.height * 0.5); self.bottom = self.center - self.up * (self.height * 0.5);
self.left = self.center - self.horizontal * (self.height * 0.5); self.left = self.center - self.horizontal * (self.height * 0.5);
self.right = self.center + self.horizontal * (self.height * 0.5); self.right = self.center + self.horizontal * (self.height * 0.5);
self
} }

View file

@ -28,6 +28,7 @@ pub fn update_offaxis(mut query : Query<(
(*q).far *= 1.0; (*q).far *= 1.0;
println!("Update {:?}",q); println!("Update {:?}",q);
println!("Screeninfo {0}",si.name.len());
println!("Screeninfo {}",si.name);
} }
} }