MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / render

Method render

native/shared/src/scene.rs:969–987  ·  view source on GitHub ↗

Render all visible scene nodes into the given render pass. Must be called after prepare() and after the pipeline/lighting/joints are set.

(
        &'a self,
        pass: &mut wgpu::RenderPass<'a>,
    )

Source from the content-addressed store, hash-verified

967 /// Render all visible scene nodes into the given render pass.
968 /// Must be called after prepare() and after the pipeline/lighting/joints are set.
969 pub fn render<'a>(
970 &'a self,
971 pass: &mut wgpu::RenderPass<'a>,
972 ) {
973 for (_handle, node) in self.nodes.iter() {
974 if !node.visible || node.indices.is_empty() || !node.in_view_frustum {
975 continue;
976 }
977 let Some(vb) = &node.gpu_vb else { continue };
978 let Some(ib) = &node.gpu_ib else { continue };
979 let Some(bg) = &node.gpu_uniform_bg else { continue };
980 let Some(mat_bg) = &node.gpu_material_bg else { continue };
981 pass.set_bind_group(0, bg, &[]);
982 pass.set_bind_group(2, mat_bg, &[]);
983 pass.set_vertex_buffer(0, vb.slice(..));
984 pass.set_index_buffer(ib.slice(..), wgpu::IndexFormat::Uint32);
985 pass.draw_indexed(0..node.gpu_index_count, 0, 0..1);
986 }
987 }
988
989 pub fn node_count(&self) -> usize {
990 self.nodes.iter().count()

Callers 2

mainFunction · 0.80
end_frame_with_sceneMethod · 0.80

Calls 4

iterMethod · 0.80
sliceMethod · 0.80
set_vertex_bufferMethod · 0.45
set_index_bufferMethod · 0.45

Tested by

no test coverage detected