use std::f32::consts::TAU; use bevy::{ asset::AssetPlugin, core_pipeline::bloom::BloomSettings, input::mouse::{MouseMotion, MouseWheel}, prelude::*, render::{camera::Projection, render_resource::TextureFormat}, window::{close_on_esc, WindowPlugin, WindowResolution}, }; use bevy_mod_paramap::*; const NORMAL_MAP: &str = "earth/normal_map.jpg"; const HEIGHT_MAP: &str = "earth/elevation_surface.jpg"; const ROUGH_MAP: &str = "earth/metallic_roughness.png"; const ALBEDO_MAP: &str = "earth/base_color.jpg"; const EMI_MAP: &str = "earth/emissive.jpg"; fn main() { let mut app = App::new(); app.add_plugins( DefaultPlugins .set(WindowPlugin { primary_window: Some(Window { title: "Earth parallax mapping example".into(), resolution: WindowResolution::new(756., 574.), fit_canvas_to_parent: true, ..default() }), ..default() }) // Tell the asset server to watch for asset changes on disk: .set(AssetPlugin { watch_for_changes: !cfg!(target_arch = "wasm32"), ..default() }), ) .add_plugin(ParallaxMaterialPlugin) .insert_resource(AmbientLight { color: Color::BLACK, brightness: 0.01, }) .insert_resource(ClearColor(Color::BLACK)) .insert_resource(Normal(None)) .add_startup_system(setup) .add_system(pan_orbit_camera) .add_system(update_normal) .add_system(spin) .add_system(close_on_esc); app.register_type::(); app.run(); } #[derive(Component, PartialEq, Eq)] struct Earth; #[derive(Component, PartialEq, Reflect)] struct Spin(f32); fn spin(time: Res