camera projection wip

This commit is contained in:
2025-09-07 12:46:38 -04:00
parent 7d3afc9002
commit 275f4a905e
6 changed files with 100 additions and 41 deletions

View File

@@ -1,12 +1,19 @@
use bevy::{
asset::RenderAssetUsages,
math::VectorSpace,
prelude::*,
render::render_resource::{Extent3d, TextureDimension, TextureFormat, TextureUsages},
render::{
render_resource::{Extent3d, TextureDimension, TextureFormat, TextureUsages},
view::RenderLayers,
},
window::PrimaryWindow,
};
use iyes_perf_ui::prelude::*;
use crate::render::pipeline::{TracerPipelinePlugin, TracerRenderTextures, TracerUniforms};
use crate::{
components::rt::RTCamera,
render::pipeline::{TracerPipelinePlugin, TracerRenderTextures, TracerUniforms},
};
pub struct Blackhole;
@@ -18,6 +25,7 @@ impl Plugin for Blackhole {
app.add_plugins(TracerPipelinePlugin);
app.insert_resource(TracerUniforms {
sky_color: LinearRgba::BLUE,
..default()
});
//Perf UI
@@ -74,5 +82,16 @@ fn setup(mut commands: Commands, mut images: ResMut<Assets<Image>>, window: Sing
commands.spawn(Camera2d);
commands.spawn((
// Camera3d::default(),
Projection::Perspective(PerspectiveProjection {
aspect_ratio: size.x as f32 / size.y as f32,
..default()
}),
RTCamera,
Transform::from_xyz(0.0, 0.0, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
Name::new("RT Camera"),
));
commands.insert_resource(TracerRenderTextures(img0, img1));
}