예제 #1
0
        private void RadioButtonLight_Checked(object sender, RoutedEventArgs e)
        {
            if (cont != null)
            {
                List <LightSetup> lights = new List <LightSetup>();

                foreach (object obj in cont.Children)
                {
                    if (obj is LightSetup)
                    {
                        lights.Add((LightSetup)obj);
                    }
                }

                foreach (LightSetup lsetup in lights)
                {
                    cont.Children.Remove(lsetup);
                }


                if (RB_DefaultLight.IsChecked == true)
                {
                    Debug.WriteLine("DEFAULTLIGHT");
                    DefaultLights defaultLights = new DefaultLights();
                    cont.Children.Add(defaultLights);
                }
                else if (RB_SunLight.IsChecked == true)
                {
                    Debug.WriteLine("SUNLIGHT");
                    SunLight sunLight = new SunLight();
                    cont.Children.Add(sunLight);
                }
                else if (RB_SpotLight.IsChecked == true)
                {
                    Debug.WriteLine("SPOTLIGHT");
                    SpotHeadLight spotHeadLight = new SpotHeadLight();
                    cont.Children.Add(spotHeadLight);
                }
            }
        }
예제 #2
0
        public void Deserialize(HelixViewport3D control, DataStore data)
        {
            List <object> list = new List <object>(2);

            list.Add(null);
            list.Add(null);

            DeserializeDefault(control);
            brush.Deserialize(control, data);

            list[1] = control.Tag;

            Debug.WriteLine("ModelP:  Path: " + modelp.LocalPathToModel);

            if (modelp != null)
            {
                if (!String.IsNullOrWhiteSpace(modelp.LocalPathToModel))
                {
                    string lpath = System.IO.Path.Combine(LocalPath.GetResourcesPath(), modelp.LocalPathToModel);
                    if (File.Exists(lpath))
                    {
                        LoadModel(control, lpath);
                        list[0] = control.Tag;
                    }
                    else
                    {
                        DefaultModel(control);
                    }
                }
                else
                {
                    DefaultModel(control);
                }
            }
            else
            {
                DefaultModel(control);
            }

            if (camera != null)
            {
                camera.Deserialize(control.Camera);
            }

            if (lightType == ModelLightType.LightType.SpotHeadlight)
            {
                SpotHeadLight spotHeadLight = new SpotHeadLight();
                control.Children.Add(spotHeadLight);
            }
            else if (lightType == ModelLightType.LightType.SunLight)
            {
                SunLight sunLight = new SunLight();
                control.Children.Add(sunLight);
            }
            else
            {
                DefaultLights defaultLights = new DefaultLights();
                control.Children.Add(defaultLights);
            }

            control.Tag = list;


            control.Loaded += (s, e) => {
                if (control.CameraController != null)
                {
                    control.CameraController.IsEnabled = CameraControl;
                }

                control.ShowViewCube = CameraControl;
            };
        }