Esempio n. 1
0
        private void Apply(object sender, RoutedEventArgs e)
        {
            this.cx = (TextBox)FindName("CX");
            this.cy = (TextBox)FindName("CY");
            this.cz = (TextBox)FindName("CZ");
            this.nx = (TextBox)FindName("NX");
            this.ny = (TextBox)FindName("NY");
            this.nz = (TextBox)FindName("NZ");

            PerspectiveCamera perspectiveCamera = new PerspectiveCamera();

            perspectiveCamera.Position = new Point3D(double.Parse(cx.Text.ToString(), CultureInfo.InvariantCulture),
                                                     double.Parse(cy.Text.ToString(), CultureInfo.InvariantCulture),
                                                     double.Parse(cz.Text.ToString(), CultureInfo.InvariantCulture));
            perspectiveCamera.LookDirection = new Vector3D(double.Parse(nx.Text.ToString(), CultureInfo.InvariantCulture),
                                                           double.Parse(ny.Text.ToString(), CultureInfo.InvariantCulture),
                                                           double.Parse(nz.Text.ToString(), CultureInfo.InvariantCulture));
            perspectiveCamera.SetCurrentValue(FrameworkElement.NameProperty, "perspectiveCameraEditor");

            viewport3D.Camera = perspectiveCamera;

            this.Close();
        }