Crates.io | bevy_water |
lib.rs | bevy_water |
version | 0.14.2 |
source | src |
created_at | 2022-08-21 21:28:28.209591 |
updated_at | 2024-07-08 06:48:25.557745 |
description | Dynamic ocean material for Bevy. |
homepage | https://github.com/Neopallium/bevy_water |
repository | https://github.com/Neopallium/bevy_water |
max_upload_size | |
id | 649964 |
size | 156,111 |
Dynamic water material (with waves) for Bevy.
A fleet of pirate ships moving with the waves.
cargo run --release --example pirates
Dutch ship model from polyhaven (CC0)
See the WebGPU and WebGL versions online here
rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli
Following is an example for pirates
. For other examples, change the pirates
in the
following commands.
WebGPU:
RUSTFLAGS="--cfg=web_sys_unstable_apis" cargo build --release --example pirates \
--target wasm32-unknown-unknown \
--no-default-features --features webgpu,embed_shaders,depth_prepass
echo "wasm-bindgen"
wasm-bindgen --out-name pirates_webgpu \
--out-dir examples/wasm/target \
--target web target/wasm32-unknown-unknown/release/examples/pirates.wasm
echo "Optimize wasm"
wasm-opt --strip-debug --vacuum -Oz \
-o ./examples/wasm/target/pirates_webgpu_bg.wasm ./examples/wasm/target/pirates_webgpu_bg.wasm
WebGL2:
cargo build --release --example pirates --target wasm32-unknown-unknown \
--no-default-features --features webgl2,embed_shaders
echo "wasm-bindgen"
wasm-bindgen --out-name pirates_webgl2 \
--out-dir examples/wasm/target \
--target web target/wasm32-unknown-unknown/release/examples/pirates.wasm
echo "Optimize wasm"
wasm-opt --strip-debug --vacuum -Oz \
-o ./examples/wasm/target/pirates_webgl2_bg.wasm ./examples/wasm/target/pirates_webgl2_bg.wasm
Then serve examples/wasm
directory to browser. i.e.
# cargo install basic-http-server
basic-http-server examples/wasm
get_wave_point
to dynamically move objects based on the water height.bevy_pbr::*
shader for lighting/shadow support.bevy_water = "0.14"
bevy_water = "0.13"
bevy_water = "0.12"
bevy_water = "0.11"
bevy_water = "0.10"
bevy_water = "0.9"
bevy_water = "0.8"