Package org.lwjgl.ovr

Class OVRUtil

java.lang.Object
org.lwjgl.ovr.OVRUtil

public class OVRUtil extends Object
Native bindings to the libOVR utility functions.
  • Field Details

    • ovrProjection_None

      public static final int ovrProjection_None
      Enumerates modifications to the projection matrix based on the application's needs.
      Enum values:
      • Projection_None - Use for generating a default projection matrix that is:
        • Right-handed.
        • Near depth values stored in the depth buffer are smaller than far depth values.
        • Both near and far are explicitly defined.
        • With a clipping range that is (0 to w).
      • Projection_LeftHanded - Enable if using left-handed transformations in your application.
      • Projection_FarLessThanNear - After the projection transform is applied, far values stored in the depth buffer will be less than closer depth values. NOTE: Enable only if the application is using a floating-point depth buffer for proper precision.
      • Projection_FarClipAtInfinity - When this flag is used, the zfar value pushed into Matrix4f_Projection will be ignored NOTE: Enable only if Projection_FarLessThanNear is also enabled where the far clipping plane will be pushed to infinity.
      • Projection_ClipRangeOpenGL - Enable if the application is rendering with OpenGL and expects a projection matrix with a clipping range of (-w to w). Ignore this flag if your application already handles the conversion from D3D range (0 to w) to OpenGL.
      See Also:
    • ovrProjection_LeftHanded

      public static final int ovrProjection_LeftHanded
      Enumerates modifications to the projection matrix based on the application's needs.
      Enum values:
      • Projection_None - Use for generating a default projection matrix that is:
        • Right-handed.
        • Near depth values stored in the depth buffer are smaller than far depth values.
        • Both near and far are explicitly defined.
        • With a clipping range that is (0 to w).
      • Projection_LeftHanded - Enable if using left-handed transformations in your application.
      • Projection_FarLessThanNear - After the projection transform is applied, far values stored in the depth buffer will be less than closer depth values. NOTE: Enable only if the application is using a floating-point depth buffer for proper precision.
      • Projection_FarClipAtInfinity - When this flag is used, the zfar value pushed into Matrix4f_Projection will be ignored NOTE: Enable only if Projection_FarLessThanNear is also enabled where the far clipping plane will be pushed to infinity.
      • Projection_ClipRangeOpenGL - Enable if the application is rendering with OpenGL and expects a projection matrix with a clipping range of (-w to w). Ignore this flag if your application already handles the conversion from D3D range (0 to w) to OpenGL.
      See Also:
    • ovrProjection_FarLessThanNear

      public static final int ovrProjection_FarLessThanNear
      Enumerates modifications to the projection matrix based on the application's needs.
      Enum values:
      • Projection_None - Use for generating a default projection matrix that is:
        • Right-handed.
        • Near depth values stored in the depth buffer are smaller than far depth values.
        • Both near and far are explicitly defined.
        • With a clipping range that is (0 to w).
      • Projection_LeftHanded - Enable if using left-handed transformations in your application.
      • Projection_FarLessThanNear - After the projection transform is applied, far values stored in the depth buffer will be less than closer depth values. NOTE: Enable only if the application is using a floating-point depth buffer for proper precision.
      • Projection_FarClipAtInfinity - When this flag is used, the zfar value pushed into Matrix4f_Projection will be ignored NOTE: Enable only if Projection_FarLessThanNear is also enabled where the far clipping plane will be pushed to infinity.
      • Projection_ClipRangeOpenGL - Enable if the application is rendering with OpenGL and expects a projection matrix with a clipping range of (-w to w). Ignore this flag if your application already handles the conversion from D3D range (0 to w) to OpenGL.
      See Also:
    • ovrProjection_FarClipAtInfinity

      public static final int ovrProjection_FarClipAtInfinity
      Enumerates modifications to the projection matrix based on the application's needs.
      Enum values:
      • Projection_None - Use for generating a default projection matrix that is:
        • Right-handed.
        • Near depth values stored in the depth buffer are smaller than far depth values.
        • Both near and far are explicitly defined.
        • With a clipping range that is (0 to w).
      • Projection_LeftHanded - Enable if using left-handed transformations in your application.
      • Projection_FarLessThanNear - After the projection transform is applied, far values stored in the depth buffer will be less than closer depth values. NOTE: Enable only if the application is using a floating-point depth buffer for proper precision.
      • Projection_FarClipAtInfinity - When this flag is used, the zfar value pushed into Matrix4f_Projection will be ignored NOTE: Enable only if Projection_FarLessThanNear is also enabled where the far clipping plane will be pushed to infinity.
      • Projection_ClipRangeOpenGL - Enable if the application is rendering with OpenGL and expects a projection matrix with a clipping range of (-w to w). Ignore this flag if your application already handles the conversion from D3D range (0 to w) to OpenGL.
      See Also:
    • ovrProjection_ClipRangeOpenGL

      public static final int ovrProjection_ClipRangeOpenGL
      Enumerates modifications to the projection matrix based on the application's needs.
      Enum values:
      • Projection_None - Use for generating a default projection matrix that is:
        • Right-handed.
        • Near depth values stored in the depth buffer are smaller than far depth values.
        • Both near and far are explicitly defined.
        • With a clipping range that is (0 to w).
      • Projection_LeftHanded - Enable if using left-handed transformations in your application.
      • Projection_FarLessThanNear - After the projection transform is applied, far values stored in the depth buffer will be less than closer depth values. NOTE: Enable only if the application is using a floating-point depth buffer for proper precision.
      • Projection_FarClipAtInfinity - When this flag is used, the zfar value pushed into Matrix4f_Projection will be ignored NOTE: Enable only if Projection_FarLessThanNear is also enabled where the far clipping plane will be pushed to infinity.
      • Projection_ClipRangeOpenGL - Enable if the application is rendering with OpenGL and expects a projection matrix with a clipping range of (-w to w). Ignore this flag if your application already handles the conversion from D3D range (0 to w) to OpenGL.
      See Also:
    • ovrHapticsGenMode_PointSample

      public static final int ovrHapticsGenMode_PointSample
      Modes used to generate Touch Haptics from audio PCM buffer.
      Enum values:
      See Also:
    • ovrHapticsGenMode_Count

      public static final int ovrHapticsGenMode_Count
      Modes used to generate Touch Haptics from audio PCM buffer.
      Enum values:
      See Also:
  • Method Details

    • novr_Detect

      public static void novr_Detect(int timeoutMilliseconds, long __result)
      Unsafe version of: _Detect
    • ovr_Detect

      public static OVRDetectResult ovr_Detect(int timeoutMilliseconds, OVRDetectResult __result)
      Detects Oculus Runtime and Device Status.

      Checks for Oculus Runtime and Oculus HMD device status without loading the LibOVRRT shared library. This may be called before Initialize to help decide whether or not to initialize LibOVR.

      Parameters:
      timeoutMilliseconds - a timeout to wait for HMD to be attached or 0 to poll
    • novrMatrix4f_Projection

      public static void novrMatrix4f_Projection(long fov, float znear, float zfar, int projectionModFlags, long __result)
      Unsafe version of: Matrix4f_Projection
    • ovrMatrix4f_Projection

      public static OVRMatrix4f ovrMatrix4f_Projection(OVRFovPort fov, float znear, float zfar, int projectionModFlags, OVRMatrix4f __result)
      Used to generate projection from ovrEyeDesc::Fov.
      Parameters:
      fov - the OVRFovPort to use
      znear - distance to near Z limit
      zfar - distance to far Z limit
      projectionModFlags - a combination of the ovrProjectionModifier flags. One or more of:
      Projection_NoneProjection_FarLessThanNearProjection_FarClipAtInfinity
      Projection_ClipRangeOpenGL
      __result - the calculated projection matrix
    • novrTimewarpProjectionDesc_FromProjection

      public static void novrTimewarpProjectionDesc_FromProjection(long projection, int projectionModFlags, long __result)
    • ovrTimewarpProjectionDesc_FromProjection

      public static OVRTimewarpProjectionDesc ovrTimewarpProjectionDesc_FromProjection(OVRMatrix4f projection, int projectionModFlags, OVRTimewarpProjectionDesc __result)
      Extracts the required data from the result of Matrix4f_Projection.
      Parameters:
      projection - the project matrix from which to extract OVRTimewarpProjectionDesc
      projectionModFlags - a combination of the ovrProjectionModifier flags. One or more of:
      Projection_NoneProjection_LeftHandedProjection_FarLessThanNear
      Projection_FarClipAtInfinityProjection_ClipRangeOpenGL
      __result - the extracted ovrTimewarpProjectionDesc
    • novrMatrix4f_OrthoSubProjection

      public static void novrMatrix4f_OrthoSubProjection(long projection, long orthoScale, float orthoDistance, float HmdToEyeOffsetX, long __result)
      Unsafe version of: Matrix4f_OrthoSubProjection
    • ovrMatrix4f_OrthoSubProjection

      public static OVRMatrix4f ovrMatrix4f_OrthoSubProjection(OVRMatrix4f projection, OVRVector2f orthoScale, float orthoDistance, float HmdToEyeOffsetX, OVRMatrix4f __result)
      Generates an orthographic sub-projection.

      Used for 2D rendering, Y is down.

      Parameters:
      projection - the perspective matrix that the orthographic matrix is derived from
      orthoScale - equal to 1.0f / pixelsPerTanAngleAtCenter
      orthoDistance - equal to the distance from the camera in meters, such as 0.8m
      HmdToEyeOffsetX - the offset of the eye from the center
      __result - the calculated projection matrix
    • novr_CalcEyePoses

      public static void novr_CalcEyePoses(long headPose, long HmdToEyePose, long outEyePoses)
      Unsafe version of: _CalcEyePoses
    • ovr_CalcEyePoses

      public static void ovr_CalcEyePoses(OVRPosef headPose, OVRPosef.Buffer HmdToEyePose, OVRPosef.Buffer outEyePoses)
      Computes offset eye poses based on headPose returned by OVRTrackingState.
      Parameters:
      headPose - indicates the HMD position and orientation to use for the calculation
      HmdToEyePose - can be OVREyeRenderDesc.HmdToEyePose returned from GetRenderDesc. For monoscopic rendering, use a position vector that is average of the two position vectors for each eye .
      outEyePoses - if outEyePoses are used for rendering, they should be passed to SubmitFrame in OVRLayerEyeFov::RenderPose or OVRLayerEyeFovDepth::RenderPose
    • novr_GetEyePoses

      public static void novr_GetEyePoses(long session, long frameIndex, boolean latencyMarker, long HmdToEyePose, long outEyePoses, long outSensorSampleTime)
      Unsafe version of: _GetEyePoses
    • ovr_GetEyePoses

      public static void ovr_GetEyePoses(long session, long frameIndex, boolean latencyMarker, OVRPosef.Buffer HmdToEyePose, OVRPosef.Buffer outEyePoses, @Nullable DoubleBuffer outSensorSampleTime)
      Returns the predicted head pose in outHmdTrackingState and offset eye poses in outEyePoses.

      This is a thread-safe function where caller should increment frameIndex with every frame and pass that index where applicable to functions called on the rendering thread. Assuming outEyePoses are used for rendering, it should be passed as a part of OVRLayerEyeFov. The caller does not need to worry about applying HmdToEyePose to the returned outEyePoses variables.

      Parameters:
      session - an ovrSession previously returned by Create
      frameIndex - the targeted frame index, or 0 to refer to one frame after the last time SubmitFrame was called
      latencyMarker - Specifies that this call is the point in time where the "App-to-Mid-Photon" latency timer starts from. If a given ovrLayer provides "SensorSampleTimestamp", that will override the value stored here.
      HmdToEyePose - can be OVREyeRenderDesc.HmdToEyePose returned from GetRenderDesc. For monoscopic rendering, use a position vector that is the average of the two position vectors for each eye.
      outEyePoses - the predicted eye poses
      outSensorSampleTime - the time when this function was called. May be NULL, in which case it is ignored.
    • novrPosef_FlipHandedness

      public static void novrPosef_FlipHandedness(long inPose, long outPose)
      Unsafe version of: Posef_FlipHandedness
    • ovrPosef_FlipHandedness

      public static void ovrPosef_FlipHandedness(OVRPosef inPose, OVRPosef outPose)
      Tracking poses provided by the SDK come in a right-handed coordinate system. If an application is passing in Projection_LeftHanded into Matrix4f_Projection, then it should also use this function to flip the HMD tracking poses to be left-handed.

      While this utility function is intended to convert a left-handed OVRPosef into a right-handed coordinate system, it will also work for converting right-handed to left-handed since the flip operation is the same for both cases.

      Parameters:
      inPose - a pose that is right-handed
      outPose - the pose that is requested to be left-handed (can be the same pointer to inPose)
    • novr_ReadWavFromBuffer

      public static int novr_ReadWavFromBuffer(long outAudioChannel, long inputData, int dataSizeInBytes, int stereoChannelToUse)
      Unsafe version of: _ReadWavFromBuffer
      Parameters:
      dataSizeInBytes - size of the buffer in bytes
    • ovr_ReadWavFromBuffer

      public static int ovr_ReadWavFromBuffer(OVRAudioChannelData outAudioChannel, ByteBuffer inputData, int stereoChannelToUse)
      Reads an audio channel from Wav (Waveform Audio File) data.

      Input must be a byte buffer representing a valid Wav file. Audio samples from the specified channel are read, converted to float [-1.0f, 1.0f] and returned through OVRAudioChannelData.

      Supported formats: PCM 8b, 16b, 32b and IEEE float (little-endian only).

      Parameters:
      outAudioChannel - output audio channel data
      inputData - a binary buffer representing a valid Wav file data
      stereoChannelToUse - audio channel index to extract (0 for mono)
    • novr_GenHapticsFromAudioData

      public static int novr_GenHapticsFromAudioData(long outHapticsClip, long audioChannel, int genMode)
      Unsafe version of: _GenHapticsFromAudioData
    • ovr_GenHapticsFromAudioData

      public static int ovr_GenHapticsFromAudioData(OVRHapticsClip outHapticsClip, OVRAudioChannelData audioChannel, int genMode)
      Generates playable Touch Haptics data from an audio channel.
      Parameters:
      outHapticsClip - generated Haptics clip
      audioChannel - input audio channel data
      genMode - mode used to convert and audio channel data to Haptics data. Must be:
      HapticsGenMode_PointSample
    • novr_ReleaseAudioChannelData

      public static void novr_ReleaseAudioChannelData(long audioChannel)
      Unsafe version of: _ReleaseAudioChannelData
    • ovr_ReleaseAudioChannelData

      public static void ovr_ReleaseAudioChannelData(OVRAudioChannelData audioChannel)
      Releases memory allocated for ovrAudioChannelData. Must be called to avoid memory leak.
      Parameters:
      audioChannel - pointer to an audio channel
    • novr_ReleaseHapticsClip

      public static void novr_ReleaseHapticsClip(long hapticsClip)
      Unsafe version of: _ReleaseHapticsClip
    • ovr_ReleaseHapticsClip

      public static void ovr_ReleaseHapticsClip(OVRHapticsClip hapticsClip)
      Releases memory allocated for ovrHapticsClip. Must be called to avoid memory leak.
      Parameters:
      hapticsClip - pointer to a haptics clip
    • novr_GetEyePoses

      public static void novr_GetEyePoses(long session, long frameIndex, boolean latencyMarker, long HmdToEyePose, long outEyePoses, double[] outSensorSampleTime)
    • ovr_GetEyePoses

      public static void ovr_GetEyePoses(long session, long frameIndex, boolean latencyMarker, OVRPosef.Buffer HmdToEyePose, OVRPosef.Buffer outEyePoses, @Nullable double[] outSensorSampleTime)
      Array version of: _GetEyePoses