//use std::f32::consts::PI; use bevy::prelude::*; use audubon::*; fn main() { let config: audubon::Config = argh::from_env(); App::new() .add_plugins(DefaultPlugins) .insert_resource(config) .add_systems(Startup, setup) .add_systems( Update, ( add_gizmos, rotate_camera, update_config, bevy::window::close_on_esc, ), ) .run(); } fn setup( mut commands: Commands, mut meshes: ResMut>, mut materials: ResMut>, config: Res, models: Res, ) { commands.spawn(Camera3dBundle { transform: Transform::from_xyz(0., 1.5, 6.).looking_at(Vec3::ZERO, Vec3::Y), ..default() }); // plane commands.spawn(PbrBundle { mesh: meshes.add(Mesh::from(shape::Plane::from_size(5.0))), material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()), ..default() }); let toid_model = models.load("models/boid.glb#Scene0"); for _ in 0..config.toids { let _ = turkey_time(&mut commands, &toid_model); } // light commands.spawn(PointLightBundle { point_light: PointLight { intensity: 1500.0, shadows_enabled: true, ..default() }, transform: Transform::from_xyz(4.0, 8.0, 4.0), ..default() }); // example instructions commands.spawn( TextBundle::from_section( "Press 'D' to toggle drawing gizmos on top of everything else in the scene\n\ Press 'P' to toggle perspective for line gizmos\n\ Hold 'Left' or 'Right' to change the line width", TextStyle { font_size: 20., ..default() }, ) .with_style(Style { position_type: PositionType::Absolute, top: Val::Px(12.0), left: Val::Px(12.0), ..default() }), ); } fn rotate_camera(mut query: Query<&mut Transform, With>, time: Res