98 lines
2.9 KiB
Rust
98 lines
2.9 KiB
Rust
use bevy::{
|
|
core_pipeline::{bloom::Bloom, tonemapping::Tonemapping},
|
|
prelude::*,
|
|
window::WindowMode,
|
|
};
|
|
use bevy_inspector_egui::{bevy_egui::EguiPlugin, quick::WorldInspectorPlugin};
|
|
use bevy_panorbit_camera::{PanOrbitCamera, PanOrbitCameraPlugin};
|
|
|
|
fn setup(
|
|
mut commands: Commands,
|
|
mut meshes: ResMut<Assets<Mesh>>,
|
|
mut materials: ResMut<Assets<StandardMaterial>>,
|
|
) {
|
|
commands.spawn((
|
|
PanOrbitCamera {
|
|
focus: Vec3::new(4.1, 0.0, 0.0),
|
|
zoom_lower_limit: 0.0001,
|
|
..default()
|
|
},
|
|
Camera {
|
|
hdr: true,
|
|
clear_color: ClearColorConfig::Custom(Color::BLACK),
|
|
..default()
|
|
},
|
|
Projection::Perspective(PerspectiveProjection {
|
|
near: 1e-9, // Very close near plane for extreme zooming
|
|
..default()
|
|
}),
|
|
Tonemapping::TonyMcMapface,
|
|
Bloom::NATURAL,
|
|
Transform::from_translation(Vec3::new(4.1, 0., 0.1)),
|
|
));
|
|
|
|
// Example setup for a PointLight component
|
|
commands.spawn((PointLight {
|
|
shadows_enabled: true,
|
|
..default()
|
|
},));
|
|
|
|
let sphere_mesh = meshes.add(Sphere::new(0.001));
|
|
let material = materials.add(StandardMaterial {
|
|
base_color: Color::WHITE,
|
|
..default()
|
|
});
|
|
commands.spawn((
|
|
Mesh3d(sphere_mesh),
|
|
MeshMaterial3d(material),
|
|
Transform::from_translation(Vec3::new(4.1, 0.0, 0.0)),
|
|
));
|
|
|
|
let sphere_mesh = meshes.add(Sphere::new(0.003));
|
|
let material = materials.add(StandardMaterial {
|
|
base_color: Color::WHITE,
|
|
..default()
|
|
});
|
|
commands.spawn((
|
|
Mesh3d(sphere_mesh),
|
|
MeshMaterial3d(material),
|
|
Transform::from_translation(Vec3::new(4.4, 0.2, 0.0)),
|
|
));
|
|
|
|
let sphere_mesh = meshes.add(Sphere::new(0.3));
|
|
let material = materials.add(StandardMaterial {
|
|
base_color: Color::WHITE,
|
|
emissive: LinearRgba::rgb(192., 191., 173.),
|
|
..default()
|
|
});
|
|
commands.spawn((Mesh3d(sphere_mesh), MeshMaterial3d(material)));
|
|
|
|
let sphere_mesh = meshes.add(Sphere::new(0.01));
|
|
let material = materials.add(StandardMaterial {
|
|
base_color: Color::WHITE,
|
|
..default()
|
|
});
|
|
commands.spawn((
|
|
Mesh3d(sphere_mesh),
|
|
MeshMaterial3d(material),
|
|
Transform::from_translation(Vec3::new(10., 0.2, 0.0)),
|
|
));
|
|
}
|
|
|
|
fn main() {
|
|
App::new()
|
|
.add_plugins(DefaultPlugins.set(WindowPlugin {
|
|
primary_window: Some(Window {
|
|
title: "Solar Sim".to_string(),
|
|
mode: WindowMode::BorderlessFullscreen(MonitorSelection::Primary),
|
|
..default()
|
|
}),
|
|
..default()
|
|
}))
|
|
.add_plugins(EguiPlugin::default())
|
|
.add_plugins(WorldInspectorPlugin::new())
|
|
.add_plugins(PanOrbitCameraPlugin)
|
|
.add_systems(Startup, setup)
|
|
.run();
|
|
}
|