Package com.jme3.input.vr.oculus
Class OculusVR
java.lang.Object
com.jme3.input.vr.oculus.OculusVR
- All Implemented Interfaces:
VRAPI
Oculus VR (LibOVR 1.3.0) Native support.
A few notes about the Oculus coordinate system:
- Matrices should be transposed
- Quaternions should be inverted
- Vectors should have their X and Z axes flipped, but apparently not Y.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Close the link with underlying VR system and free all attached resources.voidlonggetChain(int eye) Get the object that wraps natively the VR compositor.intGet the Head Mounted Device (HMD) display frequency.org.lwjgl.ovr.OVRPosefgetEyePose(int eye) org.lwjgl.ovr.OVRFovPortgetFramebuffers(int eye) org.lwjgl.ovr.OVRPosefReturns 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.org.lwjgl.ovr.OVRLayerEyeFovorg.lwjgl.PointerBuffergetName()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.longgetType()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 set) Initialize the VR compositor that will be used for rendering.booleanCheck if the VR API is initialized.static Matrix4fCopy the values from a LibOVR matrix into a jMonkeyEngine matrix.voidprintLatencyInfoToConsole(boolean set) Set if latency information has to be logged.static QuaternionquatO2J(org.lwjgl.ovr.OVRQuatf from, Quaternion to) Copy the values from a LibOVR quaternion into a jMonkeyEngine quaternion.voidreset()Reset the VR system.voidsetFlipEyes(boolean set) Flip the left and right eye.voidsetupFramebuffers(int eye) Create a framebuffer for an eye.voidvoidUpdate Head Mounted Device (HMD) pose internal storage.static Vector3fCopy the values from a LibOVR vector into a jMonkeyEngine vector.
-
Constructor Details
-
OculusVR
-
-
Method Details
-
getVRinput
Description copied from interface:VRAPIGet the input provided by the underlying VR system.- Specified by:
getVRinputin interfaceVRAPI- Returns:
- the input provided by the underlying VR system.
-
getName
Description copied from interface:VRAPIGet the name of the underlying VR system. -
getDisplayFrequency
public int getDisplayFrequency()Description copied from interface:VRAPIGet the Head Mounted Device (HMD) display frequency.- Specified by:
getDisplayFrequencyin interfaceVRAPI- Returns:
- the Head Mounted Device (HMD) display frequency.
-
initialize
public boolean initialize()Description copied from interface:VRAPIInitialize this object from a VR system. All the native bindings to underlying VR system should be done within this method.- Specified by:
initializein interfaceVRAPI- Returns:
trueif the initialization is a success andfalseotherwise.
-
updatePose
public void updatePose()Description copied from interface:VRAPIUpdate Head Mounted Device (HMD) pose internal storage. This method should be called before other calls to HMD position/orientation access.- Specified by:
updatePosein interfaceVRAPI
-
isInitialized
public boolean isInitialized()Description copied from interface:VRAPICheck if the VR API is initialized.- Specified by:
isInitializedin interfaceVRAPI- Returns:
trueif the VR API is initialized andfalseotherwise.- See Also:
-
destroy
public void destroy()Description copied from interface:VRAPIClose the link with underlying VR system and free all attached resources. -
reset
public void reset()Description copied from interface:VRAPIReset 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:VRAPIGet the size of a Head Mounted Device (HMD) rendering area in pixels.- Specified by:
getRenderSizein interfaceVRAPI- Parameters:
store- the size of a Head Mounted Device (HMD) rendering area in pixels (modified).
-
getInterpupillaryDistance
public float getInterpupillaryDistance()Description copied from interface:VRAPIGet the Head Mounted Device (HMD) interpupilar distance in meters.- Specified by:
getInterpupillaryDistancein interfaceVRAPI- Returns:
- the Head Mounted Device (HMD) interpupilar distance in meters.
-
getOrientation
Description copied from interface:VRAPIGet the Head Mounted Device (HMD) orientation.- Specified by:
getOrientationin interfaceVRAPI- Returns:
- the Head Mounted Device (HMD) orientation.
-
getPosition
Description copied from interface:VRAPIGet the Head Mounted Device (HMD) position.- Specified by:
getPositionin interfaceVRAPI- Returns:
- the Head Mounted Device (HMD) orientation.
-
getPositionAndOrientation
Description copied from interface:VRAPIGet the Head Mounted Device (HMD) position and orientation.- Specified by:
getPositionAndOrientationin interfaceVRAPI- Parameters:
storePos- the Head Mounted Device (HMD) position (modified).storeRot- the Head Mounted Device (HMD) rotation (modified).
-
getHMDMatrixProjectionLeftEye
Description copied from interface:VRAPIGet the Head Mounted Device (HMD) left eye projection matrix.- Specified by:
getHMDMatrixProjectionLeftEyein 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:VRAPIGet the Head Mounted Device (HMD) right eye projection matrix.- Specified by:
getHMDMatrixProjectionRightEyein 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:VRAPIGet the Head Mounted Device (HMD) left eye pose (position of the eye from the head) as avector.- Specified by:
getHMDVectorPoseLeftEyein interfaceVRAPI- Returns:
- the Head Mounted Device (HMD) left eye pose as a
vector.
-
getHMDVectorPoseRightEye
Description copied from interface:VRAPIGet the Head Mounted Device (HMD) right eye pose (position of the eye from the head) as avector.- Specified by:
getHMDVectorPoseRightEyein interfaceVRAPI- Returns:
- the Head Mounted Device (HMD) right eye pose as a
vector.
-
getSeatedToAbsolutePosition
Description copied from interface:VRAPIGet the seated to absolute position.- Specified by:
getSeatedToAbsolutePositionin interfaceVRAPI- Returns:
- the seated to absolute position.
-
getHMDMatrixPoseLeftEye
Description copied from interface:VRAPIReturns 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:
getHMDMatrixPoseLeftEyein interfaceVRAPI- Returns:
- the transform between the view space and eye space.
-
getHMDMatrixPoseRightEye
Description copied from interface:VRAPIReturns 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:
getHMDMatrixPoseRightEyein interfaceVRAPI- Returns:
- the transform between the view space and eye space.
-
getType
Description copied from interface:VRAPIGet the Head Mounted Device (HMD) type. -
initVRCompositor
public boolean initVRCompositor(boolean set) Description copied from interface:VRAPIInitialize the VR compositor that will be used for rendering.- Specified by:
initVRCompositorin interfaceVRAPI- Parameters:
set-trueif the use of VR compositor is allowed andfalseotherwise.- Returns:
trueif the initialization is a success andfalseotherwise.
-
printLatencyInfoToConsole
public void printLatencyInfoToConsole(boolean set) Description copied from interface:VRAPISet if latency information has to be logged.- Specified by:
printLatencyInfoToConsolein interfaceVRAPI- Parameters:
set-trueif latency information has to be logged andfalseotherwise.
-
setFlipEyes
public void setFlipEyes(boolean set) Description copied from interface:VRAPIFlip the left and right eye.- Specified by:
setFlipEyesin interfaceVRAPI- Parameters:
set-trueif the eyes has to be flipped andfalseotherwise.
-
getCompositor
Description copied from interface:VRAPIGet the object that wraps natively the VR compositor.- Specified by:
getCompositorin interfaceVRAPI- Returns:
- the object that wraps natively the VR system.
-
getVRSystem
Description copied from interface:VRAPIGet the object that wraps natively the VR system.- Specified by:
getVRSystemin interfaceVRAPI- Returns:
- the object that wraps natively the VR system.
-
findHMDTextureSize
public void findHMDTextureSize() -
setupLayers
public void setupLayers() -
setupFramebuffers
public void setupFramebuffers(int eye) Create a framebuffer for an eye. -
matrixO2J
Copy the values from a LibOVR matrix into a jMonkeyEngine matrix.- Parameters:
from- The matrix to copy from.to- The matrix to copy to.- Returns:
- The
toargument.
-
quatO2J
Copy the values from a LibOVR quaternion into a jMonkeyEngine quaternion.- Parameters:
from- The quaternion to copy from.to- The quaternion to copy to.- Returns:
- The
toargument.
-
vecO2J
Copy the values from a LibOVR vector into a jMonkeyEngine vector.- Parameters:
from- The vector to copy from.to- The vector to copy to.- Returns:
- The
toargument.
-
getSessionPointer
public long getSessionPointer() -
getChain
public long getChain(int eye) -
getFramebuffers
-
getLayers
public org.lwjgl.PointerBuffer getLayers() -
getLayer0
public org.lwjgl.ovr.OVRLayerEyeFov getLayer0() -
getFovPort
public org.lwjgl.ovr.OVRFovPort getFovPort() -
getHeadPose
public org.lwjgl.ovr.OVRPosef getHeadPose() -
getEyePose
public org.lwjgl.ovr.OVRPosef getEyePose(int eye) -
getEnvironment
-