summaryrefslogtreecommitdiff
path: root/crates/gipfel-core/src/panorama.rs
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-11-10 09:12:35 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-11-10 09:12:35 +0100
commit0b0663e0c9dc664f35ffead3b395ffd2009fd98c (patch)
treef9e10437ebe7e13e527ce1a6a2b456c105bcc5c0 /crates/gipfel-core/src/panorama.rs
parent02546370ec4458eef59a8f636fe05b57961d56ab (diff)
parent31a47fc4393856a0a0380b2fdcf79f9dac72ad56 (diff)
Merge branch 'wasm-spike'
# Conflicts: # crates/gipfel-core/src/metadata.rs
Diffstat (limited to 'crates/gipfel-core/src/panorama.rs')
-rw-r--r--crates/gipfel-core/src/panorama.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/gipfel-core/src/panorama.rs b/crates/gipfel-core/src/panorama.rs
index 1af64bf..b8ce342 100644
--- a/crates/gipfel-core/src/panorama.rs
+++ b/crates/gipfel-core/src/panorama.rs
@@ -74,6 +74,16 @@ impl Panorama {
Ok(())
}
+ /// Like [`Panorama::load_data`] but from raw bytes (no filesystem);
+ /// used by the WASM build.
+ pub fn load_data_from_bytes(&mut self, raw: &[u8]) -> std::io::Result<()> {
+ let mut hills = crate::hill::load_from_bytes(raw)?;
+ crate::hill::mark_duplicates(&mut hills, 0.00001);
+ self.hills = hills;
+ self.update_angles();
+ Ok(())
+ }
+
pub fn add_hills(&mut self, extra: &[Hill]) {
self.hills.extend_from_slice(extra);
crate::hill::mark_duplicates(&mut self.hills, 0.00001);