コード例 #1
0
        protected override bool OnButtonDown(Point pointerPosition)
        {
            this.isActive = false;
            Viewport3DElement firstHitViewport3D = this.ActiveView.GetFirstHitViewport3D(pointerPosition);

            if (firstHitViewport3D == null || firstHitViewport3D.ViewObject.PlatformSpecificObject == null)
            {
                return(false);
            }
            this.cameraElement = firstHitViewport3D.Camera;
            if (this.cameraElement == null || !this.cameraElement.IsSelectable)
            {
                return(false);
            }
            this.scale = Helper3D.UnitsPerPixel((Viewport3D)firstHitViewport3D.ViewObject.PlatformSpecificObject, new Point3D(0.0, 0.0, 0.0));
            this.rootToViewport3DMatrix       = ElementUtilities.GetComputedTransform(firstHitViewport3D.Visual != null ? firstHitViewport3D.Visual.PlatformSpecificObject as Visual : (Visual)null, (Visual)this.ActiveSceneViewModel.DefaultView.ViewRootContainer);
            this.pointerInViewportCoordinates = pointerPosition * this.rootToViewport3DMatrix;
            this.SetMovementMode();
            this.cameraInitialUp       = (Vector3D)this.cameraElement.GetComputedValue(ProjectionCameraElement.UpDirectionProperty);
            this.cameraInitialPosition = (Point3D)this.cameraElement.GetComputedValue(ProjectionCameraElement.PositionProperty);
            this.cameraInitialLookAt   = this.cameraInitialPosition + (Vector3D)this.cameraElement.GetComputedValue(ProjectionCameraElement.LookDirectionProperty);
            this.totalAzimuthDelta     = 0.0;
            this.totalElevationDelta   = 0.0;
            this.lastPoint             = this.pointerInViewportCoordinates;
            this.EnsureEditTransaction();
            this.isActive = true;
            return(true);
        }
コード例 #2
0
        private void MatchCameras()
        {
            if (!this.adornedViewport.IsAttached || this.adornedViewport.ViewObject == null)
            {
                return;
            }
            Rect computedTightBounds = this.adornedViewport.GetComputedTightBounds();

            if (this.shadowAdorningContainer.Viewport != computedTightBounds)
            {
                this.shadowAdorningContainer.Viewport       = computedTightBounds;
                this.orthographicAdorningContainer.Viewport = computedTightBounds;
            }
            CameraElement camera = this.adornedViewport.Camera;

            if (camera == null)
            {
                return;
            }
            ProjectionCamera projectionCamera1 = camera.ViewObject.PlatformSpecificObject as ProjectionCamera;

            if (projectionCamera1 == null)
            {
                return;
            }
            ProjectionCamera   projectionCamera2   = (ProjectionCamera)this.shadowAdorningContainer.Camera;
            OrthographicCamera orthographicCamera1 = (OrthographicCamera)this.orthographicAdorningContainer.Camera;

            if (projectionCamera2.FarPlaneDistance != projectionCamera1.FarPlaneDistance || projectionCamera2.NearPlaneDistance != projectionCamera1.NearPlaneDistance || (projectionCamera2.LookDirection != projectionCamera1.LookDirection || projectionCamera2.Position != projectionCamera1.Position) || (projectionCamera2.UpDirection != projectionCamera1.UpDirection || projectionCamera2.Transform != projectionCamera1.Transform))
            {
                projectionCamera2.FarPlaneDistance  = projectionCamera1.FarPlaneDistance;
                projectionCamera2.NearPlaneDistance = projectionCamera1.NearPlaneDistance;
                projectionCamera2.LookDirection     = projectionCamera1.LookDirection;
                orthographicCamera1.LookDirection   = projectionCamera1.LookDirection;
                projectionCamera2.Position          = projectionCamera1.Position;
                orthographicCamera1.Position        = projectionCamera1.Position;
                projectionCamera2.UpDirection       = projectionCamera1.UpDirection;
                orthographicCamera1.UpDirection     = projectionCamera1.UpDirection;
            }
            PerspectiveCamera perspectiveCamera1 = projectionCamera1 as PerspectiveCamera;
            PerspectiveCamera perspectiveCamera2 = projectionCamera2 as PerspectiveCamera;

            if (perspectiveCamera1 != null && perspectiveCamera2 != null && perspectiveCamera1.FieldOfView != perspectiveCamera2.FieldOfView)
            {
                perspectiveCamera2.FieldOfView = perspectiveCamera1.FieldOfView;
            }
            OrthographicCamera orthographicCamera2 = projectionCamera1 as OrthographicCamera;
            OrthographicCamera orthographicCamera3 = projectionCamera2 as OrthographicCamera;

            if (orthographicCamera2 == null || orthographicCamera3 == null || orthographicCamera2.Width == orthographicCamera3.Width)
            {
                return;
            }
            orthographicCamera3.Width = orthographicCamera2.Width;
            orthographicCamera1.Width = orthographicCamera2.Width;
        }
コード例 #3
0
 private bool FinishUpdate()
 {
     if (!this.isActive)
     {
         return(false);
     }
     this.isActive = false;
     this.CommitEditTransaction();
     this.cameraElement = (CameraElement)null;
     return(true);
 }
コード例 #4
0
 public CameraTimelineItem(TimelineItemManager timelineItemManager, CameraElement element)
     : base(timelineItemManager, (Base3DElement)element)
 {
 }