use crate::ecs::primitives::Name;
use crate::ecs::transform::components::LocalTransform;
use crate::ecs::transform::systems::setup_entity_transforms;
use crate::ecs::world::commands::spawn_entities;
use crate::ecs::world::{Entity, GLOBAL_TRANSFORM, LIGHT, LOCAL_TRANSFORM, NAME, World};
pub fn spawn_light_entity(world: &mut World, position: nalgebra_glm::Vec3, name: &str) -> Entity {
let entity = spawn_entities(world, NAME | LOCAL_TRANSFORM | GLOBAL_TRANSFORM | LIGHT, 1)[0];
world.set(entity, Name(name.to_string()));
setup_entity_transforms(
world,
entity,
LocalTransform {
translation: position,
rotation: nalgebra_glm::quat_identity(),
scale: nalgebra_glm::Vec3::new(1.0, 1.0, 1.0),
},
);
entity
}