mirror of
https://github.com/lisk77/comet.git
synced 2025-12-12 17:18:50 +00:00
refactor(ecs)!: reworked the entity id system
This commit is contained in:
parent
eced6ddf3f
commit
607bf94f1e
7 changed files with 198 additions and 95 deletions
|
|
@ -436,13 +436,15 @@ impl Camera for Camera2D {
|
|||
let entities = scene.entities();
|
||||
let mut visible_entities = Vec::new();
|
||||
for entity in entities {
|
||||
let id = *entity.clone().unwrap().id() as usize;
|
||||
if let Some(transform) = scene.get_component::<Transform2D>(id) {
|
||||
if self.in_view_frustum(camera_position, transform.position()) {
|
||||
visible_entities.push(entity.clone().unwrap());
|
||||
if let Some(ent) = entity.clone() {
|
||||
let id = ent.id();
|
||||
if let Some(transform) = scene.get_component::<Transform2D>(id) {
|
||||
if self.in_view_frustum(camera_position, transform.position()) {
|
||||
visible_entities.push(ent);
|
||||
}
|
||||
} else {
|
||||
error!("Entity {} missing Transform2D", id.index);
|
||||
}
|
||||
} else {
|
||||
error!("Entity {} missing Transform2D", id);
|
||||
}
|
||||
}
|
||||
visible_entities
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue