public bool SetCameraView(ref SVFCameraView camView) { if (s_logstack) { logger.Log("[INTEROP]SetCameraView"); } if (instanceId == InvalidID) { return(false); } return(InteropSetCameraView(instanceId, ref camView)); }
public void IssuePluginEvent(SVFCameraView camView) { if (s_logstack) { logger.Log("[INTEROP]IssuePluginEvent"); } if (instanceId != InvalidID) { InteropSetCameraView(instanceId, ref camView); int complexId = ((0xFFFF & camView.cameraId) << 16) | (0xFFFF & instanceId); GL.IssuePluginEvent(InteropGetRenderEventFunc(), complexId); } }
public void UpdateCamera() { var cam = Camera.current; if (cam == null) { return; } CameraView camView = cameraViews.Find(cam, targetDevice, flipHandedness); if (null != camView) { camView.Update(cam, transform.localToWorldMatrix); if (null != pluginInterop) { SVFCameraView svfCamView = cameraViews[cam].InteropCamView; pluginInterop.SetCameraView(ref svfCamView); } } }
public CameraView(int id, Camera cam, TargetDevices tgt, bool flipHand) { cameraId = id; isFlipHand = flipHand; viewportWidth = (float)cam.pixelWidth; viewportHeight = (float)cam.pixelHeight; isGameCamera = (cam.cameraType == CameraType.Game); isPreviewCamera = (cam.name == "Preview Camera"); q1 = new Matrix4x4(); q1 = Matrix4x4.identity; q1[1, 1] = -1.0f; if (tgt == TargetDevices.AutoDetect) { AutoDetectDevice(); } else { ConfigureSetupMVP(tgt); } isStereoscopic = cam.stereoEnabled; if (cam.stereoEnabled) { if (cam.stereoTargetEye != StereoTargetEyeMask.Left && cam.stereoTargetEye != StereoTargetEyeMask.Right) { Debug.LogError("ERROR: stereo camera must be either Left or Right, cannot be 'None' or 'Both'"); throw new Exception("Fix the camera settings"); } } targetEye = (false == cam.stereoEnabled) ? StereoTargetEyeMask.Left : cam.stereoTargetEye; MVP = new Matrix4x4(); // When isGameCamera is true the plugin does backface culling and front face culling when false. _svfCamView = new SVFCameraView() { cameraId = cameraId, isGameCamera = isLeftHandedness, isStereoscopic = isStereoscopic, viewportWidth = viewportWidth, viewportHeight = viewportHeight, targetEye = targetEye }; }
private static extern bool InteropSetCameraView(int instanceId, ref SVFCameraView camView);