Skip to content

rlamarche/potree-rs

Repository files navigation

Potree file parser in RUST

Features / Roadmap:

  • Load data asynchronously
  • Load (asynchronously) and parse hierarchy (lazy & entire) from filesystem or http
  • Native & WASM compatibility
  • WASM Multithread compatibility (using SharedArrayBuffer and specific http headers)
  • Provide a simple slab implementation to load points progressively
  • Customizable datasource (through PotreeAsset trait)
  • Blocking API (through BlockingPotreeAsset trait)
  • Brotli encoding support
  • Load points

Download sample potree file

Go in the assets/heidentor folder and run dl.sh script:

cd assets/heidentor/
./dl.sh

Run the native examples

Load points from http using ehttp + tokio

This example loads points from an http url source using ehttp client:

cargo run --features="ehttp tokio_dev" --example read_native_ehttp

Load points from http using reqwest + tokio

This example loads points from an http url source using reqwest client:

cargo run --features="reqwest tokio_dev" --example read_native_reqwest

Load points from local filesystem

This example loads points from local filesystem:

cargo run --features="fs tokio_dev" --example read_native_fs

Load points from local filesystem using a slab structure:

This example loads point cloud structure from local filesystem and store it in a slab data structure.

Then, it loads the root node points.

cargo run --features="fs tokio_dev slab" --example read_native_slab

Load points from local filesystem in a blocking way (no async deps)

This example loads points from local filesystem:

cargo run --features="blocking_fs" --example read_native_blocking_fs

Load points from http using reqwest blocking api

This example loads points from local filesystem:

cargo run --features="blocking_reqwest" --example read_native_blocking_http

Build WASM example

This example loads a potree point cloud in the browser in the main thread.

To prevent the worker to terminate and not executing async tasks, the example uses the hack mentionned in this issue: wasm-bindgen/wasm-bindgen#2945.

To build the example, use the provided script: (install the required rust nightly if asked)

./build_wasm.sh

Build WASM multithreaded example

This example uses a webworker for parsing, and delegates the http requests to the main thread (using provided EhttpClientLocal).

To prevent the worker to terminate and not executing async tasks, the example uses the hack mentionned in this issue: wasm-bindgen/wasm-bindgen#2945.

To build the example, use the provided script: (install the required rust nightly if asked)

./build_wasm_worker.sh

Run WASM simple or multithreaded example

Install express and run serve.js:

Note: this server sends the security headers to allow using workers in WASM.

npm install express
node serve.js

Open the browser at address http://localhost:8080/wasm/ and check network / console panels to see the requests / logs.

Open http://localhost:8080/wasm/worker.html for the worker example.

Credits

  • Potree file format has been created by Markus Schütz, see Potree Copyright (c) 2011-2020, Markus Schütz
    Licensed under the BSD 2-Clause License (see THIRD_PARTY_LICENSES.md).

About

Potree file parser in Rust, WASM compatible

Resources

License

Stars

8 stars

Watchers

2 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages