Class OVRUtil
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Modes used to generate Touch Haptics from audio PCM buffer.static final int
Modes used to generate Touch Haptics from audio PCM buffer.static final int
Enumerates modifications to the projection matrix based on the application's needs.static final int
Enumerates modifications to the projection matrix based on the application's needs.static final int
Enumerates modifications to the projection matrix based on the application's needs.static final int
Enumerates modifications to the projection matrix based on the application's needs.static final int
Enumerates modifications to the projection matrix based on the application's needs. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
novr_CalcEyePoses
(long headPose, long HmdToEyePose, long outEyePoses) Unsafe version of:_CalcEyePoses
static void
novr_Detect
(int timeoutMilliseconds, long __result) Unsafe version of:_Detect
static int
novr_GenHapticsFromAudioData
(long outHapticsClip, long audioChannel, int genMode) Unsafe version of:_GenHapticsFromAudioData
static void
novr_GetEyePoses
(long session, long frameIndex, boolean latencyMarker, long HmdToEyePose, long outEyePoses, double[] outSensorSampleTime) Array version of:novr_GetEyePoses(long, long, boolean, long, long, long)
static void
novr_GetEyePoses
(long session, long frameIndex, boolean latencyMarker, long HmdToEyePose, long outEyePoses, long outSensorSampleTime) Unsafe version of:_GetEyePoses
static int
novr_ReadWavFromBuffer
(long outAudioChannel, long inputData, int dataSizeInBytes, int stereoChannelToUse) Unsafe version of:_ReadWavFromBuffer
static void
novr_ReleaseAudioChannelData
(long audioChannel) Unsafe version of:_ReleaseAudioChannelData
static void
novr_ReleaseHapticsClip
(long hapticsClip) Unsafe version of:_ReleaseHapticsClip
static void
novrMatrix4f_OrthoSubProjection
(long projection, long orthoScale, float orthoDistance, float HmdToEyeOffsetX, long __result) Unsafe version of:Matrix4f_OrthoSubProjection
static void
novrMatrix4f_Projection
(long fov, float znear, float zfar, int projectionModFlags, long __result) Unsafe version of:Matrix4f_Projection
static void
novrPosef_FlipHandedness
(long inPose, long outPose) Unsafe version of:Posef_FlipHandedness
static void
novrTimewarpProjectionDesc_FromProjection
(long projection, int projectionModFlags, long __result) Unsafe version of:TimewarpProjectionDesc_FromProjection
static void
ovr_CalcEyePoses
(OVRPosef headPose, OVRPosef.Buffer HmdToEyePose, OVRPosef.Buffer outEyePoses) Computes offset eye poses based onheadPose
returned byOVRTrackingState
.static OVRDetectResult
ovr_Detect
(int timeoutMilliseconds, OVRDetectResult __result) Detects Oculus Runtime and Device Status.static int
ovr_GenHapticsFromAudioData
(OVRHapticsClip outHapticsClip, OVRAudioChannelData audioChannel, int genMode) Generates playable Touch Haptics data from an audio channel.static void
ovr_GetEyePoses
(long session, long frameIndex, boolean latencyMarker, OVRPosef.Buffer HmdToEyePose, OVRPosef.Buffer outEyePoses, double[] outSensorSampleTime) Array version of:_GetEyePoses
static void
ovr_GetEyePoses
(long session, long frameIndex, boolean latencyMarker, OVRPosef.Buffer HmdToEyePose, OVRPosef.Buffer outEyePoses, DoubleBuffer outSensorSampleTime) Returns the predicted head pose inoutHmdTrackingState
and offset eye poses inoutEyePoses
.static int
ovr_ReadWavFromBuffer
(OVRAudioChannelData outAudioChannel, ByteBuffer inputData, int stereoChannelToUse) Reads an audio channel from Wav (Waveform Audio File) data.static void
ovr_ReleaseAudioChannelData
(OVRAudioChannelData audioChannel) Releases memory allocated for ovrAudioChannelData.static void
ovr_ReleaseHapticsClip
(OVRHapticsClip hapticsClip) Releases memory allocated for ovrHapticsClip.static OVRMatrix4f
ovrMatrix4f_OrthoSubProjection
(OVRMatrix4f projection, OVRVector2f orthoScale, float orthoDistance, float HmdToEyeOffsetX, OVRMatrix4f __result) Generates an orthographic sub-projection.static OVRMatrix4f
ovrMatrix4f_Projection
(OVRFovPort fov, float znear, float zfar, int projectionModFlags, OVRMatrix4f __result) Used to generate projection fromovrEyeDesc::Fov
.static void
ovrPosef_FlipHandedness
(OVRPosef inPose, OVRPosef outPose) Tracking poses provided by the SDK come in a right-handed coordinate system.static OVRTimewarpProjectionDesc
ovrTimewarpProjectionDesc_FromProjection
(OVRMatrix4f projection, int projectionModFlags, OVRTimewarpProjectionDesc __result) Extracts the required data from the result ofMatrix4f_Projection
.
-
Field Details
-
ovrProjection_None
public static final int ovrProjection_NoneEnumerates 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 intoMatrix4f_Projection
will be ignored NOTE: Enable only ifProjection_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_LeftHandedEnumerates 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 intoMatrix4f_Projection
will be ignored NOTE: Enable only ifProjection_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_FarLessThanNearEnumerates 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 intoMatrix4f_Projection
will be ignored NOTE: Enable only ifProjection_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_FarClipAtInfinityEnumerates 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 intoMatrix4f_Projection
will be ignored NOTE: Enable only ifProjection_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_ClipRangeOpenGLEnumerates 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 intoMatrix4f_Projection
will be ignored NOTE: Enable only ifProjection_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_PointSampleModes used to generate Touch Haptics from audio PCM buffer.Enum values:
HapticsGenMode_PointSample
- Point sample original signal at Haptics frequencyHapticsGenMode_Count
- See Also:
-
ovrHapticsGenMode_Count
public static final int ovrHapticsGenMode_CountModes used to generate Touch Haptics from audio PCM buffer.Enum values:
HapticsGenMode_PointSample
- Point sample original signal at Haptics frequencyHapticsGenMode_Count
- See Also:
-
-
Method Details
-
novr_Detect
public static void novr_Detect(int timeoutMilliseconds, long __result) Unsafe version of:_Detect
-
ovr_Detect
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 fromovrEyeDesc::Fov
.- Parameters:
fov
- theOVRFovPort
to useznear
- distance to near Z limitzfar
- distance to far Z limitprojectionModFlags
- a combination of theovrProjectionModifier
flags. One or more of:Projection_None
Projection_FarLessThanNear
Projection_FarClipAtInfinity
Projection_ClipRangeOpenGL
__result
- the calculated projection matrix
-
novrTimewarpProjectionDesc_FromProjection
public static void novrTimewarpProjectionDesc_FromProjection(long projection, int projectionModFlags, long __result) Unsafe version of:TimewarpProjectionDesc_FromProjection
-
ovrTimewarpProjectionDesc_FromProjection
public static OVRTimewarpProjectionDesc ovrTimewarpProjectionDesc_FromProjection(OVRMatrix4f projection, int projectionModFlags, OVRTimewarpProjectionDesc __result) Extracts the required data from the result ofMatrix4f_Projection
.- Parameters:
projection
- the project matrix from which to extractOVRTimewarpProjectionDesc
projectionModFlags
- a combination of the ovrProjectionModifier flags. One or more of:Projection_None
Projection_LeftHanded
Projection_FarLessThanNear
Projection_FarClipAtInfinity
Projection_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 fromorthoScale
- equal to1.0f / pixelsPerTanAngleAtCenter
orthoDistance
- equal to the distance from the camera in meters, such as 0.8mHmdToEyeOffsetX
- 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 onheadPose
returned byOVRTrackingState
.- Parameters:
headPose
- indicates the HMD position and orientation to use for the calculationHmdToEyePose
- can beOVREyeRenderDesc
.HmdToEyePose
returned fromGetRenderDesc
. For monoscopic rendering, use a position vector that is average of the two position vectors for each eye .outEyePoses
- ifoutEyePoses
are used for rendering, they should be passed toSubmitFrame
inOVRLayerEyeFov
::RenderPose
orOVRLayerEyeFovDepth
::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 inoutHmdTrackingState
and offset eye poses inoutEyePoses
.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. AssumingoutEyePoses
are used for rendering, it should be passed as a part ofOVRLayerEyeFov
. The caller does not need to worry about applyingHmdToEyePose
to the returnedoutEyePoses
variables.- Parameters:
session
- anovrSession
previously returned byCreate
frameIndex
- the targeted frame index, or 0 to refer to one frame after the last timeSubmitFrame
was calledlatencyMarker
- Specifies that this call is the point in time where the "App-to-Mid-Photon" latency timer starts from. If a givenovrLayer
provides "SensorSampleTimestamp", that will override the value stored here.HmdToEyePose
- can beOVREyeRenderDesc
.HmdToEyePose
returned fromGetRenderDesc
. For monoscopic rendering, use a position vector that is the average of the two position vectors for each eye.outEyePoses
- the predicted eye posesoutSensorSampleTime
- 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
Tracking poses provided by the SDK come in a right-handed coordinate system. If an application is passing inProjection_LeftHanded
intoMatrix4f_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-handedoutPose
- the pose that is requested to be left-handed (can be the same pointer toinPose
)
-
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 throughOVRAudioChannelData
.Supported formats: PCM 8b, 16b, 32b and IEEE float (little-endian only).
- Parameters:
outAudioChannel
- output audio channel datainputData
- a binary buffer representing a valid Wav file datastereoChannelToUse
- 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 clipaudioChannel
- input audio channel datagenMode
- 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
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
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) Array version of:novr_GetEyePoses(long, long, boolean, long, long, long)
-
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
-