use bevy::{ core_pipeline::{ bloom::BloomSettings, core_3d::ScreenSpaceTransmissionQuality, experimental::taa::{TemporalAntiAliasBundle, TemporalAntiAliasPlugin}, tonemapping::Tonemapping, }, prelude::*, }; use bevy_vox_scene::VoxScenePlugin; use utilities::{PanOrbitCamera, PanOrbitCameraPlugin}; /// Asset labels aren't just for loading individual models within a scene, they can load any named group within a scene, a "slice" of the scene /// Here, just the workstation is loaded from the example scene fn main() { let mut app = App::new(); app.add_plugins(( DefaultPlugins, PanOrbitCameraPlugin, VoxScenePlugin::default(), )) .add_systems(Startup, setup); // *Note:* TAA is not _required_ for specular transmission, but // it _greatly enhances_ the look of the resulting blur effects. // Sadly, it's not available under WebGL. #[cfg(not(all(feature = "webgl2", target_arch = "wasm32")))] app.insert_resource(Msaa::Off) .add_plugins(TemporalAntiAliasPlugin); app.run(); } fn setup(mut commands: Commands, assets: Res) { commands.spawn(( Camera3dBundle { camera: Camera { hdr: true, ..Default::default() }, camera_3d: Camera3d { screen_space_specular_transmission_quality: ScreenSpaceTransmissionQuality::High, screen_space_specular_transmission_steps: 1, ..default() }, transform: Transform::from_xyz(0.0, 1.5, 8.0).looking_at(Vec3::ZERO, Vec3::Y), tonemapping: Tonemapping::SomewhatBoringDisplayTransform, ..Default::default() }, PanOrbitCamera::default(), BloomSettings { intensity: 0.3, ..default() }, #[cfg(not(all(feature = "webgl2", target_arch = "wasm32")))] TemporalAntiAliasBundle::default(), EnvironmentMapLight { diffuse_map: assets.load("pisa_diffuse.ktx2"), specular_map: assets.load("pisa_specular.ktx2"), intensity: 500.0, }, )); commands.spawn(SceneBundle { // "workstation" is the name of the group containing the desk, computer, & keyboard scene: assets.load("study.vox#workstation"), transform: Transform::from_scale(Vec3::splat(0.05)), ..default() }); }