summaryrefslogtreecommitdiff
path: root/crates/gipfel-core/src/panorama.rs
diff options
context:
space:
mode:
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);