private static void bloom_OnClick(object sender, bool status) { ConfigManager.sBloom = status; if (!BloomRenderer.Initialize()) { ConfigManager.sBloom = false; ((pCheckbox)sender).SetStatusQuietly(false); } }
private static void BloomRendererHook(On.Celeste.BloomRenderer.orig_Apply orig, BloomRenderer self, VirtualRenderTarget target, Scene scene) { if (alphaFade < 1f) { // multiply all alphas by alphaFade, and back up original values. List <BloomPoint> affectedBloomPoints = new List <BloomPoint>(); List <float> originalAlpha = new List <float>(); foreach (BloomPoint bloomPoint in scene.Tracker.GetComponents <BloomPoint>().ToArray()) { if (bloomPoint.Visible && !(bloomPoint.Entity is Payphone)) { affectedBloomPoints.Add(bloomPoint); originalAlpha.Add(bloomPoint.Alpha); bloomPoint.Alpha *= alphaFade; } } // render the bloom. orig(self, target, scene); // restore original alphas. int index = 0; foreach (BloomPoint bloomPoint in affectedBloomPoints) { bloomPoint.Alpha = originalAlpha[index++]; } } else { // alpha multiplier is 1: nothing to modify, go on with vanilla. orig(self, target, scene); } }