Ejemplo n.º 1
0
 public static void SunActive()
 {
     if (!UserInput._controller.isConnected || UserInput._miniViewportsOn)
     {
         return;
     }
     UserInput._controller.GetStateOfXController();
     UserInput.SpeedParameter();
     if (UserInput._controller.Y_Keydown())
     {
         if (!UserInput._shadowOn)
         {
             UserInput._sunControllerConduit.SunlightSettings(RhinoDocument.ActiveDoc, VR_PANEL.Latitude, VR_PANEL.Longitude);
             UserInput._sunControllerConduit.SunSetToNow(ref UserInput._dateParam, ref UserInput._timeParam);
             UserInput._sunControllerConduit.SunLightOn();
             UserInput._controller.SetVibration(true, true, 400);
             UserInput._shadowOn = true;
         }
         else
         {
             UserInput._sunControllerConduit.SunLightOff();
             UserInput._sunControllerConduit.Enabled = (false);
             UserInput._controller.SetVibration(true, true, 400);
             UserInput._sunSliderOn = false;
             UserInput._shadowOn    = false;
         }
     }
     if (UserInput._controller.LeftThumb_Keydown() && UserInput._shadowOn)
     {
         if (!UserInput._sunSliderOn)
         {
             UserInput._sunSliderOn = true;
             UserInput._sunControllerConduit.Enabled = (true);
         }
         else
         {
             UserInput._sunSliderOn = false;
             UserInput._sunControllerConduit.Enabled = (false);
         }
     }
     if (UserInput._sunSliderOn && !UserInput._miniViewportsOn)
     {
         float leftThumbX;
         if (UserInput._controller.LeftThumbX_Active(out leftThumbX))
         {
             UserInput._dateParam += (double)leftThumbX * UserInput._norm * (double)UserInput._speedX1 * (double)UserInput._speedX2;
             if (UserInput._dateParam > 1.0)
             {
                 UserInput._dateParam = 0.0;
             }
             if (UserInput._dateParam < 0.0)
             {
                 UserInput._dateParam = 1.0;
             }
         }
         float rightThumbX;
         if (UserInput._controller.RightThumbX_Active(out rightThumbX))
         {
             UserInput._timeParam += (double)rightThumbX * UserInput._norm * (double)UserInput._speedX1 * (double)UserInput._speedX2;
             if (UserInput._timeParam > 1.0)
             {
                 UserInput._timeParam = 0.0;
             }
             if (UserInput._timeParam < 0.0)
             {
                 UserInput._timeParam = 1.0;
             }
         }
         UserInput._sunControllerConduit.SunPosition(UserInput._dateParam, UserInput._timeParam);
     }
     UserInput._controller.Vibration_Active();
 }
Ejemplo n.º 2
0
 public static void MiniViewportsActive()
 {
     if (UserInput._controller.isConnected)
     {
         UserInput._controller.GetStateOfXController();
         UserInput.SpeedParameter();
         if (UserInput._controller.A_Keydown())
         {
             if (!UserInput._miniViewportsOn)
             {
                 if (Viewports.RiftViews[2] != null && Viewports.RiftViews[2].Document != null)
                 {
                     Viewports.CreateMiniViewports();
                     UserInput._target          = Viewports.MiniViews[2].MainViewport.CameraTarget;
                     UserInput._location        = Viewports.MiniViews[2].MainViewport.CameraLocation;
                     UserInput._cameraX         = Viewports.MiniViews[2].MainViewport.CameraX;
                     UserInput._cameraY         = Viewports.MiniViews[2].MainViewport.CameraY;
                     UserInput._miniViewportsOn = true;
                     UserInput._controller.SetVibration(true, true, 400);
                     // ISSUE: explicit reference operation
                     UserInput._scaleFactor = Math.PI / 2.0 / ((Point3d)@UserInput._location).DistanceTo(UserInput._target);
                 }
                 else
                 {
                     UserInput._controller.SetVibration(false, true, 1000);
                 }
             }
             else
             {
                 Viewports.CloseMiniViewports();
                 UserInput._miniViewportsOn = false;
                 UserInput._controller.SetVibration(true, true, 400);
             }
         }
         if (UserInput._miniViewportsOn)
         {
             float leftThumbX;
             if (UserInput._controller.LeftThumbX_Active(out leftThumbX))
             {
                 Transform transform = Transform.Rotation((double)leftThumbX * UserInput._norm2 * (double)UserInput._speedX1 * (double)UserInput._speedX2, new Vector3d(0.0, 0.0, 1.0), UserInput._target);
                 (UserInput._location).Transform(transform);
                 (UserInput._cameraX).Transform(transform);
                 (UserInput._cameraY).Transform(transform);
                 Viewports.MiniViews[2].MainViewport.SetCameraLocations(UserInput._target, UserInput._location);
                 Viewports.MiniViews[2].MainViewport.CameraUp = UserInput._cameraY;
             }
             float leftThumbY;
             if (UserInput._controller.LeftThumbY_Active(out leftThumbY))
             {
                 Transform transform = Transform.Rotation((double)leftThumbY * UserInput._norm2 * (double)UserInput._speedX1 * (double)UserInput._speedX2, -(UserInput._cameraX), UserInput._target);
                 (UserInput._location).Transform(transform);
                 (UserInput._cameraX).Transform(transform);
                 (UserInput._cameraY).Transform(transform);
                 Viewports.MiniViews[2].MainViewport.SetCameraLocations(UserInput._target, UserInput._location);
                 Viewports.MiniViews[2].MainViewport.CameraUp = UserInput._cameraY;
             }
             float rightThumbX;
             if (UserInput._controller.RightThumbX_Active(out rightThumbX))
             {
                 Transform transform = Transform.Translation(Vector3d.Multiply(Vector3d.Multiply(Vector3d.Multiply(UserInput._cameraX, (double)rightThumbX), (double)UserInput._speedX1), (double)UserInput._speedX2));
                 (UserInput._target).Transform(transform);
                 (UserInput._location).Transform(transform);
                 Viewports.MiniViews[2].MainViewport.SetCameraLocations(UserInput._target, UserInput._location);
             }
             float rightThumbY;
             if (UserInput._controller.RightThumbY_Active(out rightThumbY))
             {
                 Transform transform = Transform.Translation(Vector3d.Multiply(Vector3d.Multiply(Vector3d.Multiply(UserInput._cameraY, (double)rightThumbY), (double)UserInput._speedX1), (double)UserInput._speedX2));
                 (UserInput._target).Transform(transform);
                 (UserInput._location).Transform(transform);
                 Viewports.MiniViews[2].MainViewport.SetCameraLocations(UserInput._target, UserInput._location);
             }
             if (UserInput._controller.DPadUp_KeyOn())
             {
                 double    a         = Math.Atan(UserInput._scaleFactor * (UserInput._location).DistanceTo(UserInput._target)) * 2.0;
                 Transform transform = Transform.Scale(UserInput._target, 1.0 - Math.Sin(a) * UserInput._norm2 * (double)UserInput._speedX1 * (double)UserInput._speedX2);
                 (UserInput._location).Transform(transform);
                 Viewports.MiniViews[2].MainViewport.SetCameraLocations(UserInput._target, UserInput._location);
             }
             if (UserInput._controller.DPadDown_KeyOn())
             {
                 double    a         = Math.Atan(UserInput._scaleFactor * (UserInput._location).DistanceTo(UserInput._target)) * 2.0;
                 Transform transform = Transform.Scale(UserInput._target, Math.Sin(a) * UserInput._norm2 * (double)UserInput._speedX1 * (double)UserInput._speedX2 + 1.0);
                 (UserInput._location).Transform(transform);
                 Viewports.MiniViews[2].MainViewport.SetCameraLocations(UserInput._target, UserInput._location);
             }
             if (UserInput._controller.DPadLeft_KeyOn())
             {
                 Transform transform = Transform.Translation(Vector3d.Multiply(Vector3d.Multiply(Vector3d.Multiply(UserInput._cameraX, -0.5), (double)UserInput._speedX1), (double)UserInput._speedX2));
                 (UserInput._target).Transform(transform);
                 (UserInput._location).Transform(transform);
                 Viewports.MiniViews[2].MainViewport.SetCameraLocations(UserInput._target, UserInput._location);
             }
             if (UserInput._controller.DPadRight_KeyOn())
             {
                 Transform transform = Transform.Translation(Vector3d.Multiply(Vector3d.Multiply(Vector3d.Multiply(UserInput._cameraX, 0.5), (double)UserInput._speedX1), (double)UserInput._speedX2));
                 (UserInput._target).Transform(transform);
                 (UserInput._location).Transform(transform);
                 Viewports.MiniViews[2].MainViewport.SetCameraLocations(UserInput._target, UserInput._location);
             }
         }
         UserInput._controller.Vibration_Active();
     }
     Viewports.UpdateMiniViewports();
 }
Ejemplo n.º 3
0
        public static void MovementAndOrientation(ref Point3d startPos, ref Transform startDir, Transform rollPitchYaw, Transform oculusToRhino, RhinoDoc rhinoDocument)
        {
            if (!UserInput._controller.isConnected || UserInput._sunSliderOn || UserInput._miniViewportsOn)
            {
                return;
            }
            List <double> zPositions = new List <double>();

            UserInput.FloorOrientPosition(startPos, ref zPositions, rhinoDocument);
            UserInput._controller.GetStateOfXController();
            UserInput.SpeedParameter();
            if (zPositions.Count < 1)
            {
                // ISSUE: explicit reference operation
                zPositions.Add(((Point3d)@startPos).Z);
            }
            else if (zPositions.Count > 1)
            {
                if (UserInput._controller.LeftShoulder_Keydown())
                {
                    ++UserInput._zIndex;
                    if (UserInput._zIndex >= zPositions.Count)
                    {
                        UserInput._zIndex = 0;
                    }
                    UserInput._controller.SetVibration(true, false, 600);
                }
                if (UserInput._controller.RightShoulder_Keydown())
                {
                    --UserInput._zIndex;
                    if (UserInput._zIndex < 0)
                    {
                        UserInput._zIndex = zPositions.Count - 1;
                    }
                    UserInput._controller.SetVibration(true, false, 600);
                }
            }
            else
            {
                UserInput._zIndex = 0;
            }
            UserInput._controller.Vibration_Active();
            float rightThumbX;

            if (UserInput._controller.RightThumbX_Active(out rightThumbX))
            {
                UserInput._rotationAngle += (float)(-(double)rightThumbX / 50.0) * UserInput._speedX1 * UserInput._speedX2;
                startDir = Transform.Rotation((double)UserInput._rotationAngle, new Vector3d(0.0, 0.0, 1.0), new Point3d(0.0, 0.0, 0.0));
            }
            float leftThumbX;

            if (UserInput._controller.LeftThumbX_Active(out leftThumbX))
            {
                Vector3d vector3d = (startDir * (oculusToRhino * (rollPitchYaw * (new Vector3d((double)leftThumbX / 20.0 * (double)UserInput._speedX1 * (double)UserInput._speedX2 * (double)UserInput._speedX10, 0.0, 0.0)))));
                Point3d  local    = startPos;
                // ISSUE: explicit reference operation
                Point3d point3d = local + (new Vector3d(((Vector3d)@vector3d).X, ((Vector3d)@vector3d).Y, 0.0));
                local = point3d;
            }
            float leftThumbY;

            if (UserInput._controller.LeftThumbY_Active(out leftThumbY))
            {
                Vector3d vector3d = startDir * (oculusToRhino * (rollPitchYaw * (new Vector3d(0.0, 0.0, -((double)leftThumbY / 20.0) * (double)UserInput._speedX1 * (double)UserInput._speedX2 * (double)UserInput._speedX10))));
                Point3d  local    = startPos;
                // ISSUE: explicit reference operation
                Point3d point3d = local + (new Vector3d(((Vector3d)@vector3d).X, ((Vector3d)@vector3d).Y, 0.0));
                local = point3d;
            }
            // ISSUE: explicit reference operation
            // ISSUE: explicit reference operation
            startPos            = new Point3d(((Point3d)@startPos).X, ((Point3d)@startPos).Y, zPositions[UserInput._zIndex]);
            UserInput._startPos = startPos;
        }