Package com.jme3.input.vr
Interface VRAPI
- All Known Implementing Classes:
LWJGLOpenVR,OculusVR,OpenVR,OSVR
public interface VRAPI
An interface that represents a VR system. This interface has to be implemented in order to wrap underlying VR system (OpenVR, OSVR, ...)
-
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Close the link with underlying VR system and free all attached resources.Get the object that wraps natively the VR compositor.intGet 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.floatGet 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.Get the Head Mounted Device (HMD) position.voidgetPositionAndOrientation(Vector3f storePos, Quaternion storeRot) Get the Head Mounted Device (HMD) position and orientation.voidgetRenderSize(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.booleanInitialize this object from a VR system.booleaninitVRCompositor(boolean allowed) Initialize the VR compositor that will be used for rendering.booleanCheck if the VR API is initialized.voidprintLatencyInfoToConsole(boolean set) Set if latency information has to be logged.voidreset()Reset the VR system.voidsetFlipEyes(boolean set) Flip the left and right eye.voidUpdate Head Mounted Device (HMD) pose internal storage.
-
Method Details
-
initialize
boolean initialize()Initialize this object from a VR system. All the native bindings to underlying VR system should be done within this method.- Returns:
trueif the initialization is a success andfalseotherwise.
-
initVRCompositor
boolean initVRCompositor(boolean allowed) Initialize the VR compositor that will be used for rendering.- Parameters:
allowed-trueif the use of VR compositor is allowed andfalseotherwise.- Returns:
trueif the initialization is a success andfalseotherwise.
-
getVRSystem
Object getVRSystem()Get the object that wraps natively the VR system.- Returns:
- the object that wraps natively the VR system.
-
getCompositor
Object getCompositor()Get the object that wraps natively the VR compositor.- Returns:
- the object that wraps natively the VR system.
-
getName
String getName()Get the name of the underlying VR system.- Returns:
- the name of the underlying VR system.
-
getVRinput
VRInputAPI getVRinput()Get the input provided by the underlying VR system.- Returns:
- the input provided by the underlying VR system.
-
setFlipEyes
void setFlipEyes(boolean set) Flip the left and right eye.- Parameters:
set-trueif the eyes has to be flipped andfalseotherwise.
-
printLatencyInfoToConsole
void printLatencyInfoToConsole(boolean set) Set if latency information has to be logged.- Parameters:
set-trueif latency information has to be logged andfalseotherwise.
-
getDisplayFrequency
int getDisplayFrequency()Get the Head Mounted Device (HMD) display frequency.- Returns:
- the Head Mounted Device (HMD) display frequency.
-
destroy
void destroy()Close the link with underlying VR system and free all attached resources. -
isInitialized
boolean isInitialized()Check if the VR API is initialized.- Returns:
trueif the VR API is initialized andfalseotherwise.- See Also:
-
reset
void reset()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
Get the size of a Head Mounted Device (HMD) rendering area in pixels.- Parameters:
store- the size of a Head Mounted Device (HMD) rendering area in pixels (modified).
-
getInterpupillaryDistance
float getInterpupillaryDistance()Get the Head Mounted Device (HMD) interpupilar distance in meters.- Returns:
- the Head Mounted Device (HMD) interpupilar distance in meters.
-
getOrientation
Quaternion getOrientation()Get the Head Mounted Device (HMD) orientation.- Returns:
- the Head Mounted Device (HMD) orientation.
-
getPosition
Vector3f getPosition()Get the Head Mounted Device (HMD) position.- Returns:
- the Head Mounted Device (HMD) orientation.
-
getPositionAndOrientation
Get the Head Mounted Device (HMD) position and orientation.- Parameters:
storePos- the Head Mounted Device (HMD) position (modified).storeRot- the Head Mounted Device (HMD) rotation (modified).
-
updatePose
void updatePose()Update Head Mounted Device (HMD) pose internal storage. This method should be called before other calls to HMD position/orientation access. -
getHMDMatrixProjectionLeftEye
Get the Head Mounted Device (HMD) left eye projection matrix.- Parameters:
cam- the camera attached to the left eye.- Returns:
- the Head Mounted Device (HMD) left eye projection matrix.
-
getHMDMatrixProjectionRightEye
Get the Head Mounted Device (HMD) right eye projection matrix.- Parameters:
cam- the camera attached to the right eye.- Returns:
- the Head Mounted Device (HMD) right eye projection matrix.
-
getHMDVectorPoseLeftEye
Vector3f getHMDVectorPoseLeftEye()Get the Head Mounted Device (HMD) left eye pose (position of the eye from the head) as avector.- Returns:
- the Head Mounted Device (HMD) left eye pose as a
vector.
-
getHMDVectorPoseRightEye
Vector3f getHMDVectorPoseRightEye()Get the Head Mounted Device (HMD) right eye pose (position of the eye from the head) as avector.- Returns:
- the Head Mounted Device (HMD) right eye pose as a
vector.
-
getHMDMatrixPoseLeftEye
Matrix4f getHMDMatrixPoseLeftEye()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).- Returns:
- the transform between the view space and eye space.
-
getHMDMatrixPoseRightEye
Matrix4f getHMDMatrixPoseRightEye()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).- Returns:
- the transform between the view space and eye space.
-
getType
HmdType getType()Get the Head Mounted Device (HMD) type.- Returns:
- the Head Mounted Device (HMD) type.
-
getSeatedToAbsolutePosition
Vector3f getSeatedToAbsolutePosition()Get the seated to absolute position.- Returns:
- the seated to absolute position.
-