feo_oop_engine/scene/game_object/light/
mod.rs1pub mod directional_light;
6pub mod ambient_light;
7pub mod point_light;
8
9use std::{any::Any, sync::{Arc, RwLock}};
10
11use crate::graphics::graphics_system::GraphicsSystemTrait;
12
13use super::GameObject;
14
15pub trait Light: LightClone + GameObject + GraphicsSystemTrait {
17 fn as_any(&self) -> &dyn Any;
18 fn as_gameobject(&self) -> &dyn GameObject;
19 fn cast_gameobject_arc_rwlock(&self, this: Arc<RwLock<dyn Light>>) -> Arc<RwLock<dyn GameObject>>;
20}
21
22pub trait LightClone {
24 fn clone_camera(&self) -> Box<dyn Light>;
25}
26
27impl<T> LightClone for T where T: 'static + Light + Clone {
28 fn clone_camera(&self) -> Box<dyn Light> {
29 Box::new(self.clone())
30 }
31}
32
33impl Clone for Box<dyn Light> {
34 fn clone(&self) -> Self {
35 self.clone_camera()
36 }
37}