----------------------------------- LightSystem::OnComponentAdded Register lights in the render scene when they are added to the ECS
| 31 | // Register lights in the render scene when they are added to the ECS |
| 32 | // |
| 33 | void LightSystem::OnComponentAdded(EcsController& controller, LightComponent& component, T_EntityId const entity) |
| 34 | { |
| 35 | vec3 const col = component.m_Color * component.m_Brightness; |
| 36 | |
| 37 | component.m_LightId = UnifiedScene::Instance().GetRenderScene().AddLight(col, |
| 38 | controller.GetComponent<TransformComponent>(entity).GetNodeId(), |
| 39 | component.m_Type == LightComponent::E_Type::Directional, |
| 40 | component.m_CastsShadow); |
| 41 | } |
| 42 | |
| 43 | //------------------------------------- |
| 44 | // LightSystem::OnComponentRemoved |