[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.
This commit is contained in:
Chinedu Francis Nwafili 2020-04-24 18:55:11 -04:00 committed by Josh Groves
parent 455f5cb224
commit 35e07f4172
20 changed files with 151 additions and 1 deletions

3
.gitignore vendored
View File

@ -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

View 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

View 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 851 B

View File

@ -0,0 +1,13 @@
# cube
This example renders a textured cube.
## To Run
```
cargo run --example cube
```
## Screenshots
![Cube example](./screenshot.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 KiB

View 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 }
```

View 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]
```

View 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

View File

@ -0,0 +1,13 @@
# shadow
This animated example demonstrates shadow mapping.
## To Run
```
cargo run --example shadow
```
## Screenshots
![Shadow mapping](./screenshot.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 KiB

View 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB