tinkering around with bevy
This commit is contained in:
parent
52bb4d43df
commit
c33335fc50
5 changed files with 450 additions and 492 deletions
|
@ -1,8 +1,8 @@
|
|||
use bevy::prelude::*;
|
||||
|
||||
use bevy::render::primitives::Frustum;
|
||||
use bevy::render::camera::{Camera, Camera2d, CameraProjection, DepthCalculation};
|
||||
use bevy::render::view::VisibleEntities;
|
||||
// use bevy::render::primitives::Frustum;
|
||||
use bevy::render::camera::{Camera, CameraProjection, DepthCalculation};
|
||||
// use bevy::render::view::VisibleEntities;
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct OffAxisProjection {
|
||||
|
@ -13,6 +13,7 @@ pub struct OffAxisProjection {
|
|||
|
||||
impl CameraProjection for OffAxisProjection {
|
||||
fn get_projection_matrix(&self) -> Mat4 {
|
||||
println!("Here we go!");
|
||||
Mat4::orthographic_rh(
|
||||
-self.aspect, self.aspect, -1.0, 1.0, self.near, self.far
|
||||
)
|
||||
|
@ -47,10 +48,11 @@ pub fn camera_setup(mut commands: Commands) {
|
|||
|
||||
let projection = OffAxisProjection::default();
|
||||
let camera = Camera {
|
||||
near: projection.near,
|
||||
far: projection.far,
|
||||
// near: projection.near,
|
||||
// far: projection.far,
|
||||
..default()
|
||||
};
|
||||
/*
|
||||
// position the camera like bevy would do by default for 2D:
|
||||
let transform = Transform::from_xyz(0.0, 0.0, projection.far - 0.1);
|
||||
// frustum construction code copied from Bevy
|
||||
|
@ -71,7 +73,10 @@ pub fn camera_setup(mut commands: Commands) {
|
|||
transform,
|
||||
GlobalTransform::default(),
|
||||
Camera2d,
|
||||
));
|
||||
)
|
||||
);
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
// fn main() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue