/// <summary> /// Determines if a surface seen by an eye of a viewer in a display /// config requests some distortion to be performed. /// /// This simply reports true or false, and does not specify which kind of /// distortion implementations have been parameterized for this display. For /// each distortion implementation your application supports, you'll want to /// call the corresponding priority function to find out if it is available. /// </summary> /// <param name="viewer">Viewer ID</param> /// <param name="eye">Eye ID</param> /// <param name="surface">Surface ID</param> /// <returns> /// whether distortion is requested. Constant throughout the active, valid /// lifetime of a display config object. /// </returns> public bool DoesViewerEyeSurfaceWantDistortion(ViewerCount viewer, EyeCount eye, SurfaceCount surface) { bool ret; CheckSuccess( DisplayConfigNative.osvrClientDoesViewerEyeSurfaceWantDistortion(mHandle, viewer, eye, surface, out ret), "[OSVR] DisplayConfig.DoesViewerEyeSurfaceWantDistortion(): native osvrClientDoesViewerEyeSurfaceWantDistortion call failed."); return(ret); }
/// <summary> /// Get the index of the display input for a surface seen by an eye of a /// viewer in a display config. /// /// This is the OSVR-assigned display input: it may not (and in practice, /// usually will not) match any platform-specific display indices. This function /// exists to associate surfaces with video inputs as enumerated by /// GetNumDisplayInputs(). /// </summary> /// <param name="viewer">Viewer ID</param> /// <param name="eye">Eye ID</param> /// <param name="surface">Surface ID</param> /// <returns>Zero-based index of the display input pixels for /// this surface are tranmitted over. /// This association is **constant** throughout the active, valid lifetime of a /// display config object.</returns> public DisplayInputCount GetViewerEyeSurfaceDisplayInputIndex(ViewerCount viewer, EyeCount eye, SurfaceCount surface) { DisplayInputCount ret; CheckSuccess(DisplayConfigNative.osvrClientGetViewerEyeSurfaceDisplayInputIndex(mHandle, viewer, eye, surface, out ret), "[OSVR] DisplayConfig.GetViewerEyeSurfaceDisplayInputIndex(): native osvrClientGetViewerEyeSurfaceDisplayInputIndex call failed"); return(ret); }
/// <summary> /// Get the view matrix (inverse of pose) for the given eye of a /// viewer in a display config - matrix of floats. /// Will only succeed if CheckDisplayStartup() returns true. /// </summary> /// <param name="viewer">Viewer ID</param> /// <param name="eye">Eye ID</param> /// <param name="flags">Bitwise OR of matrix convention flags (see OSVR_MatrixFlags)</param> /// <returns> /// the transformation matrix from room space to eye space (not relative to pose of the viewer) /// </returns> public Matrix44f GetViewerEyeViewMatrixf(ViewerCount viewer, EyeCount eye, MatrixConventionsFlags flags) { Matrix44f ret; CheckSuccess( DisplayConfigNative.osvrClientGetViewerEyeViewMatrixf(mHandle, viewer, eye, flags, out ret), "[OSVR] DisplayConfig.GetViewerEyeViewMatrixf(): native osvrClientGetViewerEyeViewMatrixf call failed."); return(ret); }
/// <summary> /// A display config can have one or more display inputs to pass pixels /// over (HDMI/DVI connections, etc): retrieve the number of display inputs in /// the current configuration. /// </summary> /// <returns>Number of display inputs in the logical display /// topology, **constant** throughout the active, valid lifetime of a display /// config object.</returns> public DisplayInputCount GetNumDisplayInputs() { DisplayInputCount ret; CheckSuccess( DisplayConfigNative.osvrClientGetNumDisplayInputs(mHandle, out ret), "[OSVR] DisplayCOnfig.GetNumDisplayInputs(): native osvrClientGetNumDisplayInputs call failed."); return(ret); }
/// <summary> /// Get the "viewpoint" for the given eye of a viewer in a display /// config. Will only succeed if CheckDisplayStartup() succeeds. /// </summary> /// <param name="viewer">Viewer ID</param> /// <param name="eye">Eye ID</param> /// <returns> /// Room-space pose (not relative to pose of the viewer) /// </returns> public Pose3 GetViewerEyePose(ViewerCount viewer, EyeCount eye) { Pose3 ret; CheckSuccess( DisplayConfigNative.osvrClientGetViewerEyePose(mHandle, viewer, eye, out ret), "[OSVR] DisplayConfig.GetViewerEyePose(): native osvrClientGetViewerPose call failed."); return(ret); }
/// <summary> /// Returns the priority/availability of radial distortion parameters for /// a surface seen by an eye of a viewer in a display config. /// /// If osvrClientDoesViewerEyeSurfaceWantDistortion() reports false, then the /// display does not request distortion of any sort, and thus neither this nor /// any other distortion strategy priority function will report an "available" /// priority. /// </summary> /// <param name="viewer">Viewer ID</param> /// <param name="eye">Eye ID</param> /// <param name="surface">Surface ID</param> /// <returns> /// the priority level. Negative values indicate this technique /// not available. Higher values indicate higher preference for the given /// technique based on the device's description. Constant throughout the /// active, valid lifetime of a display config object. /// </returns> public DistortionPriority GetViewerEyeSurfaceRadialDistortionPriority(ViewerCount viewer, EyeCount eye, SurfaceCount surface) { DistortionPriority ret; CheckSuccess( DisplayConfigNative.osvrClientGetViewerEyeSurfaceRadialDistortionPriority(mHandle, viewer, eye, surface, out ret), "[OSVR] DisplayConfig.GetViewerEyeSurfaceWantDistortion(): native osvrClientGetViewerEyeSurfaceRadialDistortionPriority call failed."); return(ret); }
/// <summary> /// Each viewer in a display config can have one or more "eyes" which /// have a substantially similar pose: get the count. /// </summary> /// <param name="viewer">Viewer ID</param> /// <returns> /// Number of eyes for this viewer in the logical display /// topology, constant throughout the active, valid lifetime of a display /// config object /// </returns> public EyeCount GetNumEyesForViewer(ViewerCount viewer) { EyeCount ret; CheckSuccess( DisplayConfigNative.osvrClientGetNumEyesForViewer(mHandle, viewer, out ret), "[OSVR] DisplayConfig.GetNumEyesForViewer(): native osvrClientGetNumEyesForViewer call failed."); return(ret); }
/// <summary> /// A display config can have one (or theoretically more) viewers /// retrieve the viewer count. /// </summary> /// <returns> /// Number of viewers in the logical display topology, /// constant throughout the active, valid lifetime of a display config /// object. /// </returns> public ViewerCount GetNumViewers() { ViewerCount ret; CheckSuccess( DisplayConfigNative.osvrClientGetNumViewers(mHandle, out ret), "[OSVR] DisplayConfig.GetNumViewers(): native osvrClientGetNumViewers call failed."); return(ret); }
/// <summary> /// Returns the radial distortion parameters, if known/requested, for a /// surface seen by an eye of a viewer in a display config. /// /// Will only succeed if GetViewerEyeSurfaceRadialDistortionPriority() /// reports a non-negative priority. /// </summary> /// <param name="viewer">Viewer ID</param> /// <param name="eye">Eye ID</param> /// <param name="surface">Surface ID</param> /// <returns>the parameters for radial distortion</returns> public RadialDistortionParameters GetViewerEyeSurfaceRadialDistortion(ViewerCount viewer, EyeCount eye, SurfaceCount surface) { RadialDistortionParameters ret; CheckSuccess( DisplayConfigNative.osvrClientGetViewerEyeSurfaceRadialDistortion(mHandle, viewer, eye, surface, out ret), "[OSVR] DisplayConfig.GetViewerEyeSurfaceRadialDistortion(): native osvrClientGetViewerEyeSurfaceRadialDistortion call failed."); return(ret); }
/// <summary> /// Get the projection matrix for a surface seen by an eye of a viewer /// in a display config. (float version) /// </summary> /// <param name="viewer">Viewer ID</param> /// <param name="eye">Eye ID</param> /// <param name="surface">Surface ID</param> /// <param name="near">Distance from viewpoint to near clipping plane - must be positive..</param> /// <param name="far">Distance from viewpoint to far clipping plane - must be positive /// and not equal to near, typically greater than near.</param> /// <param name="flags">Bitwise OR of matrix convention flags (see OSVR_MatrixFlags)</param> public Matrix44f GetProjectionMatrixForViewerEyeSurfacef(ViewerCount viewer, EyeCount eye, SurfaceCount surface, float near, float far, MatrixConventionsFlags flags) { Matrix44f ret; CheckSuccess( DisplayConfigNative.osvrClientGetViewerEyeSurfaceProjectionMatrixf(mHandle, viewer, eye, surface, near, far, flags, out ret), "[OSVR] DisplayConfig.GetProjectionForViewerEyeSurface(): native osvrClientGetProjectionForViewerEyeSurface call failed."); return(ret); }
/// <summary> /// Each eye of each viewer in a display config has one or more surfaces /// (aka "screens") on which content should be rendered. /// </summary> /// <param name="viewer">Viewer ID</param> /// <param name="eye">Eye ID</param> /// <returns> /// Number of surfaces (numbered [0, surfaces - 1]) for the /// given viewer and eye. Constant throughout the active, valid lifetime of /// a display config object. /// </returns> public SurfaceCount GetNumSurfacesForViewerEye(ViewerCount viewer, EyeCount eye) { SurfaceCount ret; CheckSuccess( DisplayConfigNative.osvrClientGetNumSurfacesForViewerEye(mHandle, viewer, eye, out ret), "[OSVR] DisplayConfig.GetNumSurfacesForViewerEye(): native osvrClientGetNumSurfacesForViewerEye call failed."); return(ret); }
/// <summary> /// Get a parsed display configuration. This lets you query eyes, surfaces, and /// viewers. /// </summary> public DisplayConfig GetDisplayConfig() { SafeDisplayConfigHandle handle; if (DisplayConfigNative.osvrClientGetDisplay(this.m_context, out handle) != OSVR_RETURN_SUCCESS) { return(null); } this.AddChildDisposable(handle); return(new DisplayConfig(handle)); }
/// <summary> /// Retrieve the pixel dimensions of a given display input for a display config /// </summary> /// <param name="displayInputIndex">The zero-based index of the display input.</param> /// <returns>The height and width of the display input specified. These dimensions are /// **constant** throughout the active, valid lifetime of a display config object.</returns> public DisplayDimensions GetDisplayDimensions(DisplayInputCount displayInputIndex) { DisplayDimension width, height; CheckSuccess( DisplayConfigNative.osvrClientGetDisplayDimensions(mHandle, displayInputIndex, out width, out height), "[OSVR] DisplayConfig.GetDisplayDimensions(): native osvrClientGetDisplayDimensions call failed."); return(new DisplayDimensions { Width = width, Height = height }); }
/// <summary> /// Get the clipping planes (positions at unit distance) for a surface /// seen by an eye of a viewer /// in a display config. /// /// This is only for use in integrations that cannot accept a fully-formulated /// projection matrix as returned by /// osvrClientGetViewerEyeSurfaceProjectionMatrixf() or /// osvrClientGetViewerEyeSurfaceProjectionMatrixd(), and may not necessarily /// provide the same optimizations. /// /// As all the planes are given at unit (1) distance, before passing these /// planes to a consuming function in your application/engine, you will typically /// divide them by your near clipping plane distance. /// </summary> /// <param name="viewer">Viewer ID</param> /// <param name="eye">Eye ID</param> /// <param name="surface">Surface ID</param> public ProjectionClippingPlanes GetViewerEyeSurfaceProjectionClippingPlanes(ViewerCount viewer, EyeCount eye, SurfaceCount surface) { double left, right, top, bottom; CheckSuccess( DisplayConfigNative.osvrClientGetViewerEyeSurfaceProjectionClippingPlanes(mHandle, viewer, eye, surface, out left, out right, out bottom, out top), "[OSVR] DisplayConfig.GetViewerEyeSurfaceProjectionClippingPlanes(): native osvrClientGetViewerEyeSurfaceProjectionClippingPlanes call failed."); return(new ProjectionClippingPlanes { Left = left, Right = right, Bottom = bottom, Top = top }); }
/// <summary> /// Get the dimensions/location of the viewport **within the display /// input** for a surface seen by an eye of a viewer in a display config. (This /// does not include other video inputs that may be on a single virtual desktop, /// etc. or explicitly account for display configurations that use multiple /// video inputs. It does not necessarily indicate that a viewport in the sense /// of glViewport must be created with these parameters, though the parameter /// order matches for convenience.) /// </summary> /// <param name="viewer">Viewer ID</param> /// <param name="eye">Eye ID</param> /// <param name="surface">Surface ID</param> public Viewport GetRelativeViewportForViewerEyeSurface(ViewerCount viewer, EyeCount eye, SurfaceCount surface) { ViewportDimension left, bottom, width, height; CheckSuccess( DisplayConfigNative.osvrClientGetRelativeViewportForViewerEyeSurface(mHandle, viewer, eye, surface, out left, out bottom, out width, out height), "[OSVR] DisplayConfig.GetRelativeViewportForViewerEyeSurface(): native osvrClientGetRelativeViewportForViewerEyeSurface call failed."); return(new Viewport { Left = left, Bottom = bottom, Width = width, Height = height, }); }
/// <summary> /// Checks to see if a display is fully configured and ready, including /// having received its first pose update. /// /// Once this first succeeds, it will continue to succeed for the lifetime of /// the display config object, so it is not necessary to keep calling once you /// get a successful result. /// </summary> /// <returns>true, if the display config is ready and received its first pose report, /// false otherwise.</returns> public bool CheckDisplayStartup() { return(DisplayConfigNative.osvrClientCheckDisplayStartup(mHandle) == ClientContext.OSVR_RETURN_SUCCESS); }
protected override bool ReleaseHandle() { return(DisplayConfigNative.osvrClientFreeDisplay(handle) == OSVR.ClientKit.ClientContext.OSVR_RETURN_SUCCESS); }