// Callbacks Projector public void Reset_Callback() { AAR.AARProjector projector = AAR.AARCameraProjectorRig.Instance.ProjectorList()[ AAR.Util.ProjectorTypeToString( AAR.ProjectorTypes.AAR_PROJECTOR_REFERENCE)]; Vector3 direction = projector.GetFrustumPosition(AAR.FrustumPositions.AAR_FRUSTUM_CENTER); SetMovie(direction); }
// Extract and convert Rotation and Center data to matrix private AARProjector ExtractProjectorInformation(JToken _jobj, string _prjectorName) { var pro = _jobj[_prjectorName]; var LtP = pro["LocalToPVCamera"]; // Local to PV camera transform Matrix4x4 T = new Matrix4x4(); for (int i = 0; i < 3; ++i) { JToken v = LtP[i]; Vector4 vec = new Vector4( v[0].ToObject <float>(), v[1].ToObject <float>(), v[2].ToObject <float>(), v[3].ToObject <float>() / 1000.0f); T.SetRow(i, vec); } T.m33 = 1; var intrinsicsj = pro["Intrinsics"]; Matrix4x4 I = new Matrix4x4(); for (int i = 0; i < 3; ++i) { JToken v = intrinsicsj[i]; Vector4 vec = new Vector4( v[0].ToObject <float>(), v[1].ToObject <float>(), v[2].ToObject <float>(), 0); I.SetRow(i, vec); } I.m33 = 1; Intrinsics intrinsics = new Intrinsics( I.m00, // fx I.m11, // fy I.m02, // cx I.m12, // cy NearPlane, // n FarPlane); // f // Range of servo in degrees var dimenJson = pro["Dimensions"]; Dimensions dimen = new Dimensions( dimenJson["Width"].ToObject <float>(), dimenJson["Height"].ToObject <float>()); // Calibrated center for servo at rest (i.e. facing forward parallel with the hololens) var p = new AARProjector( _prjectorName, T, I, dimen, intrinsics, EnableProjectorVizualizer); return(p); }