private void CaptureLightRectangle(TaskSettings taskSettings = null, bool autoHideForm = true) { if (taskSettings == null) { taskSettings = TaskSettings.GetDefaultTaskSettings(); } DoCapture(() => { Image img = null; using (RectangleLight rectangleLight = new RectangleLight()) { if (rectangleLight.ShowDialog() == DialogResult.OK) { img = rectangleLight.GetAreaImage(); if (img != null) { isLightCapture = true; } } } return(img); }, CaptureType.Rectangle, taskSettings, autoHideForm); }
public void OnEnable( ) { Lightmapping.RequestLightsDelegate testDel = (Light [] requests, Unity.Collections.NativeArray <LightDataGI> lightsOutput) => { DirectionalLight dLight = new DirectionalLight( ); PointLight point = new PointLight( ); SpotLight spot = new SpotLight( ); RectangleLight rect = new RectangleLight( ); LightDataGI ld = new LightDataGI( ); for (int i = 0; i < requests.Length; i++) { Light l = requests [i]; switch (l.type) { case UnityEngine.LightType.Directional: LightmapperUtils.Extract(l, ref dLight); ld.Init(ref dLight); break; case UnityEngine.LightType.Point: LightmapperUtils.Extract(l, ref point); ld.Init(ref point); break; case UnityEngine.LightType.Spot: LightmapperUtils.Extract(l, ref spot); ld.Init(ref spot); break; case UnityEngine.LightType.Area: LightmapperUtils.Extract(l, ref rect); ld.Init(ref rect); break; default: ld.InitNoBake(l.GetInstanceID( )); break; } ld.falloff = FalloffType.InverseSquared; lightsOutput [i] = ld; } }; Lightmapping.SetDelegate(testDel); }
private void btnCaptureArea_Click(object sender, RoutedEventArgs e) { WindowState = WindowState.Minimized; Thread.Sleep(300); RectangleLight crop = new RectangleLight(); if (crop.ShowDialog() == true) { editor.LoadImage(crop.GetScreenshot()); } WindowState = WindowState.Normal; }