Build and run an example, in this case 'triangle':
$ cargo run --example triangle --release
Prerequisites:
- A server that properly defines the
application/wasm
mime type (for example http-server) - wasm-pack
Build and generate web output (webassembly, javascript and html files) into the pkg folder:
$ wasm-pack build examples/triangle --target web --out-name web --out-dir ../../pkg
Start the server and go to http://localhost:8080 in a browser:
$ http-server
All of the examples builds to both native (desktop, mobile or whatever target specified) and WebAssembly (wasm) that can be run in a browser.
Because they should run in a browser and to keep the same code for native and wasm, all loading happens async.
If your application is native only, you can avoid the async runtime (tokio
or async-std
) and use three_d_asset::load
instead of three_d_asset::load_async
.
This is the recommended starting point for a gentle introduction to three-d
.
This is the same as the Triangle
example, except it only uses the core module and not the renderer module.
This example shows how depth ordering is currently working for InstancedMesh
objects with transparency.
Shows how to easily combine a custom winit window with three-d
rendering.
Shows how to create multiple winit windows and render with three-d
.
Headless [code]
This example does not create a window but render directly to a render target and saves the result to disk. Therefore, this example does not work on web.