tinkering around with bevy

This commit is contained in:
Hartmut Seichter 2022-08-07 22:26:12 +02:00
parent 52bb4d43df
commit c33335fc50
5 changed files with 450 additions and 492 deletions

View file

@ -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() {