working version of the frustum based calculation for the perspective matrix
This commit is contained in:
parent
c793c81ee8
commit
2b3d00f1d4
5 changed files with 113 additions and 17 deletions
src
|
@ -1,22 +1,41 @@
|
|||
use bevy::{prelude::*, window::PresentMode, render::camera::CameraProjectionPlugin};
|
||||
use offaxis::{offaxis_camera_setup, OffAxisProjection};
|
||||
// use offaxis::{offaxis_camera_setup, OffAxisProjection};
|
||||
|
||||
|
||||
#[derive(Component)]
|
||||
struct Viewer;
|
||||
|
||||
#[derive(Component)]
|
||||
#[derive(Component,Default)]
|
||||
pub struct Viewer {
|
||||
position: Vec3,
|
||||
orientation: Quat,
|
||||
}
|
||||
pub position: Vec3,
|
||||
pub orientation: Quat,
|
||||
|
||||
pub alpha: f32,
|
||||
}
|
||||
|
||||
impl Viewer {
|
||||
|
||||
fn default() -> Self {
|
||||
pub fn new(position: Vec3) ->Self {
|
||||
Self {
|
||||
position: Vec3::ZERO,
|
||||
position,
|
||||
orientation: Quat::IDENTITY,
|
||||
alpha: 0.0,
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default() -> Self {
|
||||
Self {
|
||||
position: Vec3::ZERO,
|
||||
orientation: Quat::IDENTITY,
|
||||
alpha: 0.0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue