@@ -327,7 +327,7 @@ impl<P: PhaseItem, M: UiMaterial> RenderCommand<P> for DrawUiMaterialNode<M> {
327
327
}
328
328
329
329
pub struct ExtractedUiMaterialNode < M : UiMaterial > {
330
- pub stack_index : usize ,
330
+ pub stack_index : u32 ,
331
331
pub transform : Mat4 ,
332
332
pub rect : Rect ,
333
333
pub border : [ f32 ; 4 ] ,
@@ -355,7 +355,6 @@ impl<M: UiMaterial> Default for ExtractedUiMaterialNodes<M> {
355
355
pub fn extract_ui_material_nodes < M : UiMaterial > (
356
356
mut extracted_uinodes : ResMut < ExtractedUiMaterialNodes < M > > ,
357
357
materials : Extract < Res < Assets < M > > > ,
358
- ui_stack : Extract < Res < UiStack > > ,
359
358
default_ui_camera : Extract < DefaultUiCamera > ,
360
359
uinode_query : Extract <
361
360
Query <
@@ -386,61 +385,54 @@ pub fn extract_ui_material_nodes<M: UiMaterial>(
386
385
// If there is only one camera, we use it as default
387
386
let default_single_camera = default_ui_camera. get ( ) ;
388
387
389
- for ( stack_index, entity) in ui_stack. uinodes . iter ( ) . enumerate ( ) {
390
- if let Ok ( ( entity, uinode, style, transform, handle, view_visibility, clip, camera) ) =
391
- uinode_query. get ( * entity)
392
- {
393
- let Some ( camera_entity) = camera. map ( TargetCamera :: entity) . or ( default_single_camera)
394
- else {
395
- continue ;
396
- } ;
397
-
398
- // skip invisible nodes
399
- if !view_visibility. get ( ) {
400
- continue ;
401
- }
388
+ for ( entity, uinode, style, transform, handle, view_visibility, clip, camera) in
389
+ uinode_query. iter ( )
390
+ {
391
+ let Some ( camera_entity) = camera. map ( TargetCamera :: entity) . or ( default_single_camera) else {
392
+ continue ;
393
+ } ;
402
394
403
- // Skip loading materials
404
- if !materials . contains ( handle ) {
405
- continue ;
406
- }
395
+ // skip invisible nodes
396
+ if !view_visibility . get ( ) {
397
+ continue ;
398
+ }
407
399
408
- // Both vertical and horizontal percentage border values are calculated based on the width of the parent node
409
- // <https://developer.mozilla.org/en-US/docs/Web/CSS/border-width>
410
- let parent_width = uinode. size ( ) . x ;
411
- let left =
412
- resolve_border_thickness ( style. border . left , parent_width, ui_logical_viewport_size)
413
- / uinode. size ( ) . x ;
414
- let right = resolve_border_thickness (
415
- style. border . right ,
416
- parent_width,
417
- ui_logical_viewport_size,
418
- ) / uinode. size ( ) . x ;
419
- let top =
420
- resolve_border_thickness ( style. border . top , parent_width, ui_logical_viewport_size)
421
- / uinode. size ( ) . y ;
422
- let bottom = resolve_border_thickness (
423
- style. border . bottom ,
424
- parent_width,
425
- ui_logical_viewport_size,
426
- ) / uinode. size ( ) . y ;
427
-
428
- extracted_uinodes. uinodes . insert (
429
- entity,
430
- ExtractedUiMaterialNode {
431
- stack_index,
432
- transform : transform. compute_matrix ( ) ,
433
- material : handle. id ( ) ,
434
- rect : Rect {
435
- min : Vec2 :: ZERO ,
436
- max : uinode. calculated_size ,
437
- } ,
438
- border : [ left, right, top, bottom] ,
439
- clip : clip. map ( |clip| clip. clip ) ,
440
- camera_entity,
400
+ // Skip loading materials
401
+ if !materials. contains ( handle) {
402
+ continue ;
403
+ }
404
+
405
+ // Both vertical and horizontal percentage border values are calculated based on the width of the parent node
406
+ // <https://developer.mozilla.org/en-US/docs/Web/CSS/border-width>
407
+ let parent_width = uinode. size ( ) . x ;
408
+ let left =
409
+ resolve_border_thickness ( style. border . left , parent_width, ui_logical_viewport_size)
410
+ / uinode. size ( ) . x ;
411
+ let right =
412
+ resolve_border_thickness ( style. border . right , parent_width, ui_logical_viewport_size)
413
+ / uinode. size ( ) . x ;
414
+ let top =
415
+ resolve_border_thickness ( style. border . top , parent_width, ui_logical_viewport_size)
416
+ / uinode. size ( ) . y ;
417
+ let bottom =
418
+ resolve_border_thickness ( style. border . bottom , parent_width, ui_logical_viewport_size)
419
+ / uinode. size ( ) . y ;
420
+
421
+ extracted_uinodes. uinodes . insert (
422
+ entity,
423
+ ExtractedUiMaterialNode {
424
+ stack_index : uinode. stack_index ,
425
+ transform : transform. compute_matrix ( ) ,
426
+ material : handle. id ( ) ,
427
+ rect : Rect {
428
+ min : Vec2 :: ZERO ,
429
+ max : uinode. calculated_size ,
441
430
} ,
442
- ) ;
443
- } ;
431
+ border : [ left, right, top, bottom] ,
432
+ clip : clip. map ( |clip| clip. clip ) ,
433
+ camera_entity,
434
+ } ,
435
+ ) ;
444
436
}
445
437
}
446
438
0 commit comments