PixSpace/src/viewer.rs

41 lines
879 B
Rust
Raw Normal View History

2022-12-06 15:44:16 +01:00
use bevy::{prelude::*, window::PresentMode, render::camera::CameraProjectionPlugin};
// use offaxis::{offaxis_camera_setup, OffAxisProjection};
2022-12-06 15:44:16 +01:00
#[derive(Component,Default)]
2022-12-06 15:44:16 +01:00
pub struct Viewer {
pub position: Vec3,
pub orientation: Quat,
2022-12-06 15:44:16 +01:00
pub alpha: f32,
}
2022-12-06 15:44:16 +01:00
impl Viewer {
pub fn new(position: Vec3) ->Self {
Self {
position,
orientation: Quat::IDENTITY,
alpha: 0.0,
}
}
pub fn default() -> Self {
2022-12-06 15:44:16 +01:00
Self {
position: Vec3::ZERO,
orientation: Quat::IDENTITY,
alpha: 0.0
2022-12-06 15:44:16 +01:00
}
}
}
pub fn simulate_viewer(mut query: Query<&mut Viewer>)
{
for mut v in query.iter_mut() {
//v.position += Vec3::Y * 0.005;
v.alpha += 0.01;
let radius = 0.5;
v.position = Vec3::new(v.alpha.sin()*radius,v.alpha.cos()*radius,5.0);
}
2022-12-06 15:44:16 +01:00
}