Files
wgpu/examples/water
Jay Oster dae801baa0 Replace futures with pollster
This PR removes all of the `futures` dependencies. `std::future` does not contain a lot of useful helpers available in futures. The obvious ones are `join_all`, `FutureExt::map`, and `block_on`.

* `join_all` is replaced with a `Vec<T>` and async blocks.
* `FuturesExt::map` in the web backend is replaced by rolling the `map` function into the `MakeSendFuture` type.
* `block_on` is provided by `pollster`.

The original code using `join_all` ignored the result type yielded by the Future from `map_async`. This code does the same, but makes dropping the result a little more obvious.

These should not be troublesome. Figured I would call them out anyway.

The last big change is replacing `futures-executor` in the examples with `async-executor`. A new concrete `Spawner` type is used in the example framework instead of an implementation of `futures_task::LocalSpawn`.
2021-01-07 10:10:18 -08:00
..
2021-01-07 10:10:18 -08:00
2020-06-16 02:33:14 -04:00
2020-06-16 02:33:14 -04:00

Water example

This example renders animated water.

It demonstrates Read only Depth/Stencil (abbreviated RODS), where a depth/stencil buffer is used as an attachment which is read-only. In this case it's used in the shaders to calculate reflections and depth.

Files:

water
├── main.rs ------------------ Main program
├── point_gen.rs ------------- Hexagon point generation
├── README.md ---------------- This readme
├── screenshot.png ----------- Screenshot
├── terrain_shader.frag ------ Terrain fragment shader
├── terrain_shader.frag.spv -- Compiled terrain fragment shader
├── terrain_shader.vert ------ Terrain vertex shader
├── terrain_shader.vert.spv -- Compiled terrain vertex shader
├── water_shader.frag -------- Water fragment shader
├── water_shader.frag.spv ---- Compiled water fragment shader
├── water_shader.vert -------- Water vertex shader
└── water_shader.vert.spv ---- Compiled water vertex shader

To run

cargo run --example water

To recompile shaders

(requires make and glslangvalidator)

make

Screenshot

Water example