protected virtual void CalculateBoundingBox(CalculateBoundingBoxEventArgs e) { OculusTracking.StartTracking(RhinoDocument.ActiveDoc); Viewports.UpdateEyeViewports(OculusTracking.CamLoc, OculusTracking.CamDir, OculusTracking.CamUp); this._mirrorClosed = Viewports.UpdateMirrorViewport(OculusTracking.CamLoc, OculusTracking.CamDir, OculusTracking.CamUp); base.CalculateBoundingBox(e); }
public static void StartTracking(RhinoDoc rhinoDocument) { OVR.TrackingState trackingState = OculusTracking._hmd.GetTrackingState(0.0); Transform rollPitchYaw = OculusTracking.Matrix(new Quaternion((double)trackingState.HeadPose.ThePose.Orientation.W, (double)trackingState.HeadPose.ThePose.Orientation.X, (double)trackingState.HeadPose.ThePose.Orientation.Y, (double)trackingState.HeadPose.ThePose.Orientation.Z)); Transform plane = Transform.PlaneToPlane(Plane.WorldZX, Plane.WorldXY); OculusTracking._startPos = UserInput.StartPos; UserInput.MovementAndOrientation(ref OculusTracking._startPos, ref OculusTracking._startDir, rollPitchYaw, plane, rhinoDocument); OVR.Posef[] outEyePoses = new OVR.Posef[2]; OculusTracking._oculus.CalcEyePoses(trackingState.HeadPose.ThePose, OculusTracking._hmdToEyeViewOffsets, ref outEyePoses); for (int index = 0; index < 2; ++index) { Point3d point3d1; point3d1 = new Point3d((double)outEyePoses[index].Position.X, (double)outEyePoses[index].Position.Y, (double)outEyePoses[index].Position.Z); Transform transform = OculusTracking.Matrix(new Quaternion((double)outEyePoses[index].Orientation.W, (double)outEyePoses[index].Orientation.X, (double)outEyePoses[index].Orientation.Y, (double)outEyePoses[index].Orientation.Z)); Vector3d vector3d1 = (OculusTracking._startDir * (plane * (transform * new Vector3d(0.0, 0.0, -1.0)))); Vector3d vector3d2 = (OculusTracking._startDir * (plane * (transform * new Vector3d(0.0, 1.0, 0.0)))); Point3d point3d2 = (OculusTracking._startPos + (OculusTracking._startDir * (plane * point3d1))); OculusTracking._camLoc[index] = point3d2; OculusTracking._camDir[index] = vector3d1; OculusTracking._camUp[index] = vector3d2; } }