public override void Draw(RenderContext context) { // 1) Clear the cache of current lights (without destroying collections but keeping previously allocated ones) lightsCollected.Clear(); var colorSpace = context.GraphicsDevice.ColorSpace; // 2) Prepare lights to be dispatched to the correct light group for (int i = 0; i < lights.Count; i++) { var light = lights.Items[i]; if (!light.Update(colorSpace)) { continue; } lightsCollected.Add(light); } }
protected override void OnEntityComponentAdding(Entity entity, LightComponent component, LightComponent state) { lights.Add(state); }
protected override void OnEntityAdding(Entity entity, LightComponent state) { base.OnEntityAdding(entity, state); lights.Add(state); }