Add dedicated skinned rendering, pose restoration, shared Material and Material Instance slots, registry-driven components, Surface/Solari integration, transactional schema upgrades, navigation authoring, documentation, and evaluation evidence.
37 lines
1.1 KiB
Rust
37 lines
1.1 KiB
Rust
use super::{prepare::PathtracerAccumulationTexture, Pathtracer};
|
|
use bevy_camera::Camera;
|
|
use bevy_ecs::{
|
|
change_detection::DetectChanges,
|
|
system::{Commands, Query},
|
|
world::Ref,
|
|
};
|
|
use bevy_render::{sync_world::RenderEntity, Extract};
|
|
use bevy_transform::components::GlobalTransform;
|
|
|
|
pub fn extract_pathtracer(
|
|
cameras_3d: Extract<
|
|
Query<(
|
|
RenderEntity,
|
|
&Camera,
|
|
Ref<GlobalTransform>,
|
|
Option<&Pathtracer>,
|
|
)>,
|
|
>,
|
|
mut commands: Commands,
|
|
) {
|
|
for (entity, camera, global_transform, pathtracer) in &cameras_3d {
|
|
let mut entity_commands = commands
|
|
.get_entity(entity)
|
|
.expect("Camera entity wasn't synced.");
|
|
if let Some(pathtracer) = pathtracer
|
|
&& camera.is_active
|
|
{
|
|
let mut pathtracer = pathtracer.clone();
|
|
pathtracer.reset |= global_transform.is_changed();
|
|
entity_commands.insert(pathtracer);
|
|
} else {
|
|
entity_commands.remove::<(Pathtracer, PathtracerAccumulationTexture)>();
|
|
}
|
|
}
|
|
}
|