Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Viewport3DX"/> class.
 /// </summary>
 public Viewport3DX()
 {
     this.DefaultStyleKey = typeof(Viewport3DX);
     this.Loaded         += Viewport3DXLoaded;
     this.Unloaded       += Viewport3DX_Unloaded;
     cameraController     = new CameraController(this);
     Camera = new PerspectiveCamera()
     {
         Position = new Vector3(0, 0, -10), LookDirection = new Vector3(0, 0, 10), UpDirection = new Vector3(0, 1, 0)
     };
     InputController = new InputController();
     RegisterPropertyChangedCallback(VisibilityProperty, (s, e) =>
     {
         if (renderHostInternal != null)
         {
             renderHostInternal.IsRendering = (Visibility)s.GetValue(e) == Visibility.Visible;
         }
     });
 }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Viewport3DX"/> class.
        /// </summary>
        public Viewport3DX()
        {
            Items.CollectionChanged += Items_CollectionChanged;
            this.DefaultStyleKey     = typeof(Viewport3DX);
            this.Loaded             += Viewport3DXLoaded;
            this.Unloaded           += Viewport3DX_Unloaded;
            cameraController         = new CameraController(this);
            InitCameraController();
            Camera = new PerspectiveCamera()
            {
                Position = new Vector3(0, 0, -10), LookDirection = new Vector3(0, 0, 10), UpDirection = new Vector3(0, 1, 0)
            };
            InputController = new InputController();
            RegisterPropertyChangedCallback(VisibilityProperty, (s, e) =>
            {
                if (renderHostInternal != null)
                {
                    renderHostInternal.IsRendering = (Visibility)s.GetValue(e) == Visibility.Visible;
                }
            });

            DisplayInformation.GetForCurrentView().DpiChanged += Viewport3DX_DpiChanged;
            SetupBindings();
        }