rendering, physics, player and camera WIP
This commit is contained in:
23
src/systems/render.rs
Normal file
23
src/systems/render.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
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()
|
||||
}
|
||||
Reference in New Issue
Block a user