@@ -80,7 +80,8 @@ impl Renderer {
8080 for path in texture_paths {
8181 let path_str = String :: from ( path. as_str ( ) ) ;
8282 println ! ( "Ajout de la texture {}" , path) ;
83- textures. entry ( path)
83+ textures
84+ . entry ( path)
8485 . or_insert_with ( || Image :: < RGBA8 > :: read_from_file ( path_str. as_str ( ) ) ) ;
8586 }
8687 }
@@ -124,18 +125,18 @@ impl Renderer {
124125 le canvas passé en paramètres. */
125126 pub fn calculate_rays ( & self , world : & scene:: World , camera : & scene:: Camera , pixel : & mut Pixel ) {
126127
127- let objects = world. objects ( )
128+ let objects = world
129+ . objects ( )
128130 . iter ( )
129131 . filter ( |bbox| bbox. is_visible ( ) )
130132 . collect :: < Vec < & Object > > ( ) ;
131133
132134 for sample in & mut pixel. samples {
133135 // On récupère le rayon à partir du sample
134- let mut ray: Ray =
135- camera. create_ray_from_sample ( sample,
136- self . ratio ,
137- self . res_x as f32 ,
138- self . res_y as f32 ) ;
136+ let mut ray: Ray = camera. create_ray_from_sample ( sample,
137+ self . ratio ,
138+ self . res_x as f32 ,
139+ self . res_y as f32 ) ;
139140
140141 // CALCUL DE LA COULEUR DU RAYON (TODO à mettre ailleurs)
141142
@@ -235,12 +236,12 @@ impl Renderer {
235236
236237 // On passe les blocs aux threads
237238 pool. scoped ( |scope| while !blocks. is_empty ( ) {
238- let block = blocks. pop ( ) . unwrap ( ) ;
239- scope. execute ( || {
240- self . render_block ( block, world, camera, & shared_image) ;
241- progress_bar. lock ( ) . unwrap ( ) . inc ( ) ;
242- } ) ;
243- } ) ;
239+ let block = blocks. pop ( ) . unwrap ( ) ;
240+ scope. execute ( || {
241+ self . render_block ( block, world, camera, & shared_image) ;
242+ progress_bar. lock ( ) . unwrap ( ) . inc ( ) ;
243+ } ) ;
244+ } ) ;
244245
245246 progress_bar. lock ( ) . unwrap ( ) . finish ( ) ;
246247
@@ -261,7 +262,8 @@ impl Renderer {
261262 . create_sampler ( )
262263 . create_samples ( & mut block) ;
263264
264- let filter = self . filter_factory . create_filter ( self . res_x as u32 , self . res_y as u32 ) ;
265+ let filter = self . filter_factory
266+ . create_filter ( self . res_x as u32 , self . res_y as u32 ) ;
265267
266268 // Emission des rayons
267269 for pixel in block. pixels_mut ( ) {
@@ -283,7 +285,8 @@ impl Renderer {
283285 }
284286
285287 // Superposition de l'image rendue à l'image finale
286- shared_image. lock ( )
288+ shared_image
289+ . lock ( )
287290 . unwrap ( )
288291 . deref_mut ( )
289292 . superpose_sub_image ( Image :: < RGBA32 > :: from_vec_vec ( & temp_result) ,
0 commit comments