feat: Added models and lfs
Some checks failed
build / checks-matrix (push) Failing after 3h6m31s
build / codecov (push) Failing after 3h6m30s
docs / docs (push) Failing after 3h6m28s
build / checks-build (push) Has been cancelled

This commit is contained in:
2026-03-02 01:46:24 +05:30
parent 17d21dbc66
commit 808168e4f6
9 changed files with 238 additions and 27 deletions

View File

@@ -1,9 +1,10 @@
use bevy::prelude::*;
use iyes_perf_ui::PerfUiPlugin;
#[cfg(all(feature = "wasm", not(target_arch = "wasm32")))]
compile_error!("The `wasm` feature is only supported on the `wasm32` target architecture.");
#[cfg(all(feature = "wayland", not(target_os = "linux")))]
compile_error!("The `wayland` feature is only supported on the `linux` target operating system.");
// #[cfg(all(feature = "wasm", not(target_arch = "wasm32")))]
// compile_error!("The `wasm` feature is only supported on the `wasm32` target architecture.");
// #[cfg(all(feature = "wayland", not(target_os = "linux")))]
// compile_error!("The `wayland` feature is only supported on the `linux` target operating system.");
pub fn main() {
App::new()
@@ -12,37 +13,67 @@ pub fn main() {
DefaultPlugins,
bevy_debug_grid::DebugGridPlugin::without_floor_grid(),
bevy_panorbit_camera::PanOrbitCameraPlugin,
))
bevy::diagnostic::FrameTimeDiagnosticsPlugin::default())
)
.add_plugins(bevy::diagnostic::EntityCountDiagnosticsPlugin::default())
.add_plugins(bevy::diagnostic::SystemInformationDiagnosticsPlugin)
.add_plugins(bevy::render::diagnostic::RenderDiagnosticsPlugin)
.add_plugins(PerfUiPlugin)
.add_systems(Startup, setup)
.add_systems(Update, camera_movement)
.run();
}
#[derive(Component)]
pub struct MainCam {
speed: f32,
}
// bevy_panorbit_camera::PanOrbitCamera {
// axis: [Vec3::X, Vec3::Y, Vec3::Z],
// allow_upside_down: false,
// zoom_smoothness: 0.0,
// target_focus: Vec3::new(10.0, 10.0, 10.0),
// target_radius: 10.0,
// ..default()
// },
fn setup(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
mut asset_server: ResMut<AssetServer>,
) {
commands.spawn((
SceneRoot(asset_server.load("models/ame.glb#Scene0")),
Transform::from_xyz(0.0, 0.1, 0.0),
));
commands.spawn((
bevy_panorbit_camera::PanOrbitCamera {
axis: [Vec3::X, Vec3::Y, Vec3::Z],
allow_upside_down: false,
zoom_smoothness: 0.0,
target_focus: Vec3::new(10.0, 10.0, 10.0),
target_focus: Vec3::new(0.0, 0.0, 0.0),
target_radius: 10.0,
..default()
},
Transform::from_xyz(50.0, 50.0, 50.0).looking_at(Vec3::ZERO, Vec3::Y),
MainCam { speed: 1.0 },
Camera3d {
..default()
}
));
commands.spawn((
Mesh3d(meshes.add(Plane3d::default().mesh().size(5.0, 5.0))),
MeshMaterial3d(materials.add(Color::srgb(0.3, 0.5, 0.3))),
));
commands.spawn((
Mesh3d(meshes.add(Cuboid::new(1.0, 1.0, 1.0))),
MeshMaterial3d(materials.add(Color::srgb(0.8, 0.7, 0.6))),
Transform::from_xyz(0.0, 0.5, 0.0),
));
// commands.spawn((
// Mesh3d(meshes.add(Cuboid::new(1.0, 1.0, 1.0))),
// MeshMaterial3d(materials.add(Color::srgb(0.8, 0.7, 0.6))),
// Transform::from_xyz(0.0, 0.5, 0.0),
// ));
commands.spawn((
PointLight {
shadows_enabled: true,
@@ -51,6 +82,11 @@ fn setup(
},
Transform::from_xyz(4.0, 8.0, 4.0),
));
commands.spawn((AmbientLight {
color: Color::WHITE,
brightness: 0.5,
..default()
},));
commands.spawn((
bevy_debug_grid::Grid {
@@ -67,4 +103,38 @@ fn setup(
Transform::default(),
Visibility::default(),
));
commands.spawn(iyes_perf_ui::prelude::PerfUiAllEntries::default());
}
// pub fn camera_movement(
// input: Res<ButtonInput<KeyCode>>,
// mut camera_query: Query<(&mut Transform, &MainCam), With<bevy_panorbit_camera::PanOrbitCamera>>,
// ) {
// for (mut transform, cam) in camera_query.iter_mut() {
// let mut direction = Vec3::ZERO;
// if input.pressed(KeyCode::KeyW) {
// direction += Vec3::Z;
// }
// if input.pressed(KeyCode::KeyS) {
// direction -= Vec3::Z;
// }
// if input.pressed(KeyCode::KeyA) {
// direction -= Vec3::X;
// }
// if input.pressed(KeyCode::KeyD) {
// direction += Vec3::X;
// }
// if input.pressed(KeyCode::Space) {
// direction += Vec3::Y;
// }
// if input.pressed(KeyCode::ShiftLeft) {
// direction -= Vec3::Y;
// }
// if direction != Vec3::ZERO {
// let forward = transform.forward(); // -z
// let right = transform.right(); //
// let movement = (forward * direction.z + right * direction.x).normalize() * cam.speed;
// transform.translation += movement;
// }
// }
// }