diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..287f081 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +assets/** filter=lfs diff=lfs merge=lfs -text diff --git a/Cargo.lock b/Cargo.lock index ea4ae43..a19f49d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1808,6 +1808,19 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "chrono" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-link 0.2.1", +] + [[package]] name = "clang-sys" version = "1.8.1" @@ -1860,6 +1873,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "console_log" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be8aed40e4edbf4d3b4431ab260b63fdc40f5780a4766824329ea0f1eefe3c0f" +dependencies = [ + "log", + "web-sys", +] + [[package]] name = "const-fnv1a-hash" version = "1.1.0" @@ -2798,6 +2821,30 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core 0.62.2", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "id-arena" version = "2.3.0" @@ -2815,6 +2862,8 @@ dependencies = [ "moxcms", "num-traits", "png", + "zune-core", + "zune-jpeg", ] [[package]] @@ -2888,6 +2937,16 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" +[[package]] +name = "iyes_perf_ui" +version = "0.5.0" +source = "git+https://github.com/blip-radar/iyes_perf_ui?branch=bevy-0-18#1861c5c5b2ed5ed3c668095b1a0c4b0d14216fd6" +dependencies = [ + "bevy", + "chrono", + "num-traits", +] + [[package]] name = "jni" version = "0.21.1" @@ -3088,6 +3147,12 @@ dependencies = [ "regex-automata", ] +[[package]] +name = "maybe-owned" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" + [[package]] name = "memchr" version = "2.8.0" @@ -3694,6 +3759,32 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pdfium-render" +version = "0.8.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6553f6604a52b3203db7b4e9d51eb4dd193cf455af9e56d40cab6575b547b679" +dependencies = [ + "bitflags 2.11.0", + "bytemuck", + "bytes", + "chrono", + "console_error_panic_hook", + "console_log", + "image", + "itertools 0.14.0", + "js-sys", + "libloading", + "log", + "maybe-owned", + "once_cell", + "utf16string", + "vecmath", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "percent-encoding" version = "2.3.2" @@ -3750,6 +3841,12 @@ dependencies = [ "futures-io", ] +[[package]] +name = "piston-float" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad78bf43dcf80e8f950c92b84f938a0fc7590b7f6866fbcbeca781609c115590" + [[package]] name = "pkg-config" version = "0.3.32" @@ -4235,6 +4332,8 @@ dependencies = [ "bevy", "bevy_debug_grid", "bevy_panorbit_camera", + "iyes_perf_ui", + "pdfium-render", "thiserror 2.0.18", "tracing", "tracing-subscriber", @@ -4725,6 +4824,15 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "utf16string" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b62a1e85e12d5d712bf47a85f426b73d303e2d00a90de5f3004df3596e9d216" +dependencies = [ + "byteorder", +] + [[package]] name = "uuid" version = "1.21.0" @@ -4760,6 +4868,15 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +[[package]] +name = "vecmath" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956ae1e0d85bca567dee1dcf87fb1ca2e792792f66f87dced8381f99cd91156a" +dependencies = [ + "piston-float", +] + [[package]] name = "version_check" version = "0.9.5" @@ -5894,3 +6011,18 @@ name = "zmij" version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" + +[[package]] +name = "zune-core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb8a0807f7c01457d0379ba880ba6322660448ddebc890ce29bb64da71fb40f9" + +[[package]] +name = "zune-jpeg" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "410e9ecef634c709e3831c2cfdb8d9c32164fae1c67496d5b68fff728eec37fe" +dependencies = [ + "zune-core", +] diff --git a/Cargo.toml b/Cargo.toml index f068d10..64c1c23 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,8 @@ tracing-subscriber = "0.3" bevy = { version = "0.18", features = ["bevy_pbr"] } bevy_debug_grid = "0.9" bevy_panorbit_camera = "0.34" +pdfium-render = "0.8.37" +iyes_perf_ui = { git = "https://github.com/blip-radar/iyes_perf_ui", branch = "bevy-0-18", version = "0.5.0" } [features] wayland = ["bevy/dynamic_linking", "bevy/wayland"] diff --git a/assets/models/ame.glb b/assets/models/ame.glb new file mode 100644 index 0000000..b800d06 --- /dev/null +++ b/assets/models/ame.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e794eea8b5e788e394692e8a87e5ca101b220714e51547cc75eb6d37d579a42e +size 4021460 diff --git a/flake.lock b/flake.lock index b1976b5..69074ed 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "advisory-db": { "flake": false, "locked": { - "lastModified": 1771560015, - "narHash": "sha256-TuZcPFTXgFyDTcs+olpuVquBphW0zrxoBxgZ4WjEXWE=", + "lastModified": 1772086288, + "narHash": "sha256-HvN5rFFpVCab0+VcbmiX6plWX/+EsZGZAkXz5evbh78=", "owner": "rustsec", "repo": "advisory-db", - "rev": "81e3cd7b86b1a2e05c116072de9b61b872a43ae4", + "rev": "519a9e795294d92f3a552cb03829668694e848cd", "type": "github" }, "original": { @@ -18,11 +18,11 @@ }, "crane": { "locked": { - "lastModified": 1771438068, - "narHash": "sha256-nGBbXvEZVe/egCPVPFcu89RFtd8Rf6J+4RFoVCFec0A=", + "lastModified": 1772080396, + "narHash": "sha256-84W9UNtSk9DNMh43WBkOjpkbfODlmg+RDi854PnNgLE=", "owner": "ipetkov", "repo": "crane", - "rev": "b5090e53e9d68c523a4bb9ad42b4737ee6747597", + "rev": "8525580bc0316c39dbfa18bd09a1331e98c9e463", "type": "github" }, "original": { @@ -34,10 +34,10 @@ "crates-io-index": { "flake": false, "locked": { - "lastModified": 1772013874, - "narHash": "sha256-WwDhEeVOnAfH1PKpqHNdGFylmbtmTk5hk7cS+0C6Scg=", + "lastModified": 1772094784, + "narHash": "sha256-qoCVSuQkNHrQujaB2FNY87mEbupT8pDpeTGl/OQdTuc=", "ref": "refs/heads/master", - "rev": "94b5f7911c9131b53988424c964f721a3f22714d", + "rev": "d73de70ac23e25184c765f08104922d36d9d277a", "shallow": true, "type": "git", "url": "https://github.com/rust-lang/crates.io-index" @@ -108,11 +108,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1771369470, - "narHash": "sha256-0NBlEBKkN3lufyvFegY4TYv5mCNHbi5OmBDrzihbBMQ=", + "lastModified": 1771848320, + "narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0182a361324364ae3f436a63005877674cf45efb", + "rev": "2fc6539b481e1d2569f25f8799236694180c0993", "type": "github" }, "original": { @@ -141,11 +141,11 @@ ] }, "locked": { - "lastModified": 1771556776, - "narHash": "sha256-zKprqMQDl3xVfhSSYvgru1IGXjFdxryWk+KqK0I20Xk=", + "lastModified": 1772075164, + "narHash": "sha256-93XcvAt+6p7aAq1ERlxD2T17zLGoYGo64KJYasGcpgc=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "8b3f46b8a6d17ab46e533a5e3d5b1cc2ff228860", + "rev": "07601339b15fa6810541c0e7dc2f3664d92a7ad0", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 1d09b49..fde852b 100644 --- a/flake.nix +++ b/flake.nix @@ -50,7 +50,7 @@ cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml); name = cargoToml.package.name; - toolchain = pkgs.rust-bin.nightly.latest.default.override { + toolchain = pkgs.rust-bin.stable.latest.default.override { targets = ["wasm32-unknown-unknown"]; }; toolchainWithLLvmTools = toolchain.override { diff --git a/index.html b/index.html index 8c2e031..a6280c3 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,7 @@ + diff --git a/justfile b/justfile index f1083b3..216c72d 100644 --- a/justfile +++ b/justfile @@ -1,2 +1,4 @@ +host: + python3 -m http.server --directory dist push: neocities push --prune dist diff --git a/src/main.rs b/src/main.rs index b4b9df0..0abf706 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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>, mut materials: ResMut>, + mut asset_server: ResMut, ) { + 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>, +// mut camera_query: Query<(&mut Transform, &MainCam), With>, +// ) { +// 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; +// } +// } +// }