Skip to content

Commit c4d14c9

Browse files
Merge pull request #10 from wowemulation-dev/docs/wasm-readme
docs: advertise WASM support in README files
2 parents ad53eb7 + d42c49a commit c4d14c9

File tree

7 files changed

+123
-20
lines changed

7 files changed

+123
-20
lines changed

README.md

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ A Rust port of [RecastNavigation](https://github.com/recastnavigation/recastnavi
44

55
[![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue)](LICENSE-MIT)
66
[![Rust Version](https://img.shields.io/badge/rust-1.85+-orange.svg)](https://www.rust-lang.org)
7+
[![WASM Compatible](https://img.shields.io/badge/WASM-compatible-green.svg)](https://webassembly.org/)
78

89
> **Note**: This port is developed for the [WoW Emulation project][wowemu] and
910
> has not been used outside of that context. The API may change as the project
@@ -18,20 +19,15 @@ It is a Rust 2024 edition port of Mikko Mononen's RecastNavigation C++ library.
1819

1920
## Workspace Structure
2021

21-
```text
22-
recast-rs/
23-
├── crates/
24-
│ ├── recast-common/ # Shared utilities, math, error types
25-
│ ├── recast/ # Navigation mesh generation
26-
│ ├── detour/ # Pathfinding and navigation queries
27-
│ ├── detour-crowd/ # Multi-agent crowd simulation
28-
│ ├── detour-tilecache/ # Dynamic obstacle management
29-
│ ├── detour-dynamic/ # Dynamic navmesh support
30-
│ └── recast-cli/ # Command-line tool
31-
├── examples/ # Example applications
32-
├── benches/ # Performance benchmarks
33-
└── tests/ # Integration tests
34-
```
22+
| Crate | Description | WASM |
23+
|-------|-------------|------|
24+
| `recast-common` | Shared utilities, math, error types | Yes |
25+
| `recast` | Navigation mesh generation | Yes |
26+
| `detour` | Pathfinding and navigation queries | Yes |
27+
| `detour-crowd` | Multi-agent crowd simulation | Yes |
28+
| `detour-tilecache` | Dynamic obstacle management | Yes |
29+
| `detour-dynamic` | Dynamic navmesh support | Yes |
30+
| `recast-cli` | Command-line tool | No |
3531

3632
### Crate Dependencies
3733

@@ -124,7 +120,7 @@ cargo build --release
124120

125121
- `serialization` - Save/load navigation meshes
126122
- `parallel` - Multi-threaded mesh generation (not WASM-compatible)
127-
- `async` - Async I/O operations (not WASM-compatible)
123+
- `tokio` - Tokio runtime integration for `detour-dynamic` (not WASM-compatible)
128124

129125
### Platform Support
130126

@@ -133,6 +129,34 @@ cargo build --release
133129
- Windows (x86_64)
134130
- WebAssembly (wasm32-unknown-unknown)
135131

132+
## WebAssembly Support
133+
134+
All library crates support WebAssembly (`wasm32-unknown-unknown`). Build for WASM with:
135+
136+
```bash
137+
cargo build --target wasm32-unknown-unknown -p recast -p detour
138+
```
139+
140+
### WASM-Compatible Features
141+
142+
| Feature | Native | WASM | Notes |
143+
|---------|--------|------|-------|
144+
| Mesh generation | Yes | Yes | Full support |
145+
| Pathfinding | Yes | Yes | Full support |
146+
| Crowd simulation | Yes | Yes | Full support |
147+
| Dynamic obstacles | Yes | Yes | Full support |
148+
| Async operations | Yes | Yes | Runtime-agnostic via `async-lock` |
149+
| File I/O | Yes | No | Use `std` feature to disable |
150+
| Parallel processing | Yes | No | Disable `parallel` feature |
151+
| Serialization | Yes | Yes | In-memory only on WASM |
152+
153+
### WASM Usage Notes
154+
155+
- **recast-common**: Disable file I/O with `default-features = false`
156+
- **detour**: Serialization works with in-memory buffers
157+
- **detour-tilecache**: Uses pure Rust LZ4 (`lz4_flex`)
158+
- **detour-dynamic**: Async via `async-lock` and `futures-lite` (no tokio required)
159+
136160
## License
137161

138162
Dual-licensed under either:

crates/detour-crowd/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Multi-agent crowd simulation on navigation meshes.
55
[![Crates.io](https://img.shields.io/crates/v/detour-crowd.svg)](https://crates.io/crates/detour-crowd)
66
[![Documentation](https://docs.rs/detour-crowd/badge.svg)](https://docs.rs/detour-crowd)
77
[![License](https://img.shields.io/crates/l/detour-crowd.svg)](../LICENSE-MIT)
8+
[![WASM](https://img.shields.io/badge/WASM-compatible-green.svg)](https://webassembly.org/)
89

910
## Overview
1011

@@ -70,6 +71,14 @@ let velocity = agent.velocity();
7071
| `ObstacleAvoidance` | RVO collision avoidance |
7172
| `ProximityGrid` | Spatial indexing for neighbors |
7273

74+
## WASM Support
75+
76+
This crate is fully compatible with WebAssembly. Build for WASM with:
77+
78+
```bash
79+
cargo build --target wasm32-unknown-unknown -p detour-crowd
80+
```
81+
7382
## License
7483

7584
Dual-licensed under either:

crates/detour-dynamic/README.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Dynamic navigation mesh generation with real-time obstacle support.
55
[![Crates.io](https://img.shields.io/crates/v/detour-dynamic.svg)](https://crates.io/crates/detour-dynamic)
66
[![Documentation](https://docs.rs/detour-dynamic/badge.svg)](https://docs.rs/detour-dynamic)
77
[![License](https://img.shields.io/crates/l/detour-dynamic.svg)](../LICENSE-MIT)
8+
[![WASM](https://img.shields.io/badge/WASM-compatible-green.svg)](https://webassembly.org/)
89

910
## Overview
1011

@@ -17,12 +18,16 @@ platforms, or procedurally generated content.
1718

1819
- **Dynamic Obstacle Management**: Add and remove colliders at runtime
1920
- **Incremental Updates**: Only rebuild affected tiles for performance
20-
- **Async Processing**: Non-blocking navmesh updates using Tokio
21+
- **Async Processing**: Non-blocking navmesh updates (WASM-compatible)
2122
- **Multiple Collider Types**: Box, cylinder, sphere, trimesh, and composites
2223
- **Checkpoint System**: Efficient state management for incremental rebuilds
2324
- **Voxel-based Queries**: Precise raycasting against heightfield data
2425
- **Serialization**: Save and load dynamic navmesh state
2526

27+
## Optional Features
28+
29+
- `tokio` - Use Tokio runtime for async operations (not WASM-compatible)
30+
2631
## Collider Types
2732

2833
| Collider | Description |
@@ -77,17 +82,38 @@ let query = navmesh.create_query()?;
7782

7883
## Async Updates
7984

85+
Async operations use runtime-agnostic primitives (`async-lock`, `futures-lite`)
86+
and work on all platforms including WASM:
87+
88+
```rust
89+
// Works with any async runtime (Tokio, async-std, wasm-bindgen-futures, etc.)
90+
navmesh.build_async().await?;
91+
navmesh.update_async().await?;
92+
```
93+
94+
On native platforms with Tokio:
95+
8096
```rust
8197
use tokio::runtime::Runtime;
8298

8399
let rt = Runtime::new()?;
84100
rt.block_on(async {
85-
// Rebuild tiles asynchronously
86-
navmesh.rebuild_dirty_tiles_async().await?;
101+
navmesh.build_async().await?;
87102
Ok::<_, Box<dyn std::error::Error>>(())
88103
})?;
89104
```
90105

106+
## WASM Support
107+
108+
This crate is fully compatible with WebAssembly. Build for WASM with:
109+
110+
```bash
111+
cargo build --target wasm32-unknown-unknown -p detour-dynamic
112+
```
113+
114+
Async operations work on WASM using `wasm-bindgen-futures` or similar runtimes.
115+
The `tokio` feature is not available on WASM.
116+
91117
## License
92118

93119
Dual-licensed under either:

crates/detour-tilecache/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Dynamic obstacle management and tile caching for navigation meshes.
55
[![Crates.io](https://img.shields.io/crates/v/detour-tilecache.svg)](https://crates.io/crates/detour-tilecache)
66
[![Documentation](https://docs.rs/detour-tilecache/badge.svg)](https://docs.rs/detour-tilecache)
77
[![License](https://img.shields.io/crates/l/detour-tilecache.svg)](../LICENSE-MIT)
8+
[![WASM](https://img.shields.io/badge/WASM-compatible-green.svg)](https://webassembly.org/)
89

910
## Overview
1011

@@ -76,6 +77,18 @@ tile_cache.update()?;
7677
| Box | Axis-aligned box | Crates, furniture |
7778
| Oriented Box | Rotated box | Vehicles, angled objects |
7879

80+
## WASM Support
81+
82+
This crate is fully compatible with WebAssembly. Build for WASM with:
83+
84+
```bash
85+
cargo build --target wasm32-unknown-unknown -p detour-tilecache
86+
```
87+
88+
LZ4 compression uses `lz4_flex`, a pure Rust implementation that works on WASM.
89+
Serialization works with in-memory buffers; file-based save/load is not
90+
available on WASM.
91+
7992
## License
8093

8194
Dual-licensed under either:

crates/detour/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Pathfinding and spatial queries on navigation meshes.
55
[![Crates.io](https://img.shields.io/crates/v/detour.svg)](https://crates.io/crates/detour)
66
[![Documentation](https://docs.rs/detour/badge.svg)](https://docs.rs/detour)
77
[![License](https://img.shields.io/crates/l/detour.svg)](../LICENSE-MIT)
8+
[![WASM](https://img.shields.io/badge/WASM-compatible-green.svg)](https://webassembly.org/)
89

910
## Overview
1011

@@ -30,6 +31,17 @@ This is a Rust port of the Detour component from [RecastNavigation][recast-cpp].
3031

3132
- `serialization` - Save/load navigation meshes via Serde
3233

34+
## WASM Support
35+
36+
This crate is fully compatible with WebAssembly. Build for WASM with:
37+
38+
```bash
39+
cargo build --target wasm32-unknown-unknown -p detour
40+
```
41+
42+
The `serialization` feature works on WASM with in-memory buffers. File-based
43+
save/load is not available on WASM.
44+
3345
## Example
3446

3547
```rust

crates/recast-common/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Common utilities and types shared by the recast-rs workspace crates.
55
[![Crates.io](https://img.shields.io/crates/v/recast-common.svg)](https://crates.io/crates/recast-common)
66
[![Documentation](https://docs.rs/recast-common/badge.svg)](https://docs.rs/recast-common)
77
[![License](https://img.shields.io/crates/l/recast-common.svg)](../LICENSE-MIT)
8+
[![WASM](https://img.shields.io/badge/WASM-compatible-green.svg)](https://webassembly.org/)
89

910
## Overview
1011

@@ -20,7 +21,13 @@ and related crates. It is not intended for direct use by end users.
2021

2122
## Features
2223

23-
- `async` - Enables async runtime support via Tokio
24+
- `std` (default) - Enables file I/O operations (`TriMesh::from_obj()`)
25+
26+
## WASM Support
27+
28+
This crate is fully compatible with WebAssembly. For WASM builds, file I/O is
29+
automatically disabled. Use `TriMesh::from_obj_str()` to parse OBJ content from
30+
strings instead of files.
2431

2532
## Usage
2633

crates/recast/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Navigation mesh generation from 3D triangle meshes.
55
[![Crates.io](https://img.shields.io/crates/v/recast.svg)](https://crates.io/crates/recast)
66
[![Documentation](https://docs.rs/recast/badge.svg)](https://docs.rs/recast)
77
[![License](https://img.shields.io/crates/l/recast.svg)](../LICENSE-MIT)
8+
[![WASM](https://img.shields.io/badge/WASM-compatible-green.svg)](https://webassembly.org/)
89

910
## Overview
1011

@@ -27,7 +28,18 @@ This is a Rust port of the Recast component from [RecastNavigation][recast-cpp].
2728

2829
## Optional Features
2930

30-
- `parallel` - Multi-threaded mesh generation using Rayon
31+
- `parallel` - Multi-threaded mesh generation using Rayon (not WASM-compatible)
32+
33+
## WASM Support
34+
35+
This crate is fully compatible with WebAssembly. Build for WASM with:
36+
37+
```bash
38+
cargo build --target wasm32-unknown-unknown -p recast
39+
```
40+
41+
Note: The `parallel` feature is not available on WASM. Timing uses `web-time`
42+
for cross-platform compatibility.
3143

3244
## Example
3345

0 commit comments

Comments
 (0)