@@ -11,9 +11,9 @@ use std::sync::atomic::{AtomicU64, AtomicUsize, Ordering};
1111use std:: sync:: { RwLock , RwLockReadGuard , RwLockWriteGuard } ;
1212
1313use crate :: hpc:: splat3d:: gaussian:: GaussianBatch ;
14- use crate :: hpc:: splat3d:: project:: { Camera , ProjectedBatch , project_batch} ;
15- use crate :: hpc:: splat3d:: tile:: TileBinning ;
14+ use crate :: hpc:: splat3d:: project:: { project_batch, Camera , ProjectedBatch } ;
1615use crate :: hpc:: splat3d:: raster:: rasterize_frame;
16+ use crate :: hpc:: splat3d:: tile:: TileBinning ;
1717
1818// ════════════════════════════════════════════════════════════════════════════
1919// SplatFrame — one frame's full state
@@ -84,14 +84,7 @@ impl SplatFrame {
8484 self . binning = TileBinning :: from_projected ( & self . projected , camera) ;
8585
8686 // 3. Rasterize: depth-sorted alpha-blend into framebuffer
87- rasterize_frame (
88- & self . binning ,
89- & self . projected ,
90- & mut self . framebuffer ,
91- self . width ,
92- self . height ,
93- background,
94- ) ;
87+ rasterize_frame ( & self . binning , & self . projected , & mut self . framebuffer , self . width , self . height , background) ;
9588
9689 // 4. Advance frame counter
9790 self . frame_id += 1 ;
@@ -101,25 +94,38 @@ impl SplatFrame {
10194 pub fn byte_footprint ( & self ) -> usize {
10295 // GaussianBatch: 11 f32 vecs × capacity + SH vec
10396 let g = & self . gaussians ;
104- let gaussian_bytes = (
105- g. mean_x . len ( ) + g. mean_y . len ( ) + g. mean_z . len ( )
106- + g. scale_x . len ( ) + g. scale_y . len ( ) + g. scale_z . len ( )
107- + g. quat_w . len ( ) + g. quat_x . len ( ) + g. quat_y . len ( ) + g. quat_z . len ( )
108- + g. opacity . len ( )
109- ) * 4 + g. sh . len ( ) * 4 ;
97+ let gaussian_bytes = ( g. mean_x . len ( )
98+ + g. mean_y . len ( )
99+ + g. mean_z . len ( )
100+ + g. scale_x . len ( )
101+ + g. scale_y . len ( )
102+ + g. scale_z . len ( )
103+ + g. quat_w . len ( )
104+ + g. quat_x . len ( )
105+ + g. quat_y . len ( )
106+ + g. quat_z . len ( )
107+ + g. opacity . len ( ) )
108+ * 4
109+ + g. sh . len ( ) * 4 ;
110110
111111 // ProjectedBatch: 10 f32 vecs × capacity + 1 u8 vec
112112 let p = & self . projected ;
113- let projected_bytes = (
114- p. screen_x . len ( ) + p. screen_y . len ( ) + p. depth . len ( )
115- + p. conic_a . len ( ) + p. conic_b . len ( ) + p. conic_c . len ( )
116- + p. radius . len ( ) + p. color_r . len ( ) + p. color_g . len ( )
117- + p. color_b . len ( ) + p. opacity . len ( )
118- ) * 4 + p. valid . len ( ) ;
113+ let projected_bytes = ( p. screen_x . len ( )
114+ + p. screen_y . len ( )
115+ + p. depth . len ( )
116+ + p. conic_a . len ( )
117+ + p. conic_b . len ( )
118+ + p. conic_c . len ( )
119+ + p. radius . len ( )
120+ + p. color_r . len ( )
121+ + p. color_g . len ( )
122+ + p. color_b . len ( )
123+ + p. opacity . len ( ) )
124+ * 4
125+ + p. valid . len ( ) ;
119126
120127 // TileBinning
121- let binning_bytes = self . binning . instances . len ( ) * 16
122- + self . binning . tile_offsets . len ( ) * 4 ;
128+ let binning_bytes = self . binning . instances . len ( ) * 16 + self . binning . tile_offsets . len ( ) * 4 ;
123129
124130 // Framebuffer
125131 let fb_bytes = self . framebuffer . len ( ) * 4 ;
@@ -241,8 +247,7 @@ mod tests {
241247 assert_eq ! ( frame. width, 64 ) ;
242248 assert_eq ! ( frame. height, 48 ) ;
243249 assert_eq ! ( frame. framebuffer. len( ) , 3 * 64 * 48 ) ;
244- assert ! ( frame. gaussians. capacity >= 100 ,
245- "capacity {} < 100" , frame. gaussians. capacity) ;
250+ assert ! ( frame. gaussians. capacity >= 100 , "capacity {} < 100" , frame. gaussians. capacity) ;
246251 assert_eq ! ( frame. frame_id, 0 ) ;
247252 }
248253
@@ -255,8 +260,10 @@ mod tests {
255260 frame. tick ( & camera, [ 0.0 , 0.0 , 0.0 ] ) ;
256261 assert_eq ! ( frame. frame_id, 1 ) ;
257262 // With zero gaussians, framebuffer must be all-black (background = black)
258- assert ! ( frame. framebuffer. iter( ) . all( |& v| v == 0.0 ) ,
259- "framebuffer should be all black with zero gaussians and black background" ) ;
263+ assert ! (
264+ frame. framebuffer. iter( ) . all( |& v| v == 0.0 ) ,
265+ "framebuffer should be all black with zero gaussians and black background"
266+ ) ;
260267 }
261268
262269 // ── Test 3 ───────────────────────────────────────────────────────────────
@@ -275,7 +282,7 @@ mod tests {
275282 // SH DC contribution: color = 0.5 + 0.282_095 * sh_dc
276283 // To get color > background (0.0), we need a positive DC.
277284 // Use a large positive value so the clamped output is clearly > 0.
278- g. sh [ 0 ] = 3.0 ; // R channel DC
285+ g. sh [ 0 ] = 3.0 ; // R channel DC
279286 g. sh [ 16 ] = 3.0 ; // G channel DC
280287 g. sh [ 32 ] = 3.0 ; // B channel DC
281288 g. scale = [ 0.5 , 0.5 , 0.5 ] ; // Visible screen-space radius
@@ -288,8 +295,7 @@ mod tests {
288295 let cy = 32usize ;
289296 let idx = ( cy * 64 + cx) * 3 ;
290297 let r = frame. framebuffer [ idx] ;
291- assert ! ( r > 0.0 ,
292- "center pixel R={r} should be > 0 after rendering a bright gaussian" ) ;
298+ assert ! ( r > 0.0 , "center pixel R={r} should be > 0 after rendering a bright gaussian" ) ;
293299 }
294300
295301 // ── Test 4 ───────────────────────────────────────────────────────────────
@@ -368,8 +374,7 @@ mod tests {
368374 #[ test]
369375 fn splat_frame_byte_footprint_nonzero ( ) {
370376 let frame = SplatFrame :: with_capacity ( 64 , 32 , 32 ) ;
371- assert ! ( frame. byte_footprint( ) > 0 ,
372- "byte_footprint should be > 0 for a non-empty frame" ) ;
377+ assert ! ( frame. byte_footprint( ) > 0 , "byte_footprint should be > 0 for a non-empty frame" ) ;
373378 }
374379
375380 // ── Test 10 ──────────────────────────────────────────────────────────────
@@ -401,9 +406,6 @@ mod tests {
401406
402407 r. tick ( & camera, [ 0.0 , 0.0 , 0.0 ] ) ;
403408
404- assert_ne ! (
405- ptr_before_tick1, ptr_before_tick2,
406- "two ticks must render to different physical frame buffers"
407- ) ;
409+ assert_ne ! ( ptr_before_tick1, ptr_before_tick2, "two ticks must render to different physical frame buffers" ) ;
408410 }
409411}
0 commit comments