fix: changed the name of World to Scene (because the name fits better)

This commit is contained in:
lisk77 2025-03-11 01:23:33 +01:00
parent e94df6c221
commit ab73b145b1
8 changed files with 55 additions and 57 deletions

View file

@ -9,7 +9,7 @@ use crate::math::{
Vec3
};
use component_derive::Component;
use crate::{Entity, World};
use crate::{Entity, Scene};
// ##################################################
// # BASIC #
@ -101,7 +101,7 @@ pub trait Render {
}
pub trait Camera {
fn get_visible_entities(&self, camera_position: Position2D, world: World) -> Vec<Entity>;
fn get_visible_entities(&self, camera_position: Position2D, scene: Scene) -> Vec<Entity>;
fn get_projection_matrix(&self) -> Mat4;
}
@ -328,11 +328,11 @@ impl Camera2D {
}
impl Camera for Camera2D {
fn get_visible_entities(&self, camera_position: Position2D, world: World) -> Vec<Entity> {
let entities = world.entities();
fn get_visible_entities(&self, camera_position: Position2D, scene: Scene) -> Vec<Entity> {
let entities = scene.entities();
let mut visible_entities = Vec::new();
for entity in entities {
if self.in_view_frustum(camera_position, *world.get_component::<Transform2D>(*entity.clone().unwrap().id() as usize).unwrap().position()) {
if self.in_view_frustum(camera_position, *scene.get_component::<Transform2D>(*entity.clone().unwrap().id() as usize).unwrap().position()) {
visible_entities.push(entity.clone().unwrap());
}
}