fix: the code in flat_map should now be correct and changed formatting in renderer2d

This commit is contained in:
lisk77 2025-03-02 23:27:10 +01:00
parent ac63691fe3
commit 30cda18ce1
6 changed files with 483 additions and 11 deletions

View file

@ -782,17 +782,17 @@ impl<'a> Renderer2D<'a> {
self.camera_uniform = camera_uniform;
self.camera_bind_group = camera_bind_group;
let mut visible_entities: Vec<u32> = vec![];
for entity in world.entities() {
if camera_component.in_view_frustum(*camera_position, *world.get_component::<Transform2D>(*entity.clone().unwrap().id() as usize).unwrap().position()) {
if let Some(render) = world.get_component::<Render2D>(*entity.clone().unwrap().id() as usize) {
if render.is_visible() {
visible_entities.push(*entity.clone().unwrap().id());
}
}
}
}
println!("{:?}", visible_entities);
let mut visible_entities: Vec<u32> = vec![];
for entity in world.entities() {
if camera_component.in_view_frustum(*camera_position, *world.get_component::<Transform2D>(*entity.clone().unwrap().id() as usize).unwrap().position()) {
if let Some(render) = world.get_component::<Render2D>(*entity.clone().unwrap().id() as usize) {
if render.is_visible() {
visible_entities.push(*entity.clone().unwrap().id());
}
}
}
}
println!("{:?}", visible_entities);
}