Files
snow_trail/src/systems/render.rs
2026-01-01 19:54:00 +01:00

24 lines
730 B
Rust

use crate::render::DrawCall;
use crate::world::World;
pub fn render_system(world: &World) -> Vec<DrawCall>
{
let all_entities = world.entities.all_entities();
all_entities
.iter()
.filter_map(|&entity| {
let transform = world.transforms.get(entity)?;
let mesh_component = world.meshes.get(entity)?;
Some(DrawCall {
vertex_buffer: mesh_component.mesh.vertex_buffer.clone(),
index_buffer: mesh_component.mesh.index_buffer.clone(),
num_indices: mesh_component.mesh.num_indices,
model: transform.to_matrix(),
pipeline: mesh_component.pipeline,
})
})
.collect()
}