[rs] Add screenshots of examples
When looking into wgpu-rs as a replacement for WebGL I went to the examples directory on GitHub to browse for a bit. I wanted to see some of the examples at a glance without needing to clone the repository. This commit enables that by adding a README to each example with a description of the example and screenshots / example output. In a few cases the description is a bit redundant - but my hope is that in the future we can improve all the READMEs. Being a web API and thus very accessible, WebGPU could end up being many people's first introduction to graphics programming so the lower we make the barrier the better.
3
.gitignore
vendored
@ -12,8 +12,9 @@ Cargo.lock
|
|||||||
# Other
|
# Other
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
# VSCode project
|
# IDE/Editor configuration files
|
||||||
.vscode
|
.vscode
|
||||||
|
.idea
|
||||||
|
|
||||||
# Output from capture example
|
# Output from capture example
|
||||||
red.png
|
red.png
|
||||||
|
13
wgpu/examples/boids/README.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# boids
|
||||||
|
|
||||||
|
Flocking boids example with gpu compute update pass
|
||||||
|
|
||||||
|
## To Run
|
||||||
|
|
||||||
|
```
|
||||||
|
cargo run --example boids
|
||||||
|
```
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
![Boids example](./screenshot.png)
|
BIN
wgpu/examples/boids/screenshot.png
Normal file
After Width: | Height: | Size: 158 KiB |
18
wgpu/examples/capture/README.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# capture
|
||||||
|
|
||||||
|
This example shows how to capture an image by rendering it to a texture, copying the texture to
|
||||||
|
a buffer, and retrieving it from the buffer.
|
||||||
|
|
||||||
|
This could be used for "taking a screenshot," with the added benefit that this method doesn't
|
||||||
|
require a window to be created.
|
||||||
|
|
||||||
|
## To Run
|
||||||
|
|
||||||
|
```
|
||||||
|
cargo run --example capture
|
||||||
|
open examples/capture/red.png
|
||||||
|
```
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
![Capture example](./screenshot.png)
|
BIN
wgpu/examples/capture/screenshot.png
Normal file
After Width: | Height: | Size: 851 B |
13
wgpu/examples/cube/README.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# cube
|
||||||
|
|
||||||
|
This example renders a textured cube.
|
||||||
|
|
||||||
|
## To Run
|
||||||
|
|
||||||
|
```
|
||||||
|
cargo run --example cube
|
||||||
|
```
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
![Cube example](./screenshot.png)
|
BIN
wgpu/examples/cube/screenshot.png
Normal file
After Width: | Height: | Size: 393 KiB |
16
wgpu/examples/describe/README.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# describe
|
||||||
|
|
||||||
|
This example prints output describing the adapter in use.
|
||||||
|
|
||||||
|
## To Run
|
||||||
|
|
||||||
|
```
|
||||||
|
cargo run --example describe
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example output
|
||||||
|
|
||||||
|
```
|
||||||
|
# You might see different output as it depends on your graphics card
|
||||||
|
AdapterInfo { name: "Intel(R) UHD Graphics 630", vendor: 0, device: 0, device_type: IntegratedGpu, backend: Metal }
|
||||||
|
```
|
22
wgpu/examples/hello-compute/README.md
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# hello-compute
|
||||||
|
|
||||||
|
Runs a compute shader to determine the number of iterations of the rules from
|
||||||
|
Collatz Conjecture
|
||||||
|
|
||||||
|
- If n is even, n = n/2
|
||||||
|
- If n is odd, n = 3n+1
|
||||||
|
|
||||||
|
that it will take to finish and reach the number `1`.
|
||||||
|
|
||||||
|
## To Run
|
||||||
|
|
||||||
|
```
|
||||||
|
# Pass in any 4 numbers as arguments
|
||||||
|
RUST_LOG=hello_compute cargo run --example hello-compute 1 4 3 295
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example Output
|
||||||
|
|
||||||
|
```
|
||||||
|
[2020-04-25T11:15:33Z INFO hello_compute] Times: [0, 2, 7, 55]
|
||||||
|
```
|
13
wgpu/examples/hello-triangle/README.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# hello-triangle
|
||||||
|
|
||||||
|
This example renders a triangle to a window.
|
||||||
|
|
||||||
|
## To Run
|
||||||
|
|
||||||
|
```
|
||||||
|
cargo run --example hello-triangle
|
||||||
|
```
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
![Triangle window](./screenshot.png)
|
BIN
wgpu/examples/hello-triangle/screenshot.png
Normal file
After Width: | Height: | Size: 25 KiB |
13
wgpu/examples/mipmap/README.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# mipmap
|
||||||
|
|
||||||
|
This example shows how to generate and make use of mipmaps.
|
||||||
|
|
||||||
|
## To Run
|
||||||
|
|
||||||
|
```
|
||||||
|
cargo run --example mipmap
|
||||||
|
```
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
![Mip maps](./screenshot.png)
|
BIN
wgpu/examples/mipmap/screenshot.png
Normal file
After Width: | Height: | Size: 1.4 MiB |
13
wgpu/examples/msaa-line/README.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# msaa-line
|
||||||
|
|
||||||
|
This example shows how to render lines using MSAA.
|
||||||
|
|
||||||
|
## To Run
|
||||||
|
|
||||||
|
```
|
||||||
|
cargo run --example msaa-line
|
||||||
|
```
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
![MSAA line](./screenshot.png)
|
BIN
wgpu/examples/msaa-line/screenshot.png
Normal file
After Width: | Height: | Size: 179 KiB |
13
wgpu/examples/shadow/README.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# shadow
|
||||||
|
|
||||||
|
This animated example demonstrates shadow mapping.
|
||||||
|
|
||||||
|
## To Run
|
||||||
|
|
||||||
|
```
|
||||||
|
cargo run --example shadow
|
||||||
|
```
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
![Shadow mapping](./screenshot.png)
|
BIN
wgpu/examples/shadow/screenshot.png
Normal file
After Width: | Height: | Size: 277 KiB |
15
wgpu/examples/skybox/README.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# skybox
|
||||||
|
|
||||||
|
This animated example demonstrates rendering a skybox.
|
||||||
|
|
||||||
|
## To Run
|
||||||
|
|
||||||
|
```
|
||||||
|
cargo run --example skybox
|
||||||
|
```
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
![Skybox](./screenshot.png)
|
||||||
|
|
||||||
|
![Skybox 2](./screenshot2.png)
|
BIN
wgpu/examples/skybox/screenshot.png
Normal file
After Width: | Height: | Size: 345 KiB |
BIN
wgpu/examples/skybox/screenshot2.png
Normal file
After Width: | Height: | Size: 170 KiB |