update with VRPN integration
This commit is contained in:
parent
9c778afa2b
commit
d7bc604289
6 changed files with 1003 additions and 182 deletions
75
src/scene.rs
75
src/scene.rs
|
@ -1,74 +1,4 @@
|
|||
use bevy::{prelude::*, math::bool, render::primitives::Frustum};
|
||||
use rand::prelude::*;
|
||||
use bevy::render::primitives::Plane;
|
||||
|
||||
// pub struct BuildScenePlugin;
|
||||
|
||||
// impl Plugin for BuildScenePlugin {
|
||||
// fn build(&self, app: &mut App) {
|
||||
// app.add_startup_system(build_scene) // actual scene
|
||||
// .add_system(print_positions); // debugging
|
||||
// }
|
||||
// }
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct ProjectionScreen {
|
||||
bottom_left: Vec3,
|
||||
bottom_right: Vec3,
|
||||
top_left: Vec3,
|
||||
top_right: Vec3,
|
||||
|
||||
dir_right: Vec3,
|
||||
dir_up: Vec3,
|
||||
dir_normal: Vec3,
|
||||
|
||||
matrix: Mat4
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
fn generalized_projection_stereo(eyePos : Vec3)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
fn generalized_projection (
|
||||
projectionScreen: ProjectionScreen,
|
||||
eyePos: Vec3,
|
||||
mut camera: Camera3dBundle,
|
||||
clampNearPlane: bool,
|
||||
)
|
||||
{
|
||||
let pa = projectionScreen.bottom_left;
|
||||
let pb = projectionScreen.bottom_right;
|
||||
let pc = projectionScreen.top_left;
|
||||
let pd = projectionScreen.top_right;
|
||||
|
||||
let vu = projectionScreen.dir_up;
|
||||
let vr = projectionScreen.dir_right;
|
||||
let vn = projectionScreen.dir_normal;
|
||||
|
||||
// let m = projectionScreen.matrix;
|
||||
|
||||
//let m = Mat4::from_cols(vu., y_axis, z_axis, w_axis)
|
||||
|
||||
let va = pa - eyePos;
|
||||
let vb = pb - eyePos;
|
||||
let vc = pc - eyePos;
|
||||
let vd = pd - eyePos;
|
||||
|
||||
let viewDir = eyePos + va + vb + vc + vd;
|
||||
|
||||
let d = -va.dot(vn);
|
||||
|
||||
|
||||
if clampNearPlane {
|
||||
_ = 33;
|
||||
// camera.frustum.planes[4]. // should be near
|
||||
}
|
||||
|
||||
}
|
||||
use bevy::prelude::*;
|
||||
|
||||
pub fn build_scene(
|
||||
mut commands: Commands,
|
||||
|
@ -98,5 +28,4 @@ pub fn build_scene(
|
|||
transform: Transform::from_xyz(4.0, 1.0, -4.0),
|
||||
..default()
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue