public override void Draw(RenderContext context) { // 1) Clear the cache of current lights (without destroying collections but keeping previously allocated ones) lightsCollected.Clear(); // 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()) { continue; } lightsCollected.Add(light); } }
protected override void OnEntityAdding(Entity entity, LightComponent state) { base.OnEntityAdding(entity, state); lights.Add(state); }