예제 #1
0
        private void DisposeDXViewportView()
        {
            if (_mainDXViewportView == null)
            {
                return;
            }

            if (_camera1 != null)
            {
                _camera1.StopRotation();
                RootGrid.Children.Remove(_camera1);

                _camera1 = null;
            }

            if (_mouseCameraController != null)
            {
                RootGrid.Children.Remove(_mouseCameraController);
                _mouseCameraController = null;
            }


            _mainDXViewportView.SceneRendered -= MainDxViewportViewOnSceneRendered;

            _mainDXViewportView.Dispose();
            _mainDXViewportView = null;
        }
예제 #2
0
 protected override void Awake()
 {
     thisTransform       = transform;
     characterController = GetComponent <CatlikeController>();
     cameraController    = GetComponentInChildren <MouseCameraController>();
     view  = GetComponent <PhotonView>();
     delay = new WaitForSeconds(delayTime);
 }
예제 #3
0
        private DXViewportView CreateSimpleDXSceneViewFromCode(DXViewportView masterDXViewportView, RenderingTypes renderingType, out TargetPositionCamera targetPositionCamera, out MouseCameraController mouseCameraController)
        {
            Viewport3D viewport3D = new Viewport3D();

            DXViewportView createDXViewportView;

            if (masterDXViewportView != null)
            {
                // Create a child DXViewportView with using a constructor that takes a masterDXViewportView.
                // When useMasterRenderingSteps parameter is true (by default), then the RenderingSteps in the master DXViewportView.DXScene are used.
                // To customize rendering of a child DXViewportView, set useMasterRenderingSteps to false. This will create new RenderingSteps that can be customized (see below).

                bool useMasterRenderingSteps = renderingType == RenderingTypes.Standard;

                createDXViewportView = new DXViewportView(masterDXViewportView, viewport3D, useMasterRenderingSteps);
            }
            else
            {
                // Create master DXViewportView with using constructor that takes only Viewport3D.
                createDXViewportView = new DXViewportView(viewport3D);
            }

            createDXViewportView.DXSceneDeviceCreated += delegate(object sender, EventArgs e)
            {
                // Enable transparency sorting for each View (this way transparent objects are correctly rendered for each child view camera).
                createDXViewportView.DXScene.IsTransparencySortingEnabled = true;

                SetSpecialRenderingType(createDXViewportView, renderingType);
            };


            // Because each view supports its own camera, we need to create a new TargetPositionCamera and MouseCameraController for each view.

            double cameraHeading = masterDXViewportView == null ? 30 : _rnd.Next(360);

            targetPositionCamera = new TargetPositionCamera()
            {
                TargetPosition   = new Point3D(0, 0, 0),
                Heading          = cameraHeading,
                Attitude         = -20,
                ShowCameraLight  = ShowCameraLightType.Never, // If we have a camera light then the light position will be defined (and changed) with changing the camera position in one view
                Distance         = 1000,
                TargetViewport3D = viewport3D
            };

            mouseCameraController = new MouseCameraController()
            {
                TargetCamera           = targetPositionCamera,
                RotateCameraConditions = MouseCameraController.MouseAndKeyboardConditions.LeftMouseButtonPressed,
                MoveCameraConditions   = MouseCameraController.MouseAndKeyboardConditions.ControlKey | MouseCameraController.MouseAndKeyboardConditions.LeftMouseButtonPressed
            };

            return(createDXViewportView);
        }
예제 #4
0
        private void CreateDXViewportView(bool isDirectXOverlay)
        {
            _mainViewport3D = new Viewport3D();

            _lightsGroup = new Model3DGroup();
            _mainViewport3D.Children.Add(_lightsGroup.CreateModelVisual3D());

            UpdateLightingMode();

            _camera1 = new TargetPositionCamera()
            {
                TargetPosition   = new Point3D(0, 0, 0),
                Heading          = 30,
                Attitude         = -10,
                Distance         = 1500,
                ShowCameraLight  = ShowCameraLightType.Never,
                TargetViewport3D = _mainViewport3D
            };

            _mouseCameraController = new MouseCameraController()
            {
                RotateCameraConditions = MouseCameraController.MouseAndKeyboardConditions.LeftMouseButtonPressed,
                MoveCameraConditions   = MouseCameraController.MouseAndKeyboardConditions.LeftMouseButtonPressed | MouseCameraController.MouseAndKeyboardConditions.ControlKey,
                EventsSourceElement    = ViewportBorder,
                TargetCamera           = _camera1
            };

            RootGrid.Children.Add(_camera1);
            RootGrid.Children.Add(_mouseCameraController);


            _mainDXViewportView = new DXViewportView(_mainViewport3D)
            {
                BackgroundColor  = Colors.White,
                PresentationType = isDirectXOverlay ? DXView.PresentationTypes.DirectXOverlay : DXView.PresentationTypes.DirectXImage
            };

            var maxBackgroundThreadsCount = (int)ThreadsCountSlider.Value;

            _mainDXViewportView.DXSceneDeviceCreated += delegate(object sender, EventArgs args)
            {
                if (_mainDXViewportView.DXScene != null)
                {
                    _mainDXViewportView.DXScene.MaxBackgroundThreadsCount = maxBackgroundThreadsCount;
                }
            };

            _mainDXViewportView.SceneRendered += MainDxViewportViewOnSceneRendered;

            ViewportBorder.Child = _mainDXViewportView;

            _camera1.StartRotation(40, 0);


            // Notify MainWindow about a new MainDXViewportView - so we can open DiagnosticsWindow
            if (_parentWindow != null)
            {
                ((MainWindow)_parentWindow).UnsubscribeLastShownDXViewportView();
                ((MainWindow)_parentWindow).SubscribeDXViewportView(_mainDXViewportView);

                ((MainWindow)_parentWindow).MaxBackgroundThreadsCount = maxBackgroundThreadsCount;  // prevent setting MaxBackgroundThreadsCount from the setting dialog
            }
        }
예제 #5
0
        private void SetUpWpf3D()
        {
            // The following controls are usually defined in XAML in Wpf project
            // But here we can also define them in code.

            // We need a root grid because we will host more than one control
            _rootGrid            = new Grid();
            _rootGrid.Background = System.Windows.Media.Brushes.White;


            // Viewport3D is a WPF control that can show 3D graphics
            _viewport3D = new Viewport3D();
            _rootGrid.Children.Add(_viewport3D);


            // Specify TargetPositionCamera that will show our 3D scene

            //<cameras:TargetPositionCamera Name="Camera1"
            //                    Heading="30" Attitude="-20" Bank="0"
            //                    Distance="1300" TargetPosition="0 0 0"
            //                    ShowCameraLight="Always"
            //                    TargetViewport3D="{Binding ElementName=MainViewport}"/>

            _targetPositionCamera = new Ab3d.Cameras.TargetPositionCamera()
            {
                TargetPosition   = new Point3D(0, 0, 0),
                Distance         = 1300,
                Heading          = 30,
                Attitude         = -20,
                ShowCameraLight  = ShowCameraLightType.Always,
                TargetViewport3D = _viewport3D
            };

            _rootGrid.Children.Add(_targetPositionCamera);


            // Set rotate to right mouse button
            // and move to CRTL + right mouse button
            // Left mouse button is left for clicking on the 3D objects

            //<controls:MouseCameraController Name="MouseCameraController1"
            //                                RotateCameraConditions="RightMouseButtonPressed"
            //                                MoveCameraConditions="ControlKey, RightMouseButtonPressed"
            //                                EventsSourceElement="{Binding ElementName=RootViewportBorder}"
            //                                TargetCamera="{Binding ElementName=Camera1}"/>

            _mouseCameraController = new Ab3d.Controls.MouseCameraController()
            {
                RotateCameraConditions = MouseCameraController.MouseAndKeyboardConditions.RightMouseButtonPressed,
                MoveCameraConditions   = MouseCameraController.MouseAndKeyboardConditions.RightMouseButtonPressed | MouseCameraController.MouseAndKeyboardConditions.ControlKey,
                EventsSourceElement    = _rootGrid,
                TargetCamera           = _targetPositionCamera
            };

            _rootGrid.Children.Add(_mouseCameraController);


            // Show buttons that can be used to rotate and move the camera

            //<controls:CameraControlPanel VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="5" Width="225" Height="75" ShowMoveButtons="True"
            //                                TargetCamera="{Binding ElementName=Camera1}"/>

            var cameraControlPanel = new Ab3d.Controls.CameraControlPanel()
            {
                VerticalAlignment   = VerticalAlignment.Bottom,
                HorizontalAlignment = HorizontalAlignment.Right,
                Margin          = new Thickness(5, 5, 5, 5),
                Width           = 225,
                Height          = 75,
                ShowMoveButtons = true,
                TargetCamera    = _targetPositionCamera
            };

            _rootGrid.Children.Add(cameraControlPanel);


            // Finally add the root WPF Grid to elementHost1
            elementHost1.Child = _rootGrid;
        }
예제 #6
0
        private void AddDXViewport3DGrid(string title, string subTitle, int multisamplingCount, int supersamplingCount, int rowIndex, int columnIndex)
        {
            var viewport3D = new Viewport3D();

            var sceneModelVisual3D = CreateScene();

            viewport3D.Children.Add(sceneModelVisual3D);


            var dxViewportView = new DXViewportView(viewport3D);

            // Set GraphicsProfile:
            var graphicsProfile = new GraphicsProfile(string.Format("{0}MSAA_{1}SSAA_HardwareRendering", multisamplingCount, supersamplingCount),
                                                      GraphicsProfile.DriverTypes.DirectXHardware,
                                                      ShaderQuality.High,
                                                      preferedMultisampleCount: multisamplingCount,
                                                      supersamplingCount: supersamplingCount,
                                                      textureFiltering: TextureFilteringTypes.Anisotropic_x4);

            dxViewportView.GraphicsProfiles = new GraphicsProfile[] { graphicsProfile, GraphicsProfile.Wpf3D }; // Add WPF 3D as fallback


            var border = new Border()
            {
                Background          = Brushes.Transparent,
                BorderBrush         = Brushes.Gray,
                BorderThickness     = new Thickness(1, 1, 1, 1),
                Margin              = new Thickness(1, 1, 3, 3),
                UseLayoutRounding   = true,
                SnapsToDevicePixels = true
            };

            border.Child = dxViewportView;


            var targetPositionCamera = new TargetPositionCamera()
            {
                TargetPosition   = new Point3D(15, 50, 5),
                Heading          = -17,
                Attitude         = -25,
                ShowCameraLight  = ShowCameraLightType.Always,
                Distance         = 80,
                TargetViewport3D = viewport3D
            };

            var mouseCameraController = new MouseCameraController()
            {
                TargetCamera           = targetPositionCamera,
                EventsSourceElement    = border,
                RotateCameraConditions = MouseCameraController.MouseAndKeyboardConditions.LeftMouseButtonPressed,
                MoveCameraConditions   = MouseCameraController.MouseAndKeyboardConditions.ControlKey | MouseCameraController.MouseAndKeyboardConditions.LeftMouseButtonPressed,
            };


            var titlesPanel = new StackPanel()
            {
                Orientation         = Orientation.Vertical,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
                Margin = new Thickness(10, 10, 10, 0)
            };

            if (title != null)
            {
                var textBlock = new TextBlock()
                {
                    Text         = title,
                    FontSize     = 18,
                    FontWeight   = FontWeights.Bold,
                    TextWrapping = TextWrapping.Wrap,
                    Foreground   = new SolidColorBrush(Color.FromRgb(32, 32, 32)),
                };

                titlesPanel.Children.Add(textBlock);
            }

            if (subTitle != null)
            {
                var textBlock = new TextBlock()
                {
                    Text         = subTitle,
                    FontSize     = 14,
                    TextWrapping = TextWrapping.Wrap,
                    Margin       = new Thickness(0, 3, 0, 0)
                };

                titlesPanel.Children.Add(textBlock);
            }


            var viewRootGrid = new Grid();

            viewRootGrid.Children.Add(border);
            viewRootGrid.Children.Add(titlesPanel);
            viewRootGrid.Children.Add(targetPositionCamera);
            viewRootGrid.Children.Add(mouseCameraController);


            Grid.SetColumn(viewRootGrid, columnIndex);
            Grid.SetRow(viewRootGrid, rowIndex);
            RootGrid.Children.Add(viewRootGrid);
        }
예제 #7
0
        private DXViewportView AddDXViewport3DGrid(string title, string graphicsProfileName, int multisamplingCount, int supersamplingCount, int rowIndex, int columnIndex)
        {
            var viewport3D = new Viewport3D();

            var sceneModelVisual3D = CreateScene();

            viewport3D.Children.Add(sceneModelVisual3D);


            var dxViewportView = new DXViewportView(viewport3D);

            dxViewportView.BackgroundColor     = Colors.White;
            dxViewportView.UseLayoutRounding   = true;
            dxViewportView.SnapsToDevicePixels = true;

            // Set GraphicsProfile:
            var graphicsProfile = new GraphicsProfile(string.Format("{0}xMSAA_{1}xSSAA_HardwareRendering", multisamplingCount, supersamplingCount),
                                                      GraphicsProfile.DriverTypes.DirectXHardware,
                                                      ShaderQuality.High,
                                                      preferedMultisampleCount: multisamplingCount,
                                                      supersamplingCount: supersamplingCount,
                                                      textureFiltering: TextureFilteringTypes.Anisotropic_x4);

            dxViewportView.GraphicsProfiles = new GraphicsProfile[] { graphicsProfile, GraphicsProfile.Wpf3D }; // Add WPF 3D as fallback


            var border = new Border()
            {
                Background          = Brushes.White,
                BorderBrush         = Brushes.Gray,
                BorderThickness     = new Thickness(1, 1, 1, 1),
                Margin              = new Thickness(1, 1, 2, 2),
                UseLayoutRounding   = true,
                SnapsToDevicePixels = true
            };

            border.Child = dxViewportView;


            var targetPositionCamera = new TargetPositionCamera()
            {
                TargetPosition   = new Point3D(0, 0, 0),
                Heading          = 0,
                Attitude         = 0,
                ShowCameraLight  = ShowCameraLightType.Always,
                CameraType       = BaseCamera.CameraTypes.OrthographicCamera,
                CameraWidth      = 800,
                Distance         = 800,
                TargetViewport3D = viewport3D
            };

            dxViewportView.DXRenderSizeChanged += delegate(object sender, DXViewSizeChangedEventArgs args)
            {
                targetPositionCamera.CameraWidth = dxViewportView.DXRenderSize.Width;
            };

            var mouseCameraController = new MouseCameraController()
            {
                TargetCamera           = targetPositionCamera,
                EventsSourceElement    = border,
                RotateCameraConditions = MouseCameraController.MouseAndKeyboardConditions.LeftMouseButtonPressed,
                MoveCameraConditions   = MouseCameraController.MouseAndKeyboardConditions.ControlKey | MouseCameraController.MouseAndKeyboardConditions.LeftMouseButtonPressed,
            };


            var titlesPanel = new StackPanel()
            {
                Orientation         = Orientation.Horizontal,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
                Margin = new Thickness(10, 5, 10, 0)
            };

            if (title != null)
            {
                var textBlock = new TextBlock()
                {
                    Text         = title,
                    FontSize     = 18,
                    FontWeight   = FontWeights.Bold,
                    TextWrapping = TextWrapping.Wrap,
                    Foreground   = new SolidColorBrush(Color.FromRgb(32, 32, 32)),
                };

                titlesPanel.Children.Add(textBlock);
            }

            if (graphicsProfileName != null)
            {
                var textBlock = new TextBlock()
                {
                    Text              = "GraphicsProfile: " + graphicsProfileName,
                    FontSize          = 12,
                    TextWrapping      = TextWrapping.Wrap,
                    VerticalAlignment = VerticalAlignment.Center,
                    Margin            = new Thickness(15, 0, 0, 0)
                };

                titlesPanel.Children.Add(textBlock);
            }


            var viewRootGrid = new Grid();

            viewRootGrid.Children.Add(border);
            viewRootGrid.Children.Add(titlesPanel);
            viewRootGrid.Children.Add(targetPositionCamera);
            viewRootGrid.Children.Add(mouseCameraController);


            Grid.SetColumn(viewRootGrid, columnIndex);
            Grid.SetRow(viewRootGrid, rowIndex);
            RootGrid.Children.Add(viewRootGrid);

            return(dxViewportView);
        }
예제 #8
0
        void HandleInput_MouseOrGamepad()
        {
            // update mouse/gamepad cursor
            MouseController.Update();

            // have to do this after cursor update in case hotkey uses mouse position
            HandleKeyboardInput();

            // create our super-input object  (wraps all supported input types)
            InputState input = new InputState();

            input.Initialize_MouseGamepad(this);
            lastInputState = input;

            CameraInteractionState eCamState = (MouseCameraController != null)
                ? MouseCameraController.CheckCameraControls(input) : CameraInteractionState.Ignore;

            if (eCamState == CameraInteractionState.BeginCameraAction)
            {
                TerminateHovers(input);

                bInCameraControl = true;
                ActiveCamera.SetTargetVisible(true);
            }
            else if (eCamState == CameraInteractionState.EndCameraAction)
            {
                bInCameraControl = false;
                ActiveCamera.SetTargetVisible(false);
            }
            else if (bInCameraControl)
            {
                ActiveCamera.SetTargetVisible(true);
                MouseCameraController.DoCameraControl(Scene, ActiveCamera, input);
            }
            else
            {
                // run override behaviors
                overrideBehaviors.SendOverrideInputs(input);

                input.MouseGamepadCaptureActive = (captureMouse != null);

                if (InCaptureMouse)
                {
                    Capture cap = captureMouse.element.UpdateCapture(input, captureMouse.data);
                    if (cap.state == CaptureState.Continue)
                    {
                        // (carry on)
                    }
                    else if (cap.state == CaptureState.End)
                    {
                        captureMouse = null;
                    }
                }
                else
                {
                    // this is very simplistic...needs to be rewritten like space controllers

                    List <CaptureRequest> vRequests = new List <CaptureRequest>();
                    inputBehaviors.CollectWantsCapture(input, vRequests);
                    if (vRequests.Count > 0)
                    {
                        // end outstanding hovers
                        TerminateHovers(input);

                        // select one of the capture requests. technically we could end
                        //  up with none successfully Begin'ing, but behaviors should be
                        //  doing those checks in WantCapture, not BeginCapture !!
                        vRequests.OrderBy(x => x.element.Priority);
                        Capture capReq = null;
                        for (int i = 0; i < vRequests.Count && capReq == null; ++i)
                        {
                            if (vRequests[i].side != CaptureSide.Any)
                            {
                                continue;       // not possible in mouse paths...
                            }
                            // before we actually begin capture we will complete any text editing
                            // [RMS] perhaps this should be configurable for behavior? Some behaviors
                            // do not require this (eg view controls...)
                            completeTextEntryOnFocusChange();

                            Capture c = vRequests[i].element.BeginCapture(input, vRequests[i].side);
                            if (c.state == CaptureState.Begin)
                            {
                                capReq = c;
                            }
                        }

                        captureMouse = capReq;
                    }
                }

                // if we don't have a capture, do hover
                if (captureMouse == null)
                {
                    inputBehaviors.UpdateHover(input);
                }
            }
        }
예제 #9
0
        public CustomRotationMarker()
        {
            InitializeComponent();


            _standardMouseCameraController = new MouseCameraController
            {
                TargetCamera             = Camera1,
                EventsSourceElement      = ViewportBorder,
                RotateCameraConditions   = MouseCameraController.MouseAndKeyboardConditions.LeftMouseButtonPressed,
                MoveCameraConditions     = MouseCameraController.MouseAndKeyboardConditions.LeftMouseButtonPressed | MouseCameraController.MouseAndKeyboardConditions.ControlKey,
                ShowRotationCenterMarker = true
            };

            RootGrid.Children.Add(_standardMouseCameraController);


            // To change the setting that are used to create the standard rotation marker,
            // we need to create a new instance of CameraTargetPositionAdorner and change its properties before the marker is shown.
            _adjustedCameraTargetPositionAdorner = new CameraTargetPositionAdorner(ViewportBorder)
            {
                // Default values are commented:
                //Radius = 15,
                //InnerRadius = 11,
                //MainCircleThickness = 2,
                //OuterCircleThickness = 0.4,
                //LinesLength = 10,
                //MainBrush = Brushes.White,
                //InnerBrush = new SolidColorBrush(Color.FromArgb(128, 128, 128, 128)), // 50% transparent gray

                // Changed properties
                Radius               = 10,
                InnerRadius          = 8,
                MainCircleThickness  = 2,
                OuterCircleThickness = 1,
                LinesLength          = 8,
                MainBrush            = Brushes.Yellow,
                InnerBrush           = new SolidColorBrush(Color.FromArgb(128, 255, 255, 128)) // 50% transparent yellow
            };

            // To provide custom rendering logic for rotation marker,
            // we need to create a new class that is derived from CameraTargetPositionAdorner and override the OnRender method
            _customCameraTargetPositionAdorner = new CustomCameraTargetPositionAdorner(ViewportBorder)
            {
                Radius               = 18,
                InnerRadius          = 16,
                LinesLength          = 10,
                OuterCircleThickness = 1.5,
            };


            _standardMouseCameraController.RotationCenterAdorner = _customCameraTargetPositionAdorner;

            // NOTE:
            // To show rotation marker, the ShowRotationCenterMarker property on MouseCameraController must be set to true (here this is done in XAML)


            // Additional customization:
            // It is possible to fully customize how the rotation marker is shown with creating a class that is derived from MouseCameraController
            // and then override the ShowRotationAdorner(Point rotationCenterPosition) and HideRotationAdorner() methods.
            // This way it would be possible to show an object in an overlay Canvas, a 3D axis or something else.
        }
            public Grid CreateScene()
            {
                var rootGrid = new Grid();

                var textBlock = new TextBlock()
                {
                    Text                = _title,
                    FontSize            = 16,
                    FontWeight          = FontWeights.Bold,
                    Margin              = new Thickness(10, 5, 10, 10),
                    VerticalAlignment   = VerticalAlignment.Top,
                    HorizontalAlignment = HorizontalAlignment.Left
                };

                _reportTextBlock = new TextBlock()
                {
                    Text                = "",
                    FontSize            = 10,
                    Margin              = new Thickness(10, 30, 10, 10),
                    VerticalAlignment   = VerticalAlignment.Top,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    TextWrapping        = TextWrapping.Wrap
                };

                var rootBorder = new Border()
                {
                    Background      = Brushes.Transparent,
                    BorderBrush     = Brushes.Black,
                    BorderThickness = new Thickness(2, 2, 2, 2),
                    Margin          = new Thickness(1, 2, 1, 2)
                };

                MainViewport3D = new Viewport3D();

                var rootModel3DGroup = Create3DScene(new Point3D(0, -300, 0), XCount, YCount, ZCount, 30);

                MainCamera = new TargetPositionCamera()
                {
                    TargetViewport3D = MainViewport3D,
                    TargetPosition   = new Point3D(0, 0, 0),
                    Heading          = 130, // start from back where sorting errors are most obvious
                    Attitude         = -20,
                    Distance         = 500,
                    ShowCameraLight  = ShowCameraLightType.Always
                };

                MainCamera.CameraChanged += OnMainCameraChanged;


                var mouseCameraController = new MouseCameraController()
                {
                    TargetCamera           = MainCamera,
                    EventsSourceElement    = rootBorder,
                    RotateCameraConditions = MouseCameraController.MouseAndKeyboardConditions.LeftMouseButtonPressed,
                    MoveCameraConditions   = MouseCameraController.MouseAndKeyboardConditions.Disabled // disable mouse move
                };

                if (_useDXEngine)
                {
                    _dxViewportView            = new DXViewportView();
                    _dxViewportView.Viewport3D = MainViewport3D;

                    rootBorder.Child = _dxViewportView;


                    _dxViewportView.DXSceneDeviceCreated += delegate(object sender, EventArgs e)
                    {
                        // Always disable transparency sorting on start
                        // If _useDXEngineSorting the IsTransparencySortingEnabled will be set to true after
                        // the first rendering statistics will be collected (see CollectStatistics method for more info)
                        _dxViewportView.DXScene.IsTransparencySortingEnabled = false;
                    };

                    _dxViewportView.SceneRendered += delegate(object sender, EventArgs e)
                    {
                        CollectStatistics();
                    };

                    // To manually change the order of objects after they have been sorted use SortingCompleted event:
                    //_dxViewportView.DXScene.TransparentRenderingQueue.SortingCompleted += delegate(object sender, RenderingQueueSortingCompletedEventArgs e)
                    //{
                    //    // Here it is possible to change the order of item with changing the indexes in the e.SortedIndexes array.
                    //    // IMPORTANT:
                    //    // To get objects count use e.RenderablePrimitives.Count and not e.SortedIndexes.Length as it may be too big!
                    //};

                    Ab3d.DirectX.DXDiagnostics.IsCollectingStatistics = true;
                }
                else
                {
                    rootBorder.Child = MainViewport3D;
                }

                if (_useTransparencySorter)
                {
                    _transparencySorter = new TransparencySorter(rootModel3DGroup, MainCamera);
                }

                MainCamera.Refresh();

                rootGrid.Children.Add(rootBorder);
                rootGrid.Children.Add(textBlock);
                rootGrid.Children.Add(_reportTextBlock);

                return(rootGrid);
            }