Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
    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);
    }
Ejemplo n.º 3
0
        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;
        }