A Viewport3D subclass that shields Panel3D from needing to arrange the 3D models in a specific order. For models to be truly transparent, and have the models 'behind' them be visible, they must exist in the Children collection in the opposite order of the way you see them on-screen. The front model must be the last child, and the back model must be the first child (not including the scene's light source).
Inheritance: System.Windows.Controls.Viewport3D
Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        public Panel3D()
        {
            // Create the viewport that hosts the child elements.
            _viewport = CreateViewport();

            // Configure the timer that is used to clean up after the 3D models move.
            _moveItemsCompletionTimer       = new DispatcherTimer(DispatcherPriority.Normal);
            _moveItemsCompletionTimer.Tick += this.OnMoveItemsCompleted;

            this.Loaded += this.OnLoaded;
        }
Esempio n. 2
0
        static Viewport3DEx CreateViewport()
        {
            var viewport = new Viewport3DEx
            {
                Camera = new PerspectiveCamera
                {
                    LookDirection = new Vector3D(2, 0, -10),
                    Position      = new Point3D(-3.18, 2, 3),
                    UpDirection   = new Vector3D(0, 1, 0)
                }
            };

            viewport.Children.Add(new ModelVisual3D
            {
                Content = new AmbientLight(Colors.White)
            });

            return(viewport);
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        public Panel3D()
        {
            // Create the viewport that hosts the child elements.
            _viewport = CreateViewport();

            // Configure the timer that is used to clean up after the 3D models move.
            _moveItemsCompletionTimer = new DispatcherTimer(DispatcherPriority.Normal);
            _moveItemsCompletionTimer.Tick += this.OnMoveItemsCompleted;

            this.Loaded += this.OnLoaded;
        }
Esempio n. 4
0
        static Viewport3DEx CreateViewport()
        {
            var viewport = new Viewport3DEx
            {
                Camera = new PerspectiveCamera
                {
                    LookDirection = new Vector3D(2, 0, -10),
                    Position = new Point3D(-3.18, 2, 3),
                    UpDirection = new Vector3D(0, 1, 0)
                }
            };

            viewport.Children.Add(new ModelVisual3D
            {
                Content = new AmbientLight(Colors.White)
            });

            return viewport;
        }