mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-22 15:31:03 +01:00
* The conditional at the start of resize() already tests for and exits on the zero width and height condition. The conditional removed here was then getting run on every other call to resize(), which doesn't seem logical, doesn't correspond to the comment, and seemed to be causing at least one issue with rendered viewport going black during resize. Fixes #532 (probably) Fixes #519 * Defensive coding to prevent various issues when window size goes to zero, e.g. NaN being passed in cgmath::perspective() aspect ratio parameter. Fixes #531
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
