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>,
)
| 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() |
no test coverage detected