bevy/examples/2d
François Mockers a9a4b069b6
Make some examples deterministic (#16488)
# Objective

- Improve reproducibility of examples

## Solution

- Use seeded rng when needed
- Use fixed z-ordering when needed

## Testing

```sh
steps=5;
echo "cpu_draw\nparallel_query\nanimated_fox\ntransparency_2d" > test
cargo run -p example-showcase -- run --stop-frame 250 --screenshot-frame 100 --fixed-frame-time 0.05 --example-list test --in-ci;
mv screenshots base;
for prefix in `seq 0 $steps`;
do
  echo step $prefix;
  cargo run -p example-showcase -- run --stop-frame 250 --screenshot-frame 100 --fixed-frame-time 0.05 --example-list test;
  mv screenshots $prefix-screenshots;
done;
mv base screenshots
for prefix in `seq 0 $steps`;
do
  echo check $prefix
  for file in screenshots/*/*;
  do
    echo $file;
    diff $file $prefix-$file;
  done;
done;
```
2024-11-23 18:28:47 +00:00
..
2d_shapes.rs
2d_viewport_to_world.rs
bloom_2d.rs
bounding_2d.rs
cpu_draw.rs Make some examples deterministic (#16488) 2024-11-23 18:28:47 +00:00
custom_gltf_vertex_attribute.rs
mesh2d_alpha_mode.rs
mesh2d_arcs.rs
mesh2d_manual.rs
mesh2d_vertex_color_texture.rs
mesh2d.rs
move_sprite.rs
pixel_grid_snap.rs
rotation.rs
sprite_animation.rs
sprite_flipping.rs
sprite_sheet.rs
sprite_slice.rs
sprite_tile.rs
sprite.rs
text2d.rs
texture_atlas.rs
transparency_2d.rs Make some examples deterministic (#16488) 2024-11-23 18:28:47 +00:00
wireframe_2d.rs