From b096fc598adf86961df876ced1f7d146e800c00f Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Tue, 21 Nov 2023 16:14:15 +0100 Subject: [PATCH 1/6] use new cargo.toml lint configs --- Cargo.toml | 3 +++ src/lib.rs | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 45a0d18..6c3ac68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,3 +44,6 @@ default = ["xr"] [lib] name = "osmeta" crate-type = ["staticlib", "cdylib", "lib"] + +[lints.clippy] +type_complexity = "allow" diff --git a/src/lib.rs b/src/lib.rs index 823caf1..c7bb497 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,5 @@ //! Loads and renders a glTF file as a scene. -#![allow(clippy::type_complexity)] - use bevy::prelude::*; #[cfg(all(feature = "xr", not(target_os = "macos")))] use bevy_oxr::xr_input::trackers::OpenXRTrackingRoot; From e9da19b5fe88bbc323364a4519c680546b54e1a1 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Tue, 21 Nov 2023 20:07:03 +0100 Subject: [PATCH 2/6] Use ivec2 instead of tuples of i32 --- src/tilemap.rs | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/tilemap.rs b/src/tilemap.rs index 81b5adb..85fb158 100644 --- a/src/tilemap.rs +++ b/src/tilemap.rs @@ -7,9 +7,9 @@ pub struct TileMap { /// All currently loaded tiles. tiles: BTreeMap>, /// fifo queue of tiles to be loaded. - to_load: VecDeque<(i32, i32)>, + to_load: VecDeque, /// The tile currently being loaded. - loading: Option<(i32, i32, Handle)>, + loading: Option<(IVec2, Handle)>, /// Dummy square to show while a scene is loading dummy: Handle, } @@ -21,11 +21,12 @@ impl TileMap { pub const TILE_SIZE: f32 = TILE_SIZE as f32 / 10.0; pub fn load_nearest(&mut self, tilemap_id: Entity, commands: &mut Commands, pos: Vec3) { - let x = pos.x / Self::TILE_SIZE; - let y = pos.z / Self::TILE_SIZE; + let pos = pos.xz() / Self::TILE_SIZE; + let pos = pos.as_ivec2(); for x_i in -1..=1 { for y_i in -1..=1 { - self.load(tilemap_id, commands, x as i32 + x_i, y as i32 + y_i); + let offset = IVec2::new(x_i, y_i); + self.load(tilemap_id, commands, pos + offset); } } } @@ -33,15 +34,15 @@ impl TileMap { /// Queue a tile coordinate for loading. This will load tiles /// in sequence to reduce lag (which would happen if we loaded lots /// of tiles at the same time). - pub fn load(&mut self, tilemap_id: Entity, commands: &mut Commands, x: i32, y: i32) { + pub fn load(&mut self, tilemap_id: Entity, commands: &mut Commands, pos: IVec2) { self.tiles - .entry(x) + .entry(pos.x) .or_default() - .entry(y) + .entry(pos.y) .or_insert_with(|| { - self.to_load.push_front((x, y)); + self.to_load.push_front(pos); - let transform = Self::test_transform(x, y); + let transform = Self::test_transform(pos); let id = commands .spawn(PbrBundle { @@ -62,18 +63,18 @@ impl TileMap { ) { for (id, mut tilemap) in &mut tilemap { // check if the currently loading tile is done - if let Some((x, y, scene)) = tilemap.loading.take() { + if let Some((pos, scene)) = tilemap.loading.take() { use bevy::asset::LoadState::*; match server.get_load_state(&scene).unwrap() { NotLoaded | Loading => { - tilemap.loading = Some((x, y, scene)); + tilemap.loading = Some((pos, scene)); return; } Loaded => { // Done, remove dummy tile and insert the real one - let entity = tilemap.tiles.entry(x).or_default().get_mut(&y).unwrap(); + let entity = tilemap.tiles.entry(pos.x).or_default().get_mut(&pos.y).unwrap(); - let transform = Self::test_transform(x, y); + let transform = Self::test_transform(pos); let tile = commands .spawn(( SceneBundle { @@ -89,21 +90,21 @@ impl TileMap { commands.entity(dummy).despawn(); } Failed => { - error!("failed to load tile {x},{y}"); + error!("failed to load tile {pos}"); } } } assert!(tilemap.loading.is_none()); // Check if there are more tiles to load - let Some((x, y)) = tilemap.to_load.pop_back() else { + let Some(pos) = tilemap.to_load.pop_back() else { return; }; // https://gltiles.osm2world.org/glb/lod1/15/17388/11332.glb#Scene0" - let name: String = format!("models/{}_{}.glb#Scene0", x, y); + let name: String = format!("models/{}_{}.glb#Scene0", pos.x, pos.y); // Start loading next tile - tilemap.loading = Some((x, y, server.load(name))); // "models/17430_11371.glb#Scene0" + tilemap.loading = Some((pos, server.load(name))); // "models/17430_11371.glb#Scene0" } } @@ -125,8 +126,9 @@ impl TileMap { } } - fn test_transform(x: i32, y: i32) -> Transform { + fn test_transform(pos: IVec2) -> Transform { + let pos = pos.as_vec2() * Self::TILE_SIZE; // OSM y => GPU z - Transform::from_xyz(x as f32 * Self::TILE_SIZE, 0., y as f32 * Self::TILE_SIZE) + Transform::from_xyz(pos.x, 0., pos.y) } } From 66b1a177690934b3213215dfad620bc490f54f37 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Tue, 21 Nov 2023 21:47:50 +0100 Subject: [PATCH 3/6] always load the next tile depending on the current player position before we queued all tiles from the player position and enqueued the latest tiles after those were loaded --- src/lib.rs | 12 ++++++-- src/tilemap.rs | 75 ++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 64 insertions(+), 23 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c7bb497..f0a5aaa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,7 +27,7 @@ pub fn main() { .add_plugins(sun::Plugin) .add_plugins(flycam::Plugin) .add_systems(Startup, setup) - .add_systems(Update, (update_active_tile_zone, TileMap::update)) + .add_systems(Update, (load_next_tile, TileMap::update)) .run(); } @@ -58,8 +58,9 @@ pub struct LocalPlayer; /// to access the OpenXRTrackingRoot, but that doesn't exist without the xr feature type OpenXRTrackingRoot = LocalPlayer; -fn update_active_tile_zone( +fn load_next_tile( mut commands: Commands, + server: Res, mut tilemap: Query< (Entity, &mut TileMap, &Transform), (Without, Without), @@ -68,6 +69,11 @@ fn update_active_tile_zone( ) { let (id, mut tilemap, transform) = tilemap.single_mut(); for pos in player_pos.iter() { - tilemap.load_nearest(id, &mut commands, pos.translation - transform.translation); + tilemap.load_next( + id, + &mut commands, + &server, + pos.translation - transform.translation, + ); } } diff --git a/src/tilemap.rs b/src/tilemap.rs index 85fb158..bd19337 100644 --- a/src/tilemap.rs +++ b/src/tilemap.rs @@ -1,4 +1,4 @@ -use std::collections::{BTreeMap, VecDeque}; +use std::collections::BTreeMap; use bevy::prelude::*; @@ -6,8 +6,6 @@ use bevy::prelude::*; pub struct TileMap { /// All currently loaded tiles. tiles: BTreeMap>, - /// fifo queue of tiles to be loaded. - to_load: VecDeque, /// The tile currently being loaded. loading: Option<(IVec2, Handle)>, /// Dummy square to show while a scene is loading @@ -20,28 +18,69 @@ pub struct Tile; impl TileMap { pub const TILE_SIZE: f32 = TILE_SIZE as f32 / 10.0; - pub fn load_nearest(&mut self, tilemap_id: Entity, commands: &mut Commands, pos: Vec3) { - let pos = pos.xz() / Self::TILE_SIZE; - let pos = pos.as_ivec2(); + pub fn load_next( + &mut self, + tilemap_id: Entity, + commands: &mut Commands, + server: &AssetServer, + origin: Vec3, + ) { + let origin = origin.xz() / Self::TILE_SIZE; + let origin = origin.as_ivec2(); + let mut best_score = f32::INFINITY; + let mut best_pos = None; for x_i in -1..=1 { for y_i in -1..=1 { let offset = IVec2::new(x_i, y_i); - self.load(tilemap_id, commands, pos + offset); + let score = self.get_view_tile_score(origin, offset); + if score < best_score { + best_pos = Some(origin + offset); + best_score = score; + } } } + if let Some(best_pos) = best_pos { + self.load(tilemap_id, commands, server, best_pos); + } + } + + /// Takes an offset to the player position and returns a score for how important + /// to load it is. Lower values are better. + // FIXME(#18): use a smarter algorithm + pub fn get_view_tile_score(&self, pos: IVec2, offset: IVec2) -> f32 { + if let Some(line) = self.tiles.get(&(pos.x + offset.x)) { + if line.get(&(pos.y + offset.y)).is_some() { + return f32::INFINITY; + } + } + offset.as_vec2().length_squared() } /// Queue a tile coordinate for loading. This will load tiles /// in sequence to reduce lag (which would happen if we loaded lots /// of tiles at the same time). - pub fn load(&mut self, tilemap_id: Entity, commands: &mut Commands, pos: IVec2) { + /// Silently does nothing if the tile was already loaded or is in the process of loading. + /// Silently does nothing if another tile is already being loaded. + pub fn load( + &mut self, + tilemap_id: Entity, + commands: &mut Commands, + server: &AssetServer, + pos: IVec2, + ) { + if self.loading.is_some() { + return; + } + // https://gltiles.osm2world.org/glb/lod1/15/17388/11332.glb#Scene0" + let name: String = format!("models/{}_{}.glb#Scene0", pos.x, pos.y); + // Start loading next tile + self.loading = Some((pos, server.load(name))); // "models/17430_11371.glb#Scene0" + // Insert dummy tile while loading. self.tiles .entry(pos.x) .or_default() .entry(pos.y) .or_insert_with(|| { - self.to_load.push_front(pos); - let transform = Self::test_transform(pos); let id = commands @@ -72,7 +111,12 @@ impl TileMap { } Loaded => { // Done, remove dummy tile and insert the real one - let entity = tilemap.tiles.entry(pos.x).or_default().get_mut(&pos.y).unwrap(); + let entity = tilemap + .tiles + .entry(pos.x) + .or_default() + .get_mut(&pos.y) + .unwrap(); let transform = Self::test_transform(pos); let tile = commands @@ -96,15 +140,6 @@ impl TileMap { } assert!(tilemap.loading.is_none()); - // Check if there are more tiles to load - let Some(pos) = tilemap.to_load.pop_back() else { - return; - }; - - // https://gltiles.osm2world.org/glb/lod1/15/17388/11332.glb#Scene0" - let name: String = format!("models/{}_{}.glb#Scene0", pos.x, pos.y); - // Start loading next tile - tilemap.loading = Some((pos, server.load(name))); // "models/17430_11371.glb#Scene0" } } From 1e243c910122ac3ebaaaf425ae1011535be822c9 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Tue, 21 Nov 2023 21:57:31 +0100 Subject: [PATCH 4/6] The floating point imprecision hackery needs fixing at some point --- src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index f0a5aaa..047391f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -73,6 +73,8 @@ fn load_next_tile( id, &mut commands, &server, + // FIXME: Maybe use https://crates.io/crates/big_space in order to be able to remove + // the translation from the tilemap and instead just use its real coordinates. pos.translation - transform.translation, ); } From db41eee659819092d77ed764c7599f6f1eae85f2 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Wed, 22 Nov 2023 10:29:41 +0100 Subject: [PATCH 5/6] load tiles from the web --- Cargo.lock | 1198 +++++++++++++++++++++++++++++++++++++++++++++++- Cargo.toml | 3 +- src/gz.rs | 64 +++ src/lib.rs | 11 + src/tilemap.rs | 43 +- 5 files changed, 1287 insertions(+), 32 deletions(-) create mode 100644 src/gz.rs diff --git a/Cargo.lock b/Cargo.lock index 79a35fa..cf971fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -86,6 +86,60 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aead" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" +dependencies = [ + "generic-array", +] + +[[package]] +name = "aes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" +dependencies = [ + "aes-soft", + "aesni", + "cipher", +] + +[[package]] +name = "aes-gcm" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5278b5fabbb9bd46e24aa69b2fdea62c99088e0a950a9be40e3e0101298f88da" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + +[[package]] +name = "aes-soft" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" +dependencies = [ + "cipher", + "opaque-debug", +] + +[[package]] +name = "aesni" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" +dependencies = [ + "cipher", + "opaque-debug", +] + [[package]] name = "ahash" version = "0.8.6" @@ -93,7 +147,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", - "getrandom", + "getrandom 0.2.11", "once_cell", "version_check", "zerocopy", @@ -196,6 +250,12 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + [[package]] name = "arrayvec" version = "0.7.4" @@ -245,6 +305,16 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "async-dup" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7427a12b8dc09291528cfb1da2447059adb4a257388c2acd6497a79d55cf6f7c" +dependencies = [ + "futures-io", + "simple-mutex", +] + [[package]] name = "async-executor" version = "1.7.2" @@ -271,6 +341,58 @@ dependencies = [ "futures-lite 1.13.0", ] +[[package]] +name = "async-global-executor" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" +dependencies = [ + "async-channel 1.9.0", + "async-executor", + "async-io", + "async-lock 2.8.0", + "blocking", + "futures-lite 1.13.0", + "once_cell", +] + +[[package]] +name = "async-h1" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d1d1dae8cb2c4258a79d6ed088b7fb9b4763bf4e9b22d040779761e046a2971" +dependencies = [ + "async-channel 1.9.0", + "async-dup", + "async-global-executor", + "async-io", + "futures-lite 1.13.0", + "http-types", + "httparse", + "log", + "pin-project", +] + +[[package]] +name = "async-io" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" +dependencies = [ + "async-lock 2.8.0", + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-lite 1.13.0", + "log", + "parking", + "polling", + "rustix", + "slab", + "socket2", + "waker-fn", +] + [[package]] name = "async-lock" version = "2.8.0" @@ -291,12 +413,62 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "async-std" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" +dependencies = [ + "async-channel 1.9.0", + "async-global-executor", + "async-io", + "async-lock 2.8.0", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite 1.13.0", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "once_cell", + "pin-project-lite", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + [[package]] name = "async-task" version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4eb2cdb97421e01129ccb49169d8279ed21e829929144f4a22a6e54ac549ca1" +[[package]] +name = "async-tls" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d85a97c4a0ecce878efd3f945f119c78a646d8975340bca0398f9bb05c30cc52" +dependencies = [ + "futures-core", + "futures-io", + "rustls", + "webpki", + "webpki-roots", +] + +[[package]] +name = "async-trait" +version = "0.1.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + [[package]] name = "atomic-waker" version = "1.1.2" @@ -324,6 +496,18 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base-x" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + [[package]] name = "base64" version = "0.13.1" @@ -649,6 +833,16 @@ dependencies = [ "smallvec", ] +[[package]] +name = "bevy_http" +version = "0.2.0" +source = "git+https://github.com/oli-obk/bevy_http.git#9d6fe006191e21e4b9fba90ff7b2d12b93c8e998" +dependencies = [ + "bevy", + "futures-core", + "surf", +] + [[package]] name = "bevy_input" version = "0.12.0" @@ -1036,7 +1230,7 @@ checksum = "c8e75d4a34ef0b15dffd1ee9079ef1f0f5139527e192b9d5708b3e158777c753" dependencies = [ "ahash", "bevy_utils_proc_macros", - "getrandom", + "getrandom 0.2.11", "hashbrown 0.14.2", "instant", "nonmax", @@ -1155,7 +1349,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" dependencies = [ "arrayref", - "arrayvec", + "arrayvec 0.7.4", "cc", "cfg-if", "constant_time_eq", @@ -1167,6 +1361,15 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + [[package]] name = "block-sys" version = "0.1.0-beta.1" @@ -1262,7 +1465,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" dependencies = [ - "nom", + "nom 7.1.3", ] [[package]] @@ -1277,6 +1480,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" +[[package]] +name = "cipher" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +dependencies = [ + "generic-array", +] + [[package]] name = "clang-sys" version = "1.6.1" @@ -1338,6 +1550,17 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "config" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b076e143e1d9538dde65da30f8481c2a6c44040edb8e02b9bf1351edb92ce3" +dependencies = [ + "lazy_static", + "nom 5.1.3", + "serde", +] + [[package]] name = "console_error_panic_hook" version = "0.1.7" @@ -1348,6 +1571,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "const_fn" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" + [[package]] name = "const_panic" version = "0.2.8" @@ -1375,6 +1604,23 @@ dependencies = [ "const_soft_float", ] +[[package]] +name = "cookie" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03a5d7b21829bc7b4bf4754a978a241ae54ea55a40f92bb20216e54096f4b951" +dependencies = [ + "aes-gcm", + "base64 0.13.1", + "hkdf", + "hmac", + "percent-encoding", + "rand 0.8.5", + "sha2", + "time", + "version_check", +] + [[package]] name = "core-foundation" version = "0.9.3" @@ -1460,6 +1706,21 @@ dependencies = [ "windows 0.46.0", ] +[[package]] +name = "cpufeatures" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +dependencies = [ + "libc", +] + +[[package]] +name = "cpuid-bool" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" + [[package]] name = "crc32fast" version = "1.3.2" @@ -1479,6 +1740,16 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.16" @@ -1488,6 +1759,25 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crypto-mac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "ctr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" +dependencies = [ + "cipher", +] + [[package]] name = "d3d12" version = "0.7.0" @@ -1499,6 +1789,19 @@ dependencies = [ "winapi", ] +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown 0.14.2", + "lock_api", + "once_cell", + "parking_lot_core", +] + [[package]] name = "dasp_sample" version = "0.11.0" @@ -1511,6 +1814,35 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +[[package]] +name = "deadpool" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d126179d86aee4556e54f5f3c6bf6d9884e7cc52cef82f77ee6f90a7747616d" +dependencies = [ + "async-trait", + "config", + "crossbeam-queue", + "num_cpus", + "serde", + "tokio", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" + [[package]] name = "dispatch" version = "0.2.0" @@ -1570,6 +1902,16 @@ dependencies = [ "serde", ] +[[package]] +name = "errno" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "euclid" version = "0.22.9" @@ -1694,12 +2036,57 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" +[[package]] +name = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +dependencies = [ + "futures-core", + "futures-sink", +] + [[package]] name = "futures-core" version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +[[package]] +name = "futures-executor" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + [[package]] name = "futures-io" version = "0.3.29" @@ -1736,18 +2123,90 @@ dependencies = [ ] [[package]] -name = "getrandom" -version = "0.2.11" +name = "futures-macro" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi", - "wasm-bindgen", -] - + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "futures-sink" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" + +[[package]] +name = "futures-task" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" + +[[package]] +name = "futures-util" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "ghash" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97304e4cd182c3846f7575ced3890c53012ce534ad9114046b0a9e00bb30a375" +dependencies = [ + "opaque-debug", + "polyval", +] + [[package]] name = "gilrs" version = "0.10.3" @@ -1804,6 +2263,18 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "glow" version = "0.12.3" @@ -1962,6 +2433,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + [[package]] name = "hexasphere" version = "9.1.0" @@ -1978,6 +2455,83 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" +[[package]] +name = "hkdf" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51ab2f639c231793c5f6114bdb9bbe50a7dbbfcd7c7c6bd8475dec2d991e964f" +dependencies = [ + "digest", + "hmac", +] + +[[package]] +name = "hmac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" +dependencies = [ + "crypto-mac", + "digest", +] + +[[package]] +name = "http-client" +version = "6.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1947510dc91e2bf586ea5ffb412caad7673264e14bb39fb9078da114a94ce1a5" +dependencies = [ + "async-h1", + "async-std", + "async-tls", + "async-trait", + "cfg-if", + "dashmap", + "deadpool", + "futures", + "http-types", + "log", + "rustls", +] + +[[package]] +name = "http-types" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9b187a72d63adbfba487f48095306ac823049cb504ee195541e91c7775f5ad" +dependencies = [ + "anyhow", + "async-channel 1.9.0", + "async-std", + "base64 0.13.1", + "cookie", + "futures-lite 1.13.0", + "infer", + "pin-project-lite", + "rand 0.7.3", + "serde", + "serde_json", + "serde_qs", + "serde_urlencoded", + "url", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "image" version = "0.24.7" @@ -2013,6 +2567,12 @@ dependencies = [ "hashbrown 0.14.2", ] +[[package]] +name = "infer" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e9829a50b42bb782c1df523f78d332fe371b10c661e78b7a3c34b0198e9fac" + [[package]] name = "inflections" version = "1.1.1" @@ -2061,6 +2621,17 @@ dependencies = [ "mach2", ] +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "itoa" version = "1.0.9" @@ -2145,6 +2716,15 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -2168,6 +2748,19 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "lexical-core" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" +dependencies = [ + "arrayvec 0.5.2", + "bitflags 1.3.2", + "cfg-if", + "ryu", + "static_assertions", +] + [[package]] name = "libc" version = "0.2.150" @@ -2215,6 +2808,12 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + [[package]] name = "lock_api" version = "0.4.11" @@ -2230,6 +2829,9 @@ name = "log" version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +dependencies = [ + "value-bag", +] [[package]] name = "mach2" @@ -2279,6 +2881,22 @@ dependencies = [ "paste", ] +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -2309,7 +2927,7 @@ checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "log", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.48.0", ] @@ -2405,6 +3023,17 @@ dependencies = [ "libc", ] +[[package]] +name = "nom" +version = "5.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08959a387a676302eebf4ddbcbc611da04285579f76f88ee0506c63b1a61dd4b" +dependencies = [ + "lexical-core", + "memchr", + "version_check", +] + [[package]] name = "nom" version = "7.1.3" @@ -2481,6 +3110,16 @@ dependencies = [ "autocfg", ] +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + [[package]] name = "num_enum" version = "0.5.11" @@ -2615,6 +3254,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + [[package]] name = "openxr" version = "0.17.1" @@ -2654,7 +3299,9 @@ version = "0.1.0" dependencies = [ "bevy", "bevy_flycam", + "bevy_http", "bevy_oxr", + "flate2", "glam", ] @@ -2730,12 +3377,38 @@ dependencies = [ "indexmap 2.1.0", ] +[[package]] +name = "pin-project" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + [[package]] name = "pin-project-lite" version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "piper" version = "0.2.1" @@ -2766,6 +3439,33 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "polling" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if", + "concurrent-queue", + "libc", + "log", + "pin-project-lite", + "windows-sys 0.48.0", +] + +[[package]] +name = "polyval" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eebcc4aa140b9abd2bc40d9c3f7ccec842679cd79045ac3a7ac698c1a064b7cd" +dependencies = [ + "cpuid-bool", + "opaque-debug", + "universal-hash", +] + [[package]] name = "pp-rs" version = "0.2.1" @@ -2775,6 +3475,12 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -2785,6 +3491,12 @@ dependencies = [ "toml_edit 0.19.15", ] +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + [[package]] name = "proc-macro2" version = "1.0.69" @@ -2815,6 +3527,77 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17fd96390ed3feda12e1dfe2645ed587e0bea749e319333f104a33ff62f77a0b" +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.11", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + [[package]] name = "range-alloc" version = "0.1.3" @@ -2907,6 +3690,21 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "216080ab382b992234dda86873c18d4c48358f5cfcb70fd693d7f6f2131b628b" +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + [[package]] name = "rodio" version = "0.17.3" @@ -2941,6 +3739,42 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.37.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustls" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d1126dcf58e93cee7d098dbda643b5f92ed724f1f6a63007c1116eed6700c81" +dependencies = [ + "base64 0.12.3", + "log", + "ring", + "sct", + "webpki", +] + [[package]] name = "ruzstd" version = "0.4.0" @@ -2973,6 +3807,31 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sct" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "serde" version = "1.0.192" @@ -3004,6 +3863,57 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_qs" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7715380eec75f029a4ef7de39a9200e0a63823176b759d055b613f5a87df6a6" +dependencies = [ + "percent-encoding", + "serde", + "thiserror", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770" +dependencies = [ + "sha1_smol", +] + +[[package]] +name = "sha1_smol" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer", + "cfg-if", + "cpufeatures", + "digest", + "opaque-debug", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -3025,6 +3935,15 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" +[[package]] +name = "simple-mutex" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38aabbeafa6f6dead8cebf246fe9fae1f9215c8d29b3a69f93bd62a9e4a3dcd6" +dependencies = [ + "event-listener 2.5.3", +] + [[package]] name = "slab" version = "0.4.9" @@ -3061,6 +3980,22 @@ dependencies = [ "serde", ] +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + [[package]] name = "spirv" version = "0.2.0+1.5.4" @@ -3071,12 +4006,98 @@ dependencies = [ "num-traits", ] +[[package]] +name = "standback" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" +dependencies = [ + "version_check", +] + [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "stdweb" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +dependencies = [ + "discard", + "rustc_version", + "stdweb-derive", + "stdweb-internal-macros", + "stdweb-internal-runtime", + "wasm-bindgen", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_derive", + "syn 1.0.109", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +dependencies = [ + "base-x", + "proc-macro2", + "quote", + "serde", + "serde_derive", + "serde_json", + "sha1", + "syn 1.0.109", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "surf" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "718b1ae6b50351982dedff021db0def601677f2120938b070eadb10ba4038dd7" +dependencies = [ + "async-std", + "async-trait", + "cfg-if", + "futures-util", + "getrandom 0.2.11", + "http-client", + "http-types", + "log", + "mime_guess", + "once_cell", + "pin-project-lite", + "rustls", + "serde", + "serde_json", +] + [[package]] name = "svg_fmt" version = "0.4.1" @@ -3125,7 +4146,7 @@ version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c2287b6d7f721ada4cddf61ade5e760b2c6207df041cac9bfaa192897362fd3" dependencies = [ - "arrayvec", + "arrayvec 0.7.4", "grid", "num-traits", "slotmap", @@ -3190,6 +4211,44 @@ dependencies = [ "once_cell", ] +[[package]] +name = "time" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" +dependencies = [ + "const_fn", + "libc", + "standback", + "stdweb", + "time-macros", + "version_check", + "winapi", +] + +[[package]] +name = "time-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" +dependencies = [ + "proc-macro-hack", + "time-macros-impl", +] + +[[package]] +name = "time-macros-impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "standback", + "syn 1.0.109", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -3205,6 +4264,16 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "tokio" +version = "1.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +dependencies = [ + "backtrace", + "pin-project-lite", +] + [[package]] name = "toml_datetime" version = "0.6.5" @@ -3332,12 +4401,42 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicase" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-width" version = "0.1.11" @@ -3350,13 +4449,41 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "universal-hash" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + [[package]] name = "uuid" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" dependencies = [ - "getrandom", + "getrandom 0.2.11", "serde", ] @@ -3366,6 +4493,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "value-bag" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a72e1902dde2bd6441347de2b70b7f5d59bf157c6c62f0c44572607a1d55bbe" + [[package]] name = "vec_map" version = "0.8.2" @@ -3394,6 +4527,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -3487,13 +4626,32 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki" +version = "0.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f20dea7535251981a9670857150d571846545088359b28e4951d350bdaf179f" +dependencies = [ + "webpki", +] + [[package]] name = "wgpu" version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "752e44d3998ef35f71830dd1ad3da513e628e2e4d4aedb0ab580f850827a0b41" dependencies = [ - "arrayvec", + "arrayvec 0.7.4", "cfg-if", "js-sys", "log", @@ -3517,7 +4675,7 @@ version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f8a44dd301a30ceeed3c27d8c0090433d3da04d7b2a4042738095a424d12ae7" dependencies = [ - "arrayvec", + "arrayvec 0.7.4", "bit-vec", "bitflags 2.4.1", "codespan-reporting", @@ -3541,7 +4699,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a80bf0e3c77399bb52850cb0830af9bad073d5cfcb9dd8253bef8125c42db17" dependencies = [ "android_system_properties", - "arrayvec", + "arrayvec 0.7.4", "ash", "bit-set", "bitflags 2.4.1", diff --git a/Cargo.toml b/Cargo.toml index 6c3ac68..ff82013 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,10 +19,11 @@ bevy = { version = "0.12", features = [ "jpeg", ] } ## NOT the local file bevy, the one from the net bevy_flycam = { git = "https://github.com/sburris0/bevy_flycam" } ## control +bevy_http = { git = "https://github.com/oli-obk/bevy_http.git" } +flate2 = "1.0.28" ## bevy_config_cam = { git = "https://github.com/BlackPhlox/bevy_config_cam" } ## { version = "0.3.0"} glam = "0" - [target.'cfg(not(target_os="macos"))'.dependencies] bevy_oxr = { git = "https://github.com/awtterpip/bevy_openxr", optional = true } diff --git a/src/gz.rs b/src/gz.rs new file mode 100644 index 0000000..763a0f2 --- /dev/null +++ b/src/gz.rs @@ -0,0 +1,64 @@ +//! Implements loader for a Gzip compressed asset. +// Adjusted from the example at https://github.com/bevyengine/bevy/blob/208ecb53dc5aed4baefc5ca5dc73bfdfee16a6e6/examples/asset/asset_decompression.rs + +use bevy::gltf::{Gltf, GltfError, GltfLoader}; +use bevy::{ + asset::{ + io::{Reader, VecReader}, + AssetLoader, AsyncReadExt, ErasedLoadedAsset, LoadContext, + }, + prelude::*, + reflect::TypePath, + utils::BoxedFuture, +}; +use flate2::read::GzDecoder; +use std::io::prelude::*; + +#[derive(Asset, TypePath)] +pub struct GzAsset { + pub uncompressed: ErasedLoadedAsset, +} + +#[derive(Default)] +pub struct GzAssetLoader; + +impl AssetLoader for GzAssetLoader { + type Asset = Gltf; + type Settings = (); + type Error = GltfError; + fn load<'a>( + &'a self, + reader: &'a mut Reader, + settings: &'a (), + load_context: &'a mut LoadContext, + ) -> BoxedFuture<'a, Result> { + Box::pin(async move { + let mut bytes_compressed = Vec::new(); + warn!("decompressing glb.gz file"); + + reader.read_to_end(&mut bytes_compressed).await?; + + let mut decoder = GzDecoder::new(bytes_compressed.as_slice()); + + let mut bytes_uncompressed = Vec::new(); + + decoder.read_to_end(&mut bytes_uncompressed)?; + + // Now that we have decompressed the asset, let's pass it back to the + // context to continue loading + + let mut reader = VecReader::new(bytes_uncompressed); + + GltfLoader { + supported_compressed_formats: default(), + custom_vertex_attributes: default(), + } + .load(&mut reader, settings, load_context) + .await + }) + } + + fn extensions(&self) -> &[&str] { + &["glb.gz"] + } +} diff --git a/src/lib.rs b/src/lib.rs index 047391f..79269b8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,12 +1,15 @@ //! Loads and renders a glTF file as a scene. use bevy::prelude::*; +use bevy_http::HttpAssetReaderPlugin; #[cfg(all(feature = "xr", not(target_os = "macos")))] use bevy_oxr::xr_input::trackers::OpenXRTrackingRoot; +use gz::{GzAsset, GzAssetLoader}; type TileMap = tilemap::TileMap<8145>; mod flycam; +mod gz; mod sun; mod tilemap; #[cfg(all(feature = "xr", not(target_os = "macos")))] @@ -14,13 +17,21 @@ mod xr; #[bevy_main] pub fn main() { + std::env::set_var("RUST_BACKTRACE", "1"); let mut app = App::new(); + app.add_plugins(HttpAssetReaderPlugin { + id: "osm2world".into(), + base_url: "https://gltiles.osm2world.org/glb/lod1/15/".into(), + fake_slash: "NOT_A_DIR_SEPARATOR".into(), + }); if std::env::args().any(|arg| arg == "xr") { #[cfg(all(feature = "xr", not(target_os = "macos")))] app.add_plugins(xr::Plugin); } else { app.add_plugins(DefaultPlugins); } + app.init_asset::() + .init_asset_loader::(); app.insert_resource(Msaa::Sample4) // Msaa::Sample4 Msaa::default() -- Todo: tut nichts? .add_plugins(bevy::diagnostic::LogDiagnosticsPlugin::default()) .add_plugins(bevy::diagnostic::FrameTimeDiagnosticsPlugin) diff --git a/src/tilemap.rs b/src/tilemap.rs index bd19337..181d80f 100644 --- a/src/tilemap.rs +++ b/src/tilemap.rs @@ -1,13 +1,18 @@ use std::collections::BTreeMap; -use bevy::prelude::*; +use bevy::{gltf::Gltf, prelude::*}; + +enum LoadSource { + Local, + Network, +} #[derive(Component, Default)] pub struct TileMap { /// All currently loaded tiles. tiles: BTreeMap>, /// The tile currently being loaded. - loading: Option<(IVec2, Handle)>, + loading: Option<(IVec2, Handle, LoadSource)>, /// Dummy square to show while a scene is loading dummy: Handle, } @@ -72,10 +77,10 @@ impl TileMap { return; } // https://gltiles.osm2world.org/glb/lod1/15/17388/11332.glb#Scene0" - let name: String = format!("models/{}_{}.glb#Scene0", pos.x, pos.y); + let name: String = format!("{}_{}.glb", pos.x, pos.y); // Start loading next tile - self.loading = Some((pos, server.load(name))); // "models/17430_11371.glb#Scene0" - // Insert dummy tile while loading. + self.loading = Some((pos, server.load(name), LoadSource::Local)); // "models/17430_11371.glb#Scene0" + // Insert dummy tile while loading. self.tiles .entry(pos.x) .or_default() @@ -98,16 +103,16 @@ impl TileMap { pub fn update( mut commands: Commands, server: Res, + scenes: Res>, mut tilemap: Query<(Entity, &mut Self)>, ) { for (id, mut tilemap) in &mut tilemap { // check if the currently loading tile is done - if let Some((pos, scene)) = tilemap.loading.take() { + if let Some((pos, scene, source)) = tilemap.loading.take() { use bevy::asset::LoadState::*; match server.get_load_state(&scene).unwrap() { NotLoaded | Loading => { - tilemap.loading = Some((pos, scene)); - return; + tilemap.loading = Some((pos, scene, source)); } Loaded => { // Done, remove dummy tile and insert the real one @@ -119,6 +124,7 @@ impl TileMap { .unwrap(); let transform = Self::test_transform(pos); + let scene = scenes.get(scene).unwrap().scenes[0].clone(); let tile = commands .spawn(( SceneBundle { @@ -134,12 +140,27 @@ impl TileMap { commands.entity(dummy).despawn(); } Failed => { - error!("failed to load tile {pos}"); + match source { + LoadSource::Local => { + warn!("failed to load tile {pos} from disk, trying to load from network"); + // FIXME: this `/` between the x and y coordinates causes bevy to think it + // needs to load textures from `assets/XCOORDINATE/textures` instead of + // `assets/textures`. Thus we are using the `NOT_A_DIR_SEPARATOR` hack that + // rewrites this string to a slash just before accessing the network. + // Bevy never sees it. + let scene = server.load(format!( + "osm2world://{}NOT_A_DIR_SEPARATOR{}.glb.gz", + pos.x, pos.y + )); + tilemap.loading = Some((pos, scene, LoadSource::Network)); + } + LoadSource::Network => { + error!("failed to load tile {pos} from network"); + } + } } } } - - assert!(tilemap.loading.is_none()); } } From b26671481ae076b220acfa599a35cc7b8c9b6ade Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Wed, 22 Nov 2023 12:18:24 +0100 Subject: [PATCH 6/6] add fixme --- src/tilemap.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tilemap.rs b/src/tilemap.rs index 181d80f..98d495a 100644 --- a/src/tilemap.rs +++ b/src/tilemap.rs @@ -115,6 +115,9 @@ impl TileMap { tilemap.loading = Some((pos, scene, source)); } Loaded => { + // FIXME: implement caching of downloaded assets by implementing something like + // https://github.com/bevyengine/bevy/blob/main/examples/asset/processing/asset_processing.rs + // Done, remove dummy tile and insert the real one let entity = tilemap .tiles