public void Pxr_MRCPoseInitialize() { if (layerTexturesInfo == null) { layerTexturesInfo = new LayerTexture[2]; } locationDeflection = Vector3.zero; angularDeflection = Vector3.zero; xmlCameraData = new CameraData(); UPxr_ReadXML(out xmlCameraData); Invoke("Pxr_GetHeight", 0.5f); PxrPosef pose = new PxrPosef(); pose.orientation.x = xmlCameraData.rotation[0]; pose.orientation.y = xmlCameraData.rotation[1]; pose.orientation.z = xmlCameraData.rotation[2]; pose.orientation.w = xmlCameraData.rotation[3]; pose.position.x = xmlCameraData.translation[0]; pose.position.y = xmlCameraData.translation[1]; pose.position.z = xmlCameraData.translation[2]; PXR_Plugin.System.UPxr_SetMrcPose(ref pose); PXR_Plugin.System.UPxr_GetMrcPose(ref pose); xmlCameraData.rotation[0] = pose.orientation.x; xmlCameraData.rotation[1] = pose.orientation.y; xmlCameraData.rotation[2] = pose.orientation.z; xmlCameraData.rotation[3] = pose.orientation.w; xmlCameraData.translation[0] = pose.position.x; xmlCameraData.translation[1] = pose.position.y; xmlCameraData.translation[2] = pose.position.z; mrcPlay = false; UInt64 textureWidth = (UInt64)xmlCameraData.imageWidth; UInt64 textureHeight = (UInt64)xmlCameraData.imageHeight; PXR_Plugin.System.UPxr_SetMrcTextutrWidth(textureWidth); PXR_Plugin.System.UPxr_SetMrcTextutrHeight(textureHeight); UPxr_CreateMRCOverlay((uint)xmlCameraData.imageWidth, (uint)xmlCameraData.imageHeight); if (GraphicsSettings.renderPipelineAsset != null) { RenderPipelineManager.beginCameraRendering += BeginRendering; } else { Camera.onPostRender += UPxr_CopyMRCTexture; } Debug.Log("PXR_MRCInit Succeed"); }
public void UPxr_Calibration() { PxrPosef pose = new PxrPosef(); pose.orientation.x = 0; pose.orientation.y = 0; pose.orientation.z = 0; pose.orientation.w = 0; pose.position.x = 0; pose.position.y = 0; pose.position.z = 0; PXR_Plugin.System.UPxr_GetMrcPose(ref pose); backCameraObj.transform.localPosition = new Vector3(pose.position.x + locationDeflection.x, pose.position.y + locationDeflection.y + height, (-pose.position.z) * 1f); foregroundCameraObj.transform.localPosition = new Vector3(pose.position.x + locationDeflection.x, pose.position.y + locationDeflection.y + height, (-pose.position.z) * 1f); Vector3 rototion = new Quaternion(pose.orientation.x, pose.orientation.y, pose.orientation.z, pose.orientation.w).eulerAngles; backCameraObj.transform.localEulerAngles = new Vector3(-rototion.x + angularDeflection.x, -rototion.y + angularDeflection.y, -rototion.z + angularDeflection.z); foregroundCameraObj.transform.localEulerAngles = new Vector3(-rototion.x + angularDeflection.x, -rototion.y + angularDeflection.y, -rototion.z + angularDeflection.z); }