use fparkan_fx::environment::{EnvironmentFrame, PointLightFrame}; use fparkan_render_vulkan::{VulkanPointLight, VulkanSmokeRenderer, VulkanSmokeRendererError}; pub(super) fn upload( renderer: &mut VulkanSmokeRenderer, enabled: bool, environment: Option<&EnvironmentFrame>, control_lights: &[VulkanPointLight], ) -> Result<(), VulkanSmokeRendererError> { if !enabled { return renderer.set_point_lights(&[]); } let Some(environment) = environment else { return renderer.set_point_lights(control_lights); }; let lights = environment .point_lights .iter() .filter(|light| light.active) .map(environment_record) .chain(control_lights.iter().copied()) .collect::>(); renderer.set_point_lights(&lights) } pub(super) fn environment_record(light: &PointLightFrame) -> VulkanPointLight { VulkanPointLight { owner_scope: 0, position: light.position, rgb: [light.color[0], light.color[1], light.color[2]], range: light.range, coefficients: light.attenuation, active: light.active, } }