@@ -91,7 +91,7 @@ fn setup(
91
91
& mut images,
92
92
& render_device,
93
93
& mut scene_controller,
94
- // pre_roll_frames should be big enought for full scene render,
94
+ // pre_roll_frames should be big enough for full scene render,
95
95
// but the bigger it is, the longer example will run.
96
96
// To visualize stages of scene rendering change this param to 0
97
97
// and change AppConfig::single_image to false in main
@@ -100,7 +100,7 @@ fn setup(
100
100
// 2. Few black box images
101
101
// 3. Fully rendered scene images
102
102
// Exact number depends on device speed, device load and scene size
103
- 30 ,
103
+ 40 ,
104
104
"main_scene" . into ( ) ,
105
105
) ;
106
106
@@ -499,9 +499,6 @@ mod frame_capture {
499
499
) {
500
500
if let SceneState :: Render ( n) = scene_controller. state {
501
501
if n < 1 {
502
- use rand:: Rng ;
503
- let mut rng = rand:: thread_rng ( ) ;
504
-
505
502
// We don't want to block the main world on this,
506
503
// so we use try_recv which attempts to receive without blocking
507
504
let mut image_data = Vec :: new ( ) ;
@@ -525,8 +522,12 @@ mod frame_capture {
525
522
info ! ( "Saving image to: {images_dir:?}" ) ;
526
523
std:: fs:: create_dir_all ( & images_dir) . unwrap ( ) ;
527
524
528
- let number = rng. gen :: < u128 > ( ) ;
529
- let image_path = images_dir. join ( format ! ( "{number:032X}.png" ) ) ;
525
+ let mut number = 0 ;
526
+ let mut image_path = images_dir. join ( format ! ( "{number:03}.png" ) ) ;
527
+ while image_path. exists ( ) {
528
+ number += 1 ;
529
+ image_path = images_dir. join ( format ! ( "{number:03}.png" ) )
530
+ }
530
531
if let Err ( e) = img. save ( image_path) {
531
532
panic ! ( "Failed to save image: {}" , e) ;
532
533
} ;
0 commit comments