Computer graphics toolkit for WebAssembly applications.
Rust-based graphics libraries for WebGL/WebGPU applications, mathematical computation, and game development.
Prerequisites:
rustup target add wasm32-unknown-unknown
cargo install trunkRun example:
git clone https://github.com/Wandalen/cgtools
cd cgtools/examples/minwebgl/hexagonal_grid
trunk serve --releaseLarge binary assets — 3D models, textures, HDR environment maps, and example inputs — are not stored in git. They live in a public Hugging Face dataset and are tracked with DVC.
Cloning the repo gives you the source but not these files. The library crates (ndarray_cg,
minwebgl, …) build and test without them — you only need them to run examples that load models
or textures.
Install DVC and pull. Reads are anonymous — no account, credentials, or DVC extras required:
pipx install dvc # or: uv tool install dvc / pip install dvc
dvc pull # everything (~312 MB)You rarely need all of it. Browse what's tracked without downloading, then pull only the file or
subfolder you want — each file inside assets/ is fetched individually:
dvc list -R . assets # see the full tree first (no download)
dvc pull assets/gltf # just the glTF models
dvc pull assets/gltf/sponza.glb # a single fileGrab one file without cloning at all:
dvc get https://github.com/Wandalen/cgtools assets/gltf/sponza.glbUpdating assets is maintainer-only (a separate hf upload step); opening a PR or cloning never
pushes anything.
Add to Cargo.toml:
[dependencies]
minwebgl = "0.2"
tiles_tools = "0.1"
ndarray_cg = "0.3"
browser_input = "0.1"| Crate | Description |
|---|---|
minwebgl |
WebGL 2.0 toolkit |
minwebgpu |
WebGPU toolkit |
tiles_tools |
Tile-based game systems |
ndarray_cg |
Computer graphics mathematics |
browser_input |
Input handling |
browser_log |
WebAssembly logging |
renderer |
3D rendering system |
line_tools |
Line rendering |
embroidery_tools |
Embroidery pattern tools |
Browse the full example gallery for every example across WebGL, WebGPU, WGPU, and Rhai scripting.
- Hexagonal Grid - Interactive pathfinding
- Deferred Shading - 3D rendering pipeline
- Text Rendering - GPU text rendering
- Hello Triangle - WebGPU basics
# Test workspace
cargo test --workspace
# Run example
cd examples/minwebgl/trivial
trunk serve --release
# Or, from any directory, by partial unique match against the example/binary path:
action/run trivial# Full verification: native suite (nextest + doctests + clippy), plus a wasm32
# compile check across every browser-kind example and the actual
# wasm_bindgen_test suites (browser-driven).
verb/test
# Ordinary, scoped verification during development (single package).
verb/test_only pkg::<crate>Never prefix these with RUSTFLAGS/RUSTDOCFLAGS env vars — .cargo/config.toml
already sets the --cfg flags this workspace needs to compile at all (e.g.
web_sys_unstable_apis); an env var replaces those wholesale instead of merging.
# Install every bin-target crate under module/ (examples/ demos are excluded).
verb/install/run
# Preview the crate set without installing; or install one crate by name.
verb/install/run dry::1
verb/install/run shader_chunks