bevy_water

Dynamic water material (with waves) for Bevy.

Example

A fleet of pirate ships moving with the waves.

cargo run --release --example ocean

Pirate ship from asset pack CC0

WASM examples

See the WebGPU and WebGL versions online here

Setup

sh rustup target add wasm32-unknown-unknown cargo install wasm-bindgen-cli

Build & Run

Following is an example for ocean. For other examples, change the ocean in the following commands.

WebGPU: ```sh RUSTFLAGS="--cfg=websysunstableapis" cargo build --release --example ocean \ --target wasm32-unknown-unknown \ --no-default-features --features webgpu,embedshaders,depth_prepass

echo "wasm-bindgen" wasm-bindgen --out-name ocean_webgpu \ --out-dir examples/wasm/target \ --target web target/wasm32-unknown-unknown/release/examples/ocean.wasm

echo "Optimize wasm" wasm-opt --strip-debug --vacuum -Oz \ -o ./examples/wasm/target/oceanwebgpubg.wasm ./examples/wasm/target/oceanwebgpubg.wasm ```

WebGL2: ```sh cargo build --release --example ocean --target wasm32-unknown-unknown \ --no-default-features --features webgl2,embed_shaders

echo "wasm-bindgen" wasm-bindgen --out-name ocean_webgl2 \ --out-dir examples/wasm/target \ --target web target/wasm32-unknown-unknown/release/examples/ocean.wasm

echo "Optimize wasm" wasm-opt --strip-debug --vacuum -Oz \ -o ./examples/wasm/target/oceanwebgl2bg.wasm ./examples/wasm/target/oceanwebgl2bg.wasm ```

Then serve examples/wasm directory to browser. i.e.

```sh

cargo install basic-http-server

basic-http-server examples/wasm ```

Features

Ideas/Improvements

Versions