Package com.jme3.input.vr.lwjgl_openvr
Class LWJGLOpenVR
java.lang.Object
com.jme3.input.vr.lwjgl_openvr.LWJGLOpenVR
- All Implemented Interfaces:
VRAPI
A class that wraps an OpenVR system.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionLWJGLOpenVR
(VREnvironment environment) Create a new OpenVR system attached to the givenVR environment
. -
Method Summary
Modifier and TypeMethodDescriptionstatic Matrix4f
convertSteamVRMatrix3ToMatrix4f
(org.lwjgl.openvr.HmdMatrix34 hmdMatrix, Matrix4f mat) Convert specific OpenVRHmdMatrix34
into JMEMatrix4f
static Matrix4f
convertSteamVRMatrix4ToMatrix4f
(org.lwjgl.openvr.HmdMatrix44 hmdMatrix, Matrix4f mat) Convert specific OpenVRHmdMatrix34_t
into JMEMatrix4f
void
destroy()
Close the link with underlying VR system and free all attached resources.Get the object that wraps natively the VR compositor.int
Get the Head Mounted Device (HMD) display frequency.Returns the transform between the view space and left eye space.Returns the transform between the view space and right eye space.Get the Head Mounted Device (HMD) left eye projection matrix.Get the Head Mounted Device (HMD) right eye projection matrix.Get the Head Mounted Device (HMD) left eye pose (position of the eye from the head) as avector
.Get the Head Mounted Device (HMD) right eye pose (position of the eye from the head) as avector
.float
Get the Head Mounted Device (HMD) interpupilar distance in meters.getName()
Get the name of the underlying VR system.Get the Head Mounted Device (HMD) orientation.Matrix4f[]
Get the Head Mounted Device (HMD) position.void
getPositionAndOrientation
(Vector3f storePos, Quaternion storeRot) Get the Head Mounted Device (HMD) position and orientation.void
getRenderSize
(Vector2f store) Get the size of a Head Mounted Device (HMD) rendering area in pixels.Get the seated to absolute position.getType()
Get the Head Mounted Device (HMD) type.Get the input provided by the underlying VR system.Get the object that wraps natively the VR system.long
initCamera
(boolean allowed) Initialize the headset camera.boolean
Initialize this object from a VR system.boolean
initVRCompositor
(boolean allowed) Initialize the VR compositor that will be used for rendering.boolean
Check if the VR API is initialized.void
printLatencyInfoToConsole
(boolean set) Set if latency information has to be logged.void
reset()
Reset the VR system.void
setFlipEyes
(boolean set) Flip the left and right eye.void
setTrackingSpace
(boolean isSeated) void
Update Head Mounted Device (HMD) pose internal storage.
-
Field Details
-
hmdTrackedDevicePoses
protected org.lwjgl.openvr.TrackedDevicePose[] hmdTrackedDevicePoses -
hmdErrorStore
-
poseMatrices
-
-
Constructor Details
-
LWJGLOpenVR
Create a new OpenVR system attached to the givenVR environment
.- Parameters:
environment
- the VR environment to which this API is attached.
-
-
Method Details
-
convertSteamVRMatrix3ToMatrix4f
public static Matrix4f convertSteamVRMatrix3ToMatrix4f(org.lwjgl.openvr.HmdMatrix34 hmdMatrix, Matrix4f mat) Convert specific OpenVRHmdMatrix34
into JMEMatrix4f
- Parameters:
hmdMatrix
- the input matrixmat
- the converted matrix- Returns:
- the converted matrix
-
convertSteamVRMatrix4ToMatrix4f
public static Matrix4f convertSteamVRMatrix4ToMatrix4f(org.lwjgl.openvr.HmdMatrix44 hmdMatrix, Matrix4f mat) Convert specific OpenVRHmdMatrix34_t
into JMEMatrix4f
- Parameters:
hmdMatrix
- the input matrixmat
- the converted matrix- Returns:
- the converted matrix
-
getVRinput
Description copied from interface:VRAPI
Get the input provided by the underlying VR system.- Specified by:
getVRinput
in interfaceVRAPI
- Returns:
- the input provided by the underlying VR system.
-
getVRSystem
Description copied from interface:VRAPI
Get the object that wraps natively the VR system.- Specified by:
getVRSystem
in interfaceVRAPI
- Returns:
- the object that wraps natively the VR system.
-
getCompositor
Description copied from interface:VRAPI
Get the object that wraps natively the VR compositor.- Specified by:
getCompositor
in interfaceVRAPI
- Returns:
- the object that wraps natively the VR system.
-
getName
Description copied from interface:VRAPI
Get the name of the underlying VR system. -
setFlipEyes
public void setFlipEyes(boolean set) Description copied from interface:VRAPI
Flip the left and right eye.- Specified by:
setFlipEyes
in interfaceVRAPI
- Parameters:
set
-true
if the eyes has to be flipped andfalse
otherwise.
-
printLatencyInfoToConsole
public void printLatencyInfoToConsole(boolean set) Description copied from interface:VRAPI
Set if latency information has to be logged.- Specified by:
printLatencyInfoToConsole
in interfaceVRAPI
- Parameters:
set
-true
if latency information has to be logged andfalse
otherwise.
-
getDisplayFrequency
public int getDisplayFrequency()Description copied from interface:VRAPI
Get the Head Mounted Device (HMD) display frequency.- Specified by:
getDisplayFrequency
in interfaceVRAPI
- Returns:
- the Head Mounted Device (HMD) display frequency.
-
initialize
public boolean initialize()Description copied from interface:VRAPI
Initialize this object from a VR system. All the native bindings to underlying VR system should be done within this method.- Specified by:
initialize
in interfaceVRAPI
- Returns:
true
if the initialization is a success andfalse
otherwise.
-
initVRCompositor
public boolean initVRCompositor(boolean allowed) Description copied from interface:VRAPI
Initialize the VR compositor that will be used for rendering.- Specified by:
initVRCompositor
in interfaceVRAPI
- Parameters:
allowed
-true
if the use of VR compositor is allowed andfalse
otherwise.- Returns:
true
if the initialization is a success andfalse
otherwise.
-
initCamera
public long initCamera(boolean allowed) Initialize the headset camera.- Parameters:
allowed
-true
is the use of the headset camera is allowed andfalse
otherwise.- Returns:
- token for camera
-
destroy
public void destroy()Description copied from interface:VRAPI
Close the link with underlying VR system and free all attached resources. -
isInitialized
public boolean isInitialized()Description copied from interface:VRAPI
Check if the VR API is initialized.- Specified by:
isInitialized
in interfaceVRAPI
- Returns:
true
if the VR API is initialized andfalse
otherwise.- See Also:
-
reset
public void reset()Description copied from interface:VRAPI
Reset the VR system. After a call to this method, the current position of the HMD should be the origin (i-e the observer without any combined transformation). -
getRenderSize
Description copied from interface:VRAPI
Get the size of a Head Mounted Device (HMD) rendering area in pixels.- Specified by:
getRenderSize
in interfaceVRAPI
- Parameters:
store
- the size of a Head Mounted Device (HMD) rendering area in pixels (modified).
-
getInterpupillaryDistance
public float getInterpupillaryDistance()Description copied from interface:VRAPI
Get the Head Mounted Device (HMD) interpupilar distance in meters.- Specified by:
getInterpupillaryDistance
in interfaceVRAPI
- Returns:
- the Head Mounted Device (HMD) interpupilar distance in meters.
-
getOrientation
Description copied from interface:VRAPI
Get the Head Mounted Device (HMD) orientation.- Specified by:
getOrientation
in interfaceVRAPI
- Returns:
- the Head Mounted Device (HMD) orientation.
-
getPosition
Description copied from interface:VRAPI
Get the Head Mounted Device (HMD) position.- Specified by:
getPosition
in interfaceVRAPI
- Returns:
- the Head Mounted Device (HMD) orientation.
-
getPositionAndOrientation
Description copied from interface:VRAPI
Get the Head Mounted Device (HMD) position and orientation.- Specified by:
getPositionAndOrientation
in interfaceVRAPI
- Parameters:
storePos
- the Head Mounted Device (HMD) position (modified).storeRot
- the Head Mounted Device (HMD) rotation (modified).
-
updatePose
public void updatePose()Description copied from interface:VRAPI
Update Head Mounted Device (HMD) pose internal storage. This method should be called before other calls to HMD position/orientation access.- Specified by:
updatePose
in interfaceVRAPI
-
getHMDMatrixProjectionLeftEye
Description copied from interface:VRAPI
Get the Head Mounted Device (HMD) left eye projection matrix.- Specified by:
getHMDMatrixProjectionLeftEye
in interfaceVRAPI
- Parameters:
cam
- the camera attached to the left eye.- Returns:
- the Head Mounted Device (HMD) left eye projection matrix.
-
getHMDMatrixProjectionRightEye
Description copied from interface:VRAPI
Get the Head Mounted Device (HMD) right eye projection matrix.- Specified by:
getHMDMatrixProjectionRightEye
in interfaceVRAPI
- Parameters:
cam
- the camera attached to the right eye.- Returns:
- the Head Mounted Device (HMD) right eye projection matrix.
-
getHMDVectorPoseLeftEye
Description copied from interface:VRAPI
Get the Head Mounted Device (HMD) left eye pose (position of the eye from the head) as avector
.- Specified by:
getHMDVectorPoseLeftEye
in interfaceVRAPI
- Returns:
- the Head Mounted Device (HMD) left eye pose as a
vector
.
-
getHMDVectorPoseRightEye
Description copied from interface:VRAPI
Get the Head Mounted Device (HMD) right eye pose (position of the eye from the head) as avector
.- Specified by:
getHMDVectorPoseRightEye
in interfaceVRAPI
- Returns:
- the Head Mounted Device (HMD) right eye pose as a
vector
.
-
getSeatedToAbsolutePosition
Description copied from interface:VRAPI
Get the seated to absolute position.- Specified by:
getSeatedToAbsolutePosition
in interfaceVRAPI
- Returns:
- the seated to absolute position.
-
getHMDMatrixPoseLeftEye
Description copied from interface:VRAPI
Returns the transform between the view space and left eye space. Eye space is the per-eye flavor of view space that provides stereo disparity. Instead of Model * View * Projection the model is Model * View * Eye * Projection. Normally View and Eye will be multiplied together and treated as View. This matrix incorporates the user's interpupillary distance (IPD).- Specified by:
getHMDMatrixPoseLeftEye
in interfaceVRAPI
- Returns:
- the transform between the view space and eye space.
-
getHMDMatrixPoseRightEye
Description copied from interface:VRAPI
Returns the transform between the view space and right eye space. Eye space is the per-eye flavor of view space that provides stereo disparity. Instead of Model * View * Projection the model is Model * View * Eye * Projection. Normally View and Eye will be multiplied together and treated as View. This matrix incorporates the user's interpupillary distance (IPD).- Specified by:
getHMDMatrixPoseRightEye
in interfaceVRAPI
- Returns:
- the transform between the view space and eye space.
-
getType
Description copied from interface:VRAPI
Get the Head Mounted Device (HMD) type. -
setTrackingSpace
public void setTrackingSpace(boolean isSeated) -
getPoseMatrices
-