fn push_draw_data(
                view_frame_index: ViewFrameIndex,
                render_phase_index: RenderPhaseIndex,
                pass: ResourceArc<MaterialPassResource>,
                mesh_part: &MeshAdvAssetPart,
                batched_passes: &AtomicOnceCell<Vec<MeshAdvBatchedPassInfo>>,
                batched_pass_lookup: &AtomicOnceCell<FnvHashMap<MeshAdvBatchedPassKey, usize>>,
                model_matrix_offset: usize,
                mesh_part_material_index: u32,
                use_full_vertices: bool,
            ) -> PushDrawDataResult {
                let batch_key = MeshAdvBatchedPassKey {
                    phase: render_phase_index,
                    view_frame_index,
                    pass,
                    index_type: mesh_part.index_type,
                };
                //println!("pushing to key view={} index_type={:?} pass={:?}", batch_key.view_index, batch_key.index_type, batch_key.pass.get_raw().material_pass_key);
                let batch_index = *batched_pass_lookup.get().get(&batch_key).unwrap();
                //println!("batch index {}", batch_index);

                let batched_pass = &batched_passes.get()[batch_index];
                let draw_data_index = batched_pass.draw_data.len() as u32;

                let (vertex_size, vertex_buffer_offset_in_bytes) = if use_full_vertices {
                    (
                        std::mem::size_of::<MeshVertexFull>() as u32,
                        mesh_part.vertex_full_buffer_offset_in_bytes,
                    )
                } else {
                    (
                        std::mem::size_of::<MeshVertexPosition>() as u32,
                        mesh_part.vertex_position_buffer_offset_in_bytes,
                    )
                };

                assert!(vertex_buffer_offset_in_bytes % vertex_size as u32 == 0);
                let vertex_offset = vertex_buffer_offset_in_bytes / vertex_size;

                let index_size_in_bytes = mesh_part.index_type.size_in_bytes() as u32;
                assert!(mesh_part.index_buffer_size_in_bytes % index_size_in_bytes == 0);
                assert!(mesh_part.index_buffer_offset_in_bytes % index_size_in_bytes == 0);

                batched_pass.draw_data.push(MeshAdvBatchDrawData {
                    material_index: mesh_part_material_index,
                    index_count: mesh_part.index_buffer_size_in_bytes / index_size_in_bytes,
                    index_offset: mesh_part.index_buffer_offset_in_bytes / index_size_in_bytes,
                    transform_index: model_matrix_offset as u32,
                    vertex_offset,
                });

                PushDrawDataResult {
                    batch_index: batch_index as u32,
                    draw_data_index,
                }
            }
// helper function that finds the correct batch and pushes draw data into it
helper function that finds the correct batch and pushes draw data into it
helper function that finds the correct batch and pushes draw data into it
fn push_draw_data(
                view_frame_index: ViewFrameIndex,
                render_phase_index: RenderPhaseIndex,
                pass: ResourceArc<MaterialPassResource>,
                mesh_part: &MeshAdvAssetPart,
                batched_passes: &AtomicOnceCell<Vec<MeshAdvBatchedPassInfo>>,
                batched_pass_lookup: &AtomicOnceCell<FnvHashMap<MeshAdvBatchedPassKey, usize>>,
                model_matrix_offset: usize,
                mesh_part_material_index: u32,
                use_full_vertices: bool,
            ) -> PushDrawDataResult {
                let batch_key = MeshAdvBatchedPassKey {
                    phase: render_phase_index,
                    view_frame_index,
                    pass,
                    index_type: mesh_part.index_type,
                };
                //println!("pushing to key view={} index_type={:?} pass={:?}", batch_key.view_index, batch_key.index_type, batch_key.pass.get_raw().material_pass_key);
                let batch_index = *batched_pass_lookup.get().get(&batch_key).unwrap();
                //println!("batch index {}", batch_index);
                let batched_pass = &batched_passes.get()[batch_index];
                let draw_data_index = batched_pass.draw_data.len() as u32;
                let (vertex_size, vertex_buffer_offset_in_bytes) = if use_full_vertices {
                    (
                        std::mem::size_of::<MeshVertexFull>() as u32,
                        mesh_part.vertex_full_buffer_offset_in_bytes,
                    )
                } else {
                    (
                        std::mem::size_of::<MeshVertexPosition>() as u32,
                        mesh_part.vertex_position_buffer_offset_in_bytes,
                    )
                };
                assert!(vertex_buffer_offset_in_bytes % vertex_size as u32 == 0);
                let vertex_offset = vertex_buffer_offset_in_bytes / vertex_size;
                let index_size_in_bytes = mesh_part.index_type.size_in_bytes() as u32;
                assert!(mesh_part.index_buffer_size_in_bytes % index_size_in_bytes == 0);
                assert!(mesh_part.index_buffer_offset_in_bytes % index_size_in_bytes == 0);
                batched_pass.draw_data.push(MeshAdvBatchDrawData {
                    material_index: mesh_part_material_index,
                    index_count: mesh_part.index_buffer_size_in_bytes / index_size_in_bytes,
                    index_offset: mesh_part.index_buffer_offset_in_bytes / index_size_in_bytes,
                    transform_index: model_matrix_offset as u32,
                    vertex_offset,
                });
                PushDrawDataResult {
                    batch_index: batch_index as u32,
                    draw_data_index,
                }
            }
fn push_draw_data ( view_frame_index : ViewFrameIndex , render_phase_index : RenderPhaseIndex , pass : ResourceArc < MaterialPassResource > , mesh_part : & MeshAdvAssetPart , batched_passes : & AtomicOnceCell < Vec < MeshAdvBatchedPassInfo > > , batched_pass_lookup : & AtomicOnceCell < FnvHashMap < MeshAdvBatchedPassKey , usize > > , model_matrix_offset : usize , mesh_part_material_index : u32 , use_full_vertices : bool , ) -> PushDrawDataResult { let batch_key = MeshAdvBatchedPassKey { phase : render_phase_index , view_frame_index , pass , index_type : mesh_part . index_type , } ; //println!("pushing to key view={} index_type={:?} pass={:?}", batch_key.view_index, batch_key.index_type, batch_key.pass.get_raw().material_pass_key); let batch_index = * batched_pass_lookup . get ( ) . get ( & batch_key ) . unwrap ( ) ; //println!("batch index {}", batch_index); let batched_pass = & batched_passes . get ( ) [ batch_index ] ; let draw_data_index = batched_pass . draw_data . len ( ) as u32 ; let ( vertex_size , vertex_buffer_offset_in_bytes ) = if use_full_vertices { ( std :: mem :: size_of :: < MeshVertexFull > ( ) as u32 , mesh_part . vertex_full_buffer_offset_in_bytes , ) } else { ( std :: mem :: size_of :: < MeshVertexPosition > ( ) as u32 , mesh_part . vertex_position_buffer_offset_in_bytes , ) } ; assert ! ( vertex_buffer_offset_in_bytes vertex_size as u32 0 ) ; let vertex_offset = vertex_buffer_offset_in_bytes / vertex_size ; let index_size_in_bytes = mesh_part . index_type . size_in_bytes ( ) as u32 ; assert ! ( mesh_part index_buffer_size_in_bytes index_size_in_bytes 0 ) ; assert ! ( mesh_part index_buffer_offset_in_bytes index_size_in_bytes 0 ) ; batched_pass . draw_data . push ( MeshAdvBatchDrawData { material_index : mesh_part_material_index , index_count : mesh_part . index_buffer_size_in_bytes / index_size_in_bytes , index_offset : mesh_part . index_buffer_offset_in_bytes / index_size_in_bytes , transform_index : model_matrix_offset as u32 , vertex_offset , } ) ; PushDrawDataResult { batch_index : batch_index as u32 , draw_data_index , } }
helper function that finds the correct batch and pushes draw data into it
helper function that finds the correct batch and pushes draw data into it
view_frame_index
ViewFrameIndex
render_phase_index
RenderPhaseIndex
pass
ResourceArc<MaterialPassResource>
mesh_part
&MeshAdvAssetPart
batched_passes
&AtomicOnceCell<Vec<MeshAdvBatchedPassInfo>>
batched_pass_lookup
&AtomicOnceCell<FnvHashMap<MeshAdvBatchedPassKey, usize>>
model_matrix_offset
usize
mesh_part_material_index
u32
use_full_vertices
bool
view_frame_index
ViewFrameIndex
render_phase_index
RenderPhaseIndex
pass
ResourceArc<MaterialPassResource>
mesh_part
&MeshAdvAssetPart
batched_passes
&AtomicOnceCell<Vec<MeshAdvBatchedPassInfo>>
batched_pass_lookup
&AtomicOnceCell<FnvHashMap<MeshAdvBatchedPassKey, usize>>
model_matrix_offset
usize
mesh_part_material_index
u32
use_full_vertices
bool