Skip to content

Latest commit

 

History

History
43 lines (38 loc) · 3.18 KB

File metadata and controls

43 lines (38 loc) · 3.18 KB

Wasm-Slime

A 2d fluid simulator implemented with Rust + wasm-bindgen-rayon.

img

Check the demo here! (needs a browser that supports SharedArrayBuffer) : https://fluid-simulation-test.netlify.app/

The following is the brief description of the simulation.

How to run locally

Basically, you can run the simulation locally by running the following commands.

npm install
npm run build
npm run serve

But in some environments, webpack seems to cause some errors (see this issue). In that case, you can build the repo without webpack with the following steps.

  • Change "build" in package.json like below.
    • before: "build": "cross-env RUSTUP_TOOLCHAIN=nightly wasm-pack build --target web && webpack build ./index.js --mode production -o dist --output-filename index.js && shx cp index.html dist/",
    • after: "build": "cross-env RUSTUP_TOOLCHAIN=nightly wasm-pack build --target web",
  • Change the code in Cargo.toml like below.
    • before: wasm-bindgen-rayon = { version = "1.2" }
    • after: wasm-bindgen-rayon = { version = "1.2", features = ["no-bundler"] }
  • Change the code in server.js like below.
    • before: app.use(express.static(__dirname + '/dist/'));
    • after: app.use(express.static(__dirname));
  • Remove the line import { simd } from 'wasm-feature-detect'; in index.js

References