public void StreamResourcesForCamera(UnityEngine.Camera streamingCamera) { // This code would be a lot cleaner if there was a decent way of copying camera properties around. // Maybe we should just make StreamResourcesForCamera ingest something more abstract //UnityEngine.Camera zeroBasedCameraECEF = new UnityEngine.Camera(); //zeroBasedCameraECEF.CopyFrom(streamingCamera); var savedPosition = streamingCamera.transform.position; if (m_coordinateSystem == CoordinateSystem.ECEF) { DoubleVector3 finalOriginECEF = m_originECEF + savedPosition; streamingCamera.transform.position = Vector3.zero; DoubleVector3 interestPointECEF = m_interestPointProvider.CalculateInterestPoint(streamingCamera, finalOriginECEF); m_nativePluginRunner.StreamResourcesForCamera(streamingCamera, finalOriginECEF, interestPointECEF); m_originECEF = finalOriginECEF; // :TODO: somehow update any other scene-relative cameras - OnRecentreScene event? // TODO: Why are we calling UpdateTransforms() an extra time in this branch? (It's already called in Update()). UpdateTransforms(); // TODO: Why aren't restoring savedPosition here? } else // if (m_coordinateSystem == CoordinateSystem.UnityWorld) { var savedRotation = streamingCamera.transform.rotation; DoubleVector3 finalOriginECEF = m_frame.LocalSpaceToECEF(savedPosition); streamingCamera.transform.rotation = m_frame.LocalToECEFRotation * savedRotation; streamingCamera.transform.position = Vector3.zero; DoubleVector3 interestPointECEF = m_interestPointProvider.CalculateInterestPoint(streamingCamera, finalOriginECEF); m_nativePluginRunner.StreamResourcesForCamera(streamingCamera, finalOriginECEF, interestPointECEF); streamingCamera.transform.position = savedPosition; streamingCamera.transform.rotation = savedRotation; } }
public void StreamResourcesForCamera(Camera streamingCamera) { if (IsValidStreamingCamera(streamingCamera)) { var cameraState = GetStateForCustomCamera(streamingCamera); m_nativePluginRunner.StreamResourcesForCamera(cameraState); } }