Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

#159: PrepassRead lives in raea-sys-compose's passes.rs, beside RAEA_PASS's own reading of the prepasses, not in raea-sys-frame, which it took over the 2,000-line crate limit (2,008). raea-sys-post and raea-render already depend on raea-sys-compose; nothing else changes.

shinyobjectz8443ecf2e7bb
diff --git a/engine/render/src/engine/aov.rs b/engine/render/src/engine/aov.rs
index e60d5cf4..9638c8ac 100644
--- a/engine/render/src/engine/aov.rs
+++ b/engine/render/src/engine/aov.rs
@@ -6,7 +6,7 @@
use super::*;
use bevy::core_pipeline::prepass::{DepthPrepass, MotionVectorPrepass, ViewPrepassTextures};
-use raea_sys_frame::camera::PrepassRead;
+use raea_sys_compose::passes::PrepassRead;
/// One frame's guide data at the prepass's size (the frame's, times RAEA_SS).
pub struct Aov {
diff --git a/systems/compose/src/passes.rs b/systems/compose/src/passes.rs
index 2add2fa1..6ef3e3a3 100644
--- a/systems/compose/src/passes.rs
+++ b/systems/compose/src/passes.rs
@@ -58,6 +58,14 @@ pub fn wanted() -> Option<Pass> {
#[extract_app(bevy::render::RenderApp)]
struct PassView(u32);
+/// A camera whose prepasses a pass after it reads (`--aov`'s motion vectors and depth, RAEA_PASS's depth and normals),
+/// bound as single-sampled textures: it draws with MSAA off on every frame, whatever its row asks, and keeps the depth
+/// and normal prepasses an effect brought when the effect goes (raea-sys-post's msaa_for_3d and sync). Put on with the
+/// prepasses, never taken off (#159: the row's post-processing turned MSAA back on under them, and the pass's bind
+/// group refused the frame).
+#[derive(Component, Clone, Copy, Default)]
+pub struct PrepassRead;
+
pub fn install(app: &mut App) {
let Some(pass) = wanted() else { return };
bevy::asset::embedded_asset!(app, "passes.wesl");
@@ -79,7 +87,7 @@ fn mark(pass: Pass, mut commands: Commands, cams: Query<Entity, (With<Camera3d>,
for e in &cams {
let mut c = commands.entity(e);
// single-sampled on every frame, whatever the camera's row asks (#159)
- c.insert((PassView(pass as u32), DepthPrepass, NormalPrepass, Msaa::Off, raea_sys_frame::camera::PrepassRead));
+ c.insert((PassView(pass as u32), DepthPrepass, NormalPrepass, Msaa::Off, PrepassRead));
if pass == Pass::Albedo {
c.insert((Tonemapping::None, super::bevy_api::Untonemapped)).remove::<DistanceFog>().remove::<bevy::post_process::bloom::Bloom>().remove::<bevy::render::view::ColorGrading>();
}
diff --git a/systems/frame/src/camera.rs b/systems/frame/src/camera.rs
index 4d2830f4..0cbb5a00 100644
--- a/systems/frame/src/camera.rs
+++ b/systems/frame/src/camera.rs
@@ -50,14 +50,6 @@ pub fn remove<B: Bundle>(world: &mut World, e: Entity) {
#[derive(Component, Clone, Copy, Default)]
pub struct IntoImage;
-/// A camera whose prepasses a pass after it reads (`--aov`'s motion vectors and depth, RAEA_PASS's depth and normals),
-/// bound as single-sampled textures: it draws with MSAA off on every frame, whatever its row asks, and keeps the depth
-/// and normal prepasses an effect brought when the effect goes (raea-sys-post's msaa_for_3d and sync). Put on with the
-/// prepasses, never taken off (#159: the row's post-processing turned MSAA back on under them, and the pass's bind
-/// group refused the frame).
-#[derive(Component, Clone, Copy, Default)]
-pub struct PrepassRead;
-
/// The image a camera row draws into (a rendercam's `into`, "render:NAME:WxH[:float]": docs/r3f.feature R3F23a), made
/// if it's new, as the camera's size and target; None for a screen camera.
pub fn image_of(world: &mut World, vals: &BTreeMap<String, V>) -> Result<Option<((u32, u32), RenderTarget)>, String> {
diff --git a/systems/post/src/camera.rs b/systems/post/src/camera.rs
index a1da9455..feab49a3 100644
--- a/systems/post/src/camera.rs
+++ b/systems/post/src/camera.rs
@@ -9,7 +9,8 @@ use raea_core_program::ir::V;
use raea_sys_frame::*;
mod on;
-use raea_sys_frame::camera::{Group, PrepassRead, remove};
+use raea_sys_compose::passes::PrepassRead;
+use raea_sys_frame::camera::{Group, remove};
type Vals = BTreeMap<String, V>;
@@ -219,7 +220,7 @@ mod tests {
// made multisampled with AO on its first shot (AO brought the depth prepass), then given its prepasses as
// --aov gives them (#159)
let (mut w, e) = world(row(&[("bloom", V::N(0.1)), ("ssao", V::S("ultra".into()))]));
- w.entity_mut(e).insert((DepthPrepass, MotionVectorPrepass, Msaa::Off, raea_sys_frame::camera::PrepassRead));
+ w.entity_mut(e).insert((DepthPrepass, MotionVectorPrepass, Msaa::Off, PrepassRead));
// the AO goes and the bloom ramps: still single-sampled, and the depth prepass stays
for b in [0.2, 0.3] {
set(&mut w, row(&[("bloom", V::N(b))]));
@@ -231,7 +232,7 @@ mod tests {
crate::msaa_for_3d(&mut w, true);
assert_eq!(w.get::<Msaa>(e), Some(&Msaa::Off));
// a camera nothing reads the prepasses of still multisamples again (#38)
- w.entity_mut(e).remove::<raea_sys_frame::camera::PrepassRead>();
+ w.entity_mut(e).remove::<PrepassRead>();
crate::msaa_for_3d(&mut w, true);
assert_eq!(w.get::<Msaa>(e), Some(&Msaa::Sample4));
}
diff --git a/systems/post/src/lib.rs b/systems/post/src/lib.rs
index 7138cb0a..a062a247 100644
--- a/systems/post/src/lib.rs
+++ b/systems/post/src/lib.rs
@@ -32,7 +32,7 @@ pub fn msaa_for_3d(world: &mut World, has_3d: bool) {
for e in cams {
let single = world.resource::<FrameRows>().vals(e).is_none_or(|v| ["ssao", "aa", "outline", "frame_looks", "passes"].iter().any(|k| v.contains_key(*k)));
let deferred = world.entity(e).contains::<bevy::core_pipeline::prepass::DeferredPrepass>();
- let read = world.entity(e).contains::<raea_sys_frame::camera::PrepassRead>();
+ let read = world.entity(e).contains::<raea_sys_compose::passes::PrepassRead>();
if !single && !deferred && !read && world.get::<Msaa>(e) == Some(&Msaa::Off) {
world.entity_mut(e).insert(Msaa::default());
}